From 7940e44f4517de5e2634a7e07d58d0fb26160513 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Fri, 12 Jul 2013 13:46:57 -0700 Subject: Create separate Android.mk for main build targets The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81 --- runtime/invoke_arg_array_builder.h | 183 +++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 runtime/invoke_arg_array_builder.h (limited to 'runtime/invoke_arg_array_builder.h') diff --git a/runtime/invoke_arg_array_builder.h b/runtime/invoke_arg_array_builder.h new file mode 100644 index 0000000000..b57d60a70f --- /dev/null +++ b/runtime/invoke_arg_array_builder.h @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2012 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_SRC_INVOKE_ARG_ARRAY_BUILDER_H_ +#define ART_SRC_INVOKE_ARG_ARRAY_BUILDER_H_ + +#include "mirror/object.h" +#include "scoped_thread_state_change.h" + +namespace art { + +static inline size_t NumArgArrayBytes(const char* shorty, uint32_t shorty_len) { + size_t num_bytes = 0; + for (size_t i = 1; i < shorty_len; ++i) { + char ch = shorty[i]; + if (ch == 'D' || ch == 'J') { + num_bytes += 8; + } else if (ch == 'L') { + // Argument is a reference or an array. The shorty descriptor + // does not distinguish between these types. + num_bytes += sizeof(mirror::Object*); + } else { + num_bytes += 4; + } + } + return num_bytes; +} + +class ArgArray { + public: + explicit ArgArray(const char* shorty, uint32_t shorty_len) + : shorty_(shorty), shorty_len_(shorty_len), num_bytes_(0) { + size_t num_slots = shorty_len + 1; // +1 in case of receiver. + if (LIKELY((num_slots * 2) < kSmallArgArraySize)) { + // We can trivially use the small arg array. + arg_array_ = small_arg_array_; + } else { + // Analyze shorty to see if we need the large arg array. + for (size_t i = 1; i < shorty_len; ++i) { + char c = shorty[i]; + if (c == 'J' || c == 'D') { + num_slots++; + } + } + if (num_slots <= kSmallArgArraySize) { + arg_array_ = small_arg_array_; + } else { + large_arg_array_.reset(new uint32_t[num_slots]); + arg_array_ = large_arg_array_.get(); + } + } + } + + uint32_t* GetArray() { + return arg_array_; + } + + uint32_t GetNumBytes() { + return num_bytes_; + } + + void Append(uint32_t value) { + arg_array_[num_bytes_ / 4] = value; + num_bytes_ += 4; + } + + void AppendWide(uint64_t value) { + // For ARM and MIPS portable, align wide values to 8 bytes (ArgArray starts at offset of 4). +#if defined(ART_USE_PORTABLE_COMPILER) && (defined(__arm__) || defined(__mips__)) + if (num_bytes_ % 8 == 0) { + num_bytes_ += 4; + } +#endif + arg_array_[num_bytes_ / 4] = value; + arg_array_[(num_bytes_ / 4) + 1] = value >> 32; + num_bytes_ += 8; + } + + void BuildArgArray(const ScopedObjectAccess& soa, mirror::Object* receiver, va_list ap) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + // Set receiver if non-null (method is not static) + if (receiver != NULL) { + Append(reinterpret_cast(receiver)); + } + for (size_t i = 1; i < shorty_len_; ++i) { + switch (shorty_[i]) { + case 'Z': + case 'B': + case 'C': + case 'S': + case 'I': + Append(va_arg(ap, jint)); + break; + case 'F': { + JValue value; + value.SetF(va_arg(ap, jdouble)); + Append(value.GetI()); + break; + } + case 'L': + Append(reinterpret_cast(soa.Decode(va_arg(ap, jobject)))); + break; + case 'D': { + JValue value; + value.SetD(va_arg(ap, jdouble)); + AppendWide(value.GetJ()); + break; + } + case 'J': { + AppendWide(va_arg(ap, jlong)); + break; + } + } + } + } + + void BuildArgArray(const ScopedObjectAccess& soa, mirror::Object* receiver, jvalue* args) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + // Set receiver if non-null (method is not static) + if (receiver != NULL) { + Append(reinterpret_cast(receiver)); + } + for (size_t i = 1, args_offset = 0; i < shorty_len_; ++i, ++args_offset) { + switch (shorty_[i]) { + case 'Z': + Append(args[args_offset].z); + break; + case 'B': + Append(args[args_offset].b); + break; + case 'C': + Append(args[args_offset].c); + break; + case 'S': + Append(args[args_offset].s); + break; + case 'I': + case 'F': + Append(args[args_offset].i); + break; + case 'L': + Append(reinterpret_cast(soa.Decode(args[args_offset].l))); + break; + case 'D': + case 'J': + AppendWide(args[args_offset].j); + break; + } + } + } + + void BuildArgArray(ShadowFrame* shadow_frame, uint32_t arg_offset) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + arg_array_ = shadow_frame->GetVRegArgs(arg_offset); + num_bytes_ = (shadow_frame->NumberOfVRegs() - arg_offset) * 4; + } + + private: + enum { kSmallArgArraySize = 16 }; + const char* const shorty_; + const uint32_t shorty_len_; + uint32_t num_bytes_; + uint32_t* arg_array_; + uint32_t small_arg_array_[kSmallArgArraySize]; + UniquePtr large_arg_array_; +}; + +} // namespace art + +#endif // ART_SRC_INVOKE_ARG_ARRAY_BUILDER_H_ -- cgit v1.2.3-59-g8ed1b From fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Wed, 17 Jul 2013 14:40:12 -0700 Subject: Fix multiple inclusion guards to match new pathnames Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43 --- Android.mk | 20 +++++++++++++++----- compiler/dex/arena_allocator.h | 6 +++--- compiler/dex/arena_bit_vector.h | 6 +++--- compiler/dex/backend.h | 6 +++--- compiler/dex/compiler_enums.h | 6 +++--- compiler/dex/compiler_internals.h | 6 +++--- compiler/dex/compiler_ir.h | 6 +++--- compiler/dex/dataflow_iterator-inl.h | 6 +++--- compiler/dex/dataflow_iterator.h | 6 +++--- compiler/dex/frontend.h | 6 +++--- compiler/dex/growable_array.h | 6 +++--- compiler/dex/local_value_numbering.h | 6 +++--- compiler/dex/mir_graph.h | 6 +++--- compiler/dex/portable/mir_to_gbc.h | 6 +++--- compiler/dex/quick/arm/arm_lir.h | 6 +++--- compiler/dex/quick/arm/codegen_arm.h | 6 +++--- compiler/dex/quick/mips/codegen_mips.h | 6 +++--- compiler/dex/quick/mips/mips_lir.h | 6 +++--- compiler/dex/quick/mir_to_lir-inl.h | 6 +++--- compiler/dex/quick/mir_to_lir.h | 6 +++--- compiler/dex/quick/x86/codegen_x86.h | 6 +++--- compiler/dex/quick/x86/x86_lir.h | 6 +++--- compiler/driver/compiler_driver.h | 6 +++--- compiler/driver/dex_compilation_unit.h | 6 +++--- compiler/elf_fixup.h | 6 +++--- compiler/elf_stripper.h | 6 +++--- compiler/elf_writer.h | 6 +++--- compiler/elf_writer_mclinker.h | 6 +++--- compiler/elf_writer_quick.h | 6 +++--- compiler/image_writer.h | 6 +++--- compiler/jni/portable/jni_compiler.h | 6 +++--- compiler/jni/quick/arm/calling_convention_arm.h | 6 +++--- compiler/jni/quick/calling_convention.h | 6 +++--- compiler/jni/quick/mips/calling_convention_mips.h | 6 +++--- compiler/jni/quick/x86/calling_convention_x86.h | 6 +++--- compiler/llvm/backend_options.h | 6 +++--- compiler/llvm/backend_types.h | 6 +++--- compiler/llvm/compiler_llvm.h | 6 +++--- compiler/llvm/intrinsic_helper.h | 6 +++--- compiler/llvm/ir_builder.h | 6 +++--- compiler/llvm/llvm_compilation_unit.h | 6 +++--- compiler/llvm/md_builder.h | 6 +++--- compiler/llvm/runtime_support_builder.h | 6 +++--- compiler/llvm/runtime_support_builder_arm.h | 6 +++--- compiler/llvm/runtime_support_builder_thumb2.h | 6 +++--- compiler/llvm/runtime_support_builder_x86.h | 6 +++--- compiler/llvm/runtime_support_llvm_func.h | 6 +++--- compiler/llvm/utils_llvm.h | 6 +++--- compiler/oat_writer.h | 6 +++--- compiler/sea_ir/instruction_tools.h | 6 +++--- compiler/sea_ir/sea.h | 6 +++--- compiler/stubs/stubs.h | 6 +++--- jdwpspy/Common.h | 6 +++--- runtime/asm_support.h | 6 +++--- runtime/atomic.h | 6 +++--- runtime/atomic_integer.h | 6 +++--- runtime/barrier.h | 6 +++--- runtime/base/casts.h | 6 +++--- runtime/base/histogram-inl.h | 6 +++--- runtime/base/histogram.h | 6 +++--- runtime/base/logging.h | 6 +++--- runtime/base/macros.h | 6 +++--- runtime/base/mutex-inl.h | 6 +++--- runtime/base/mutex.h | 6 +++--- runtime/base/stl_util.h | 6 +++--- runtime/base/stringpiece.h | 6 +++--- runtime/base/stringprintf.h | 6 +++--- runtime/base/timing_logger.h | 6 +++--- runtime/base/unix_file/fd_file.h | 6 +++--- runtime/base/unix_file/mapped_file.h | 6 +++--- runtime/base/unix_file/null_file.h | 6 +++--- runtime/base/unix_file/random_access_file.h | 6 +++--- runtime/base/unix_file/random_access_file_test.h | 6 +++--- runtime/base/unix_file/random_access_file_utils.h | 6 +++--- runtime/base/unix_file/string_file.h | 6 +++--- runtime/class_linker-inl.h | 6 +++--- runtime/class_linker.h | 6 +++--- runtime/class_reference.h | 6 +++--- runtime/closure.h | 6 +++--- runtime/common_test.h | 5 +++++ runtime/common_throws.h | 6 +++--- runtime/compiled_class.h | 6 +++--- runtime/compiled_method.h | 6 +++--- runtime/constants_arm.h | 6 +++--- runtime/constants_mips.h | 6 +++--- runtime/constants_x86.h | 6 +++--- runtime/debugger.h | 6 +++--- runtime/dex_file-inl.h | 6 +++--- runtime/dex_file.h | 6 +++--- runtime/dex_file_verifier.h | 6 +++--- runtime/dex_instruction-inl.h | 6 +++--- runtime/dex_instruction.h | 6 +++--- runtime/dex_instruction_list.h | 6 ++++++ runtime/dex_instruction_visitor.h | 6 +++--- runtime/dex_method_iterator.h | 6 +++--- runtime/disassembler.h | 6 +++--- runtime/disassembler_arm.h | 6 +++--- runtime/disassembler_mips.h | 6 +++--- runtime/disassembler_x86.h | 6 +++--- runtime/elf_file.h | 6 +++--- runtime/file_output_stream.h | 6 +++--- runtime/gc/accounting/atomic_stack.h | 6 +++--- runtime/gc/accounting/card_table-inl.h | 6 +++--- runtime/gc/accounting/card_table.h | 6 +++--- runtime/gc/accounting/heap_bitmap-inl.h | 6 +++--- runtime/gc/accounting/heap_bitmap.h | 6 +++--- runtime/gc/accounting/mod_union_table-inl.h | 6 +++--- runtime/gc/accounting/mod_union_table.h | 6 +++--- runtime/gc/accounting/space_bitmap-inl.h | 6 +++--- runtime/gc/accounting/space_bitmap.h | 6 +++--- runtime/gc/allocator/dlmalloc.h | 6 +++--- runtime/gc/collector/garbage_collector.h | 6 +++--- runtime/gc/collector/gc_type.h | 6 +++--- runtime/gc/collector/mark_sweep-inl.h | 6 +++--- runtime/gc/collector/mark_sweep.h | 6 +++--- runtime/gc/collector/partial_mark_sweep.h | 6 +++--- runtime/gc/collector/sticky_mark_sweep.h | 6 +++--- runtime/gc/heap.h | 6 +++--- runtime/gc/space/dlmalloc_space.h | 6 +++--- runtime/gc/space/image_space.h | 6 +++--- runtime/gc/space/large_object_space.h | 6 +++--- runtime/gc/space/space-inl.h | 6 +++--- runtime/gc/space/space.h | 6 +++--- runtime/gc_map.h | 6 +++--- runtime/globals.h | 6 +++--- runtime/hprof/hprof.h | 6 +++--- runtime/image.h | 6 +++--- runtime/indenter.h | 6 +++--- runtime/indirect_reference_table.h | 6 +++--- runtime/instruction_set.h | 6 +++--- runtime/instrumentation.h | 6 +++--- runtime/intern_table.h | 6 +++--- runtime/interpreter/interpreter.h | 6 +++--- runtime/invoke_arg_array_builder.h | 6 +++--- runtime/invoke_type.h | 6 +++--- runtime/jdwp/jdwp.h | 6 +++--- runtime/jdwp/jdwp_bits.h | 6 +++--- runtime/jdwp/jdwp_constants.h | 6 +++--- runtime/jdwp/jdwp_event.h | 6 +++--- runtime/jdwp/jdwp_expand_buf.h | 6 +++--- runtime/jdwp/jdwp_priv.h | 6 +++--- runtime/jdwp/object_registry.h | 5 +++++ runtime/jni_internal.h | 6 +++--- runtime/jobject_comparator.h | 6 +++--- runtime/jvalue.h | 6 +++--- runtime/leb128.h | 6 +++--- runtime/locks.h | 6 +++--- runtime/log_severity.h | 6 +++--- runtime/mem_map.h | 6 +++--- runtime/memory_region.h | 6 +++--- runtime/method_reference.h | 6 +++--- runtime/mirror/abstract_method-inl.h | 6 +++--- runtime/mirror/abstract_method.h | 6 +++--- runtime/mirror/array-inl.h | 6 +++--- runtime/mirror/array.h | 6 +++--- runtime/mirror/class-inl.h | 6 +++--- runtime/mirror/class.h | 6 +++--- runtime/mirror/class_loader.h | 6 +++--- runtime/mirror/dex_cache-inl.h | 6 +++--- runtime/mirror/dex_cache.h | 6 +++--- runtime/mirror/field-inl.h | 6 +++--- runtime/mirror/field.h | 6 +++--- runtime/mirror/iftable-inl.h | 6 +++--- runtime/mirror/iftable.h | 6 +++--- runtime/mirror/object-inl.h | 6 +++--- runtime/mirror/object.h | 6 +++--- runtime/mirror/object_array-inl.h | 6 +++--- runtime/mirror/object_array.h | 6 +++--- runtime/mirror/proxy.h | 6 +++--- runtime/mirror/stack_trace_element.h | 6 +++--- runtime/mirror/string.h | 6 +++--- runtime/mirror/throwable.h | 6 +++--- runtime/modifiers.h | 6 +++--- runtime/monitor.h | 6 +++--- runtime/nth_caller_visitor.h | 6 +++--- runtime/oat.h | 6 +++--- runtime/oat/runtime/argument_visitor.h | 6 +++--- runtime/oat/runtime/arm/context_arm.h | 6 +++--- runtime/oat/runtime/callee_save_frame.h | 6 +++--- runtime/oat/runtime/context.h | 6 +++--- runtime/oat/runtime/mips/context_mips.h | 6 +++--- runtime/oat/runtime/oat_support_entrypoints.h | 6 +++--- runtime/oat/runtime/x86/context_x86.h | 6 +++--- runtime/oat/utils/arm/assembler_arm.h | 6 +++--- runtime/oat/utils/arm/managed_register_arm.h | 6 +++--- runtime/oat/utils/assembler.h | 6 +++--- runtime/oat/utils/managed_register.h | 6 +++--- runtime/oat/utils/mips/assembler_mips.h | 6 +++--- runtime/oat/utils/mips/managed_register_mips.h | 6 +++--- runtime/oat/utils/x86/assembler_x86.h | 6 +++--- runtime/oat/utils/x86/managed_register_x86.h | 6 +++--- runtime/oat_file.h | 6 +++--- runtime/object_utils.h | 6 +++--- runtime/offsets.h | 6 +++--- runtime/os.h | 6 +++--- runtime/output_stream.h | 6 +++--- runtime/primitive.h | 6 +++--- runtime/reference_table.h | 6 +++--- runtime/reflection.h | 6 +++--- runtime/root_visitor.h | 6 +++--- runtime/runtime.h | 6 +++--- runtime/runtime_stats.h | 6 +++--- runtime/runtime_support.h | 6 +++--- runtime/runtime_support_llvm.h | 6 +++--- runtime/runtime_support_llvm_func_list.h | 6 ++++++ runtime/safe_map.h | 6 +++--- runtime/scoped_thread_state_change.h | 6 +++--- runtime/signal_catcher.h | 6 +++--- runtime/signal_set.h | 6 +++--- runtime/sirt_ref.h | 6 +++--- runtime/stack.h | 6 +++--- runtime/stack_indirect_reference_table.h | 6 +++--- runtime/strutil.h | 6 +++--- runtime/thread-inl.h | 6 +++--- runtime/thread.h | 6 +++--- runtime/thread_list.h | 6 +++--- runtime/thread_pool.h | 6 +++--- runtime/thread_state.h | 6 +++--- runtime/throw_location.h | 6 +++--- runtime/trace.h | 6 +++--- runtime/utf.h | 6 +++--- runtime/utils.h | 6 +++--- runtime/vector_output_stream.h | 6 +++--- runtime/verifier/dex_gc_map.h | 6 +++--- runtime/verifier/instruction_flags.h | 6 +++--- runtime/verifier/method_verifier.h | 6 +++--- runtime/verifier/reg_type.h | 6 +++--- runtime/verifier/reg_type_cache-inl.h | 6 +++--- runtime/verifier/reg_type_cache.h | 6 +++--- runtime/verifier/register_line-inl.h | 6 +++--- runtime/verifier/register_line.h | 6 +++--- runtime/well_known_classes.h | 6 +++--- runtime/zip_archive.h | 6 +++--- tools/cpplint.py | 7 +++++-- 234 files changed, 726 insertions(+), 691 deletions(-) (limited to 'runtime/invoke_arg_array_builder.h') diff --git a/Android.mk b/Android.mk index 4ffa9ac0ab..5a28723e8e 100644 --- a/Android.mk +++ b/Android.mk @@ -78,8 +78,11 @@ clean-oat-target: adb shell rm system/app/*.odex adb shell rm data/run-test/test-*/dalvik-cache/*@classes.dex +######################################################################## +# darwin build + # we aren't building most of art on darwin right now, but we do need to build new dalvikvm -ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-x86) +ifeq ($(HOST_OS),darwin) art_dont_bother := true include $(art_path)/dalvikvm/Android.mk endif @@ -325,14 +328,21 @@ dump-oat-Calculator: $(TARGET_OUT_APPS)/Calculator.odex $(TARGET_BOOT_IMG_OUT) $ endif ######################################################################## -# cpplint target +# cpplint targets to style check art source files -# "mm cpplint-art" to style check art source files +# "mm cpplint-art" to verify we aren't regressing .PHONY: cpplint-art cpplint-art: ./art/tools/cpplint.py \ - --filter=-whitespace/comments,-whitespace/line_length,-build/include,-build/header_guard,-readability/function,-readability/streams,-readability/todo,-runtime/references \ - $(ANDROID_BUILD_TOP)/art/src/*.h $(ANDROID_BUILD_TOP)/art/src/*.cc + --filter=-,+build/header_guard, \ + $(shell find art -name *.h -o -name *$(ART_CPP_EXTENSION)) + +# "mm cpplint-art-aspirational" to see warnings we would like to fix +.PHONY: cpplint-art-aspirational +cpplint-art-aspirational: + ./art/tools/cpplint.py \ + --filter=-whitespace/comments,-whitespace/line_length,-build/include,-readability/function,-readability/streams,-readability/todo,-runtime/references \ + $(shell find art -name *.h -o -name *$(ART_CPP_EXTENSION)) ######################################################################## # targets to switch back and forth from libdvm to libart diff --git a/compiler/dex/arena_allocator.h b/compiler/dex/arena_allocator.h index 78d4614f90..23d6b9f06b 100644 --- a/compiler/dex/arena_allocator.h +++ b/compiler/dex/arena_allocator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_COMPILER_ARENA_ALLOCATOR_H_ -#define ART_SRC_COMPILER_DEX_COMPILER_ARENA_ALLOCATOR_H_ +#ifndef ART_COMPILER_DEX_ARENA_ALLOCATOR_H_ +#define ART_COMPILER_DEX_ARENA_ALLOCATOR_H_ #include #include @@ -93,4 +93,4 @@ struct MemStats { } // namespace art -#endif // ART_SRC_COMPILER_DEX_COMPILER_ARENA_ALLOCATOR_H_ +#endif // ART_COMPILER_DEX_ARENA_ALLOCATOR_H_ diff --git a/compiler/dex/arena_bit_vector.h b/compiler/dex/arena_bit_vector.h index a950e82498..0b7bbc5f16 100644 --- a/compiler/dex/arena_bit_vector.h +++ b/compiler/dex/arena_bit_vector.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_COMPILER_ARENA_BIT_VECTOR_H_ -#define ART_SRC_COMPILER_DEX_COMPILER_ARENA_BIT_VECTOR_H_ +#ifndef ART_COMPILER_DEX_ARENA_BIT_VECTOR_H_ +#define ART_COMPILER_DEX_ARENA_BIT_VECTOR_H_ #include #include @@ -124,4 +124,4 @@ class ArenaBitVector { } // namespace art -#endif // ART_SRC_COMPILER_DEX_COMPILER_ARENA_BIT_VECTOR_H_ +#endif // ART_COMPILER_DEX_ARENA_BIT_VECTOR_H_ diff --git a/compiler/dex/backend.h b/compiler/dex/backend.h index 45a1531b85..6f5ba388e1 100644 --- a/compiler/dex/backend.h +++ b/compiler/dex/backend.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_BACKEND_H_ -#define ART_SRC_COMPILER_DEX_BACKEND_H_ +#ifndef ART_COMPILER_DEX_BACKEND_H_ +#define ART_COMPILER_DEX_BACKEND_H_ #include "compiled_method.h" #include "arena_allocator.h" @@ -37,4 +37,4 @@ class Backend { } // namespace art -#endif // ART_SRC_COMPILER_DEX_BACKEND_H_ +#endif // ART_COMPILER_DEX_BACKEND_H_ diff --git a/compiler/dex/compiler_enums.h b/compiler/dex/compiler_enums.h index bc456b2e70..88240e8c40 100644 --- a/compiler/dex/compiler_enums.h +++ b/compiler/dex/compiler_enums.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_COMPILERENUMS_H_ -#define ART_SRC_COMPILER_DEX_COMPILERENUMS_H_ +#ifndef ART_COMPILER_DEX_COMPILER_ENUMS_H_ +#define ART_COMPILER_DEX_COMPILER_ENUMS_H_ #include "dex_instruction.h" @@ -414,4 +414,4 @@ std::ostream& operator<<(std::ostream& os, const OatBitMapKind& kind); } // namespace art -#endif // ART_SRC_COMPILER_DEX_COMPILERENUMS_H_ +#endif // ART_COMPILER_DEX_COMPILER_ENUMS_H_ diff --git a/compiler/dex/compiler_internals.h b/compiler/dex/compiler_internals.h index a3fa25e842..9dd0272e50 100644 --- a/compiler/dex/compiler_internals.h +++ b/compiler/dex/compiler_internals.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_COMPILER_INTERNAL_H_ -#define ART_SRC_COMPILER_DEX_COMPILER_INTERNAL_H_ +#ifndef ART_COMPILER_DEX_COMPILER_INTERNALS_H_ +#define ART_COMPILER_DEX_COMPILER_INTERNALS_H_ #include #include @@ -33,4 +33,4 @@ #include "thread.h" #include "utils.h" -#endif // ART_SRC_COMPILER_DEX_COMPILER_INTERNAL_H_ +#endif // ART_COMPILER_DEX_COMPILER_INTERNALS_H_ diff --git a/compiler/dex/compiler_ir.h b/compiler/dex/compiler_ir.h index c6f99f3a88..a9b5bf68fc 100644 --- a/compiler/dex/compiler_ir.h +++ b/compiler/dex/compiler_ir.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_COMPILER_IR_H_ -#define ART_SRC_COMPILER_DEX_COMPILER_IR_H_ +#ifndef ART_COMPILER_DEX_COMPILER_IR_H_ +#define ART_COMPILER_DEX_COMPILER_IR_H_ #include #include @@ -112,4 +112,4 @@ struct CompilationUnit { } // namespace art -#endif // ART_SRC_COMPILER_DEX_COMPILER_IR_H_ +#endif // ART_COMPILER_DEX_COMPILER_IR_H_ diff --git a/compiler/dex/dataflow_iterator-inl.h b/compiler/dex/dataflow_iterator-inl.h index b20004decc..06cc505a9a 100644 --- a/compiler/dex/dataflow_iterator-inl.h +++ b/compiler/dex/dataflow_iterator-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_DATAFLOW_ITERATOR_INL_H_ -#define ART_SRC_COMPILER_DEX_DATAFLOW_ITERATOR_INL_H_ +#ifndef ART_COMPILER_DEX_DATAFLOW_ITERATOR_INL_H_ +#define ART_COMPILER_DEX_DATAFLOW_ITERATOR_INL_H_ #include "dataflow_iterator.h" @@ -65,4 +65,4 @@ inline BasicBlock* AllNodesIterator::NextBody(bool had_change) { } // namespace art -#endif // ART_SRC_COMPILER_DEX_DATAFLOW_ITERATOR_INL_H_ +#endif // ART_COMPILER_DEX_DATAFLOW_ITERATOR_INL_H_ diff --git a/compiler/dex/dataflow_iterator.h b/compiler/dex/dataflow_iterator.h index 12cbf9cadf..4c112f9678 100644 --- a/compiler/dex/dataflow_iterator.h +++ b/compiler/dex/dataflow_iterator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_DATAFLOW_ITERATOR_H_ -#define ART_SRC_COMPILER_DEX_DATAFLOW_ITERATOR_H_ +#ifndef ART_COMPILER_DEX_DATAFLOW_ITERATOR_H_ +#define ART_COMPILER_DEX_DATAFLOW_ITERATOR_H_ #include "compiler_ir.h" #include "mir_graph.h" @@ -155,4 +155,4 @@ namespace art { } // namespace art -#endif // ART_SRC_COMPILER_DEX_DATAFLOW_ITERATOR_H_ +#endif // ART_COMPILER_DEX_DATAFLOW_ITERATOR_H_ diff --git a/compiler/dex/frontend.h b/compiler/dex/frontend.h index 69d7f7728c..a86338950c 100644 --- a/compiler/dex/frontend.h +++ b/compiler/dex/frontend.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_COMPILER_H_ -#define ART_SRC_COMPILER_DEX_COMPILER_H_ +#ifndef ART_COMPILER_DEX_FRONTEND_H_ +#define ART_COMPILER_DEX_FRONTEND_H_ #include "dex_file.h" #include "dex_instruction.h" @@ -123,4 +123,4 @@ extern "C" art::CompiledMethod* ArtCompileMethod(art::CompilerDriver& driver, -#endif // ART_SRC_COMPILER_DEX_COMPILER_H_ +#endif // ART_COMPILER_DEX_FRONTEND_H_ diff --git a/compiler/dex/growable_array.h b/compiler/dex/growable_array.h index c4684a71f6..6ab0f1630a 100644 --- a/compiler/dex/growable_array.h +++ b/compiler/dex/growable_array.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_GROWABLE_LIST_H_ -#define ART_SRC_COMPILER_DEX_GROWABLE_LIST_H_ +#ifndef ART_COMPILER_DEX_GROWABLE_ARRAY_H_ +#define ART_COMPILER_DEX_GROWABLE_ARRAY_H_ #include #include @@ -168,4 +168,4 @@ class GrowableArray { } // namespace art -#endif // ART_SRC_COMPILER_DEX_GROWABLE_LIST_H_ +#endif // ART_COMPILER_DEX_GROWABLE_ARRAY_H_ diff --git a/compiler/dex/local_value_numbering.h b/compiler/dex/local_value_numbering.h index beb4cea733..f2b2291e56 100644 --- a/compiler/dex/local_value_numbering.h +++ b/compiler/dex/local_value_numbering.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_ -#define ART_SRC_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_ +#ifndef ART_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_ +#define ART_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_ #include "compiler_internals.h" @@ -140,4 +140,4 @@ class LocalValueNumbering { } // namespace art -#endif // ART_SRC_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_ +#endif // ART_COMPILER_DEX_LOCAL_VALUE_NUMBERING_H_ diff --git a/compiler/dex/mir_graph.h b/compiler/dex/mir_graph.h index 2b1c21fd70..a40fa97ad5 100644 --- a/compiler/dex/mir_graph.h +++ b/compiler/dex/mir_graph.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_MIRGRAPH_H_ -#define ART_SRC_COMPILER_DEX_MIRGRAPH_H_ +#ifndef ART_COMPILER_DEX_MIR_GRAPH_H_ +#define ART_COMPILER_DEX_MIR_GRAPH_H_ #include "dex_file.h" #include "dex_instruction.h" @@ -667,4 +667,4 @@ class MIRGraph { } // namespace art -#endif // ART_SRC_COMPILER_DEX_MIRGRAPH_H_ +#endif // ART_COMPILER_DEX_MIR_GRAPH_H_ diff --git a/compiler/dex/portable/mir_to_gbc.h b/compiler/dex/portable/mir_to_gbc.h index 8aa0271761..278631466f 100644 --- a/compiler/dex/portable/mir_to_gbc.h +++ b/compiler/dex/portable/mir_to_gbc.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_PORTABLE_MIRTOGBC_H_ -#define ART_SRC_COMPILER_DEX_PORTABLE_MIRTOGBC_H_ +#ifndef ART_COMPILER_DEX_PORTABLE_MIR_TO_GBC_H_ +#define ART_COMPILER_DEX_PORTABLE_MIR_TO_GBC_H_ #include "invoke_type.h" #include "compiled_method.h" @@ -192,4 +192,4 @@ class MirConverter : public Backend { } // namespace art -#endif // ART_SRC_COMPILER_DEX_PORTABLE_MIRTOGBC_H_ +#endif // ART_COMPILER_DEX_PORTABLE_MIR_TO_GBC_H_ diff --git a/compiler/dex/quick/arm/arm_lir.h b/compiler/dex/quick/arm/arm_lir.h index 9dd7dafcd6..fca17a1640 100644 --- a/compiler/dex/quick/arm/arm_lir.h +++ b/compiler/dex/quick/arm/arm_lir.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_QUICK_ARM_ARMLIR_H_ -#define ART_SRC_COMPILER_DEX_QUICK_ARM_ARMLIR_H_ +#ifndef ART_COMPILER_DEX_QUICK_ARM_ARM_LIR_H_ +#define ART_COMPILER_DEX_QUICK_ARM_ARM_LIR_H_ #include "dex/compiler_internals.h" @@ -496,4 +496,4 @@ struct ArmEncodingMap { } // namespace art -#endif // ART_SRC_COMPILER_DEX_QUICK_ARM_ARMLIR_H_ +#endif // ART_COMPILER_DEX_QUICK_ARM_ARM_LIR_H_ diff --git a/compiler/dex/quick/arm/codegen_arm.h b/compiler/dex/quick/arm/codegen_arm.h index a9199dfa7c..1599941ef6 100644 --- a/compiler/dex/quick/arm/codegen_arm.h +++ b/compiler/dex/quick/arm/codegen_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_QUICK_ARM_CODEGENARM_H_ -#define ART_SRC_COMPILER_DEX_QUICK_ARM_CODEGENARM_H_ +#ifndef ART_COMPILER_DEX_QUICK_ARM_CODEGEN_ARM_H_ +#define ART_COMPILER_DEX_QUICK_ARM_CODEGEN_ARM_H_ #include "dex/compiler_internals.h" @@ -192,4 +192,4 @@ class ArmMir2Lir : public Mir2Lir { } // namespace art -#endif // ART_SRC_COMPILER_DEX_QUICK_ARM_CODEGENARM_H_ +#endif // ART_COMPILER_DEX_QUICK_ARM_CODEGEN_ARM_H_ diff --git a/compiler/dex/quick/mips/codegen_mips.h b/compiler/dex/quick/mips/codegen_mips.h index 9723b899a9..376ad7f10e 100644 --- a/compiler/dex/quick/mips/codegen_mips.h +++ b/compiler/dex/quick/mips/codegen_mips.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_QUICK_CODEGEN_MIPS_CODEGENMIPS_H_ -#define ART_SRC_DEX_QUICK_CODEGEN_MIPS_CODEGENMIPS_H_ +#ifndef ART_COMPILER_DEX_QUICK_MIPS_CODEGEN_MIPS_H_ +#define ART_COMPILER_DEX_QUICK_MIPS_CODEGEN_MIPS_H_ #include "dex/compiler_internals.h" #include "mips_lir.h" @@ -180,4 +180,4 @@ class MipsMir2Lir : public Mir2Lir { } // namespace art -#endif // ART_SRC_DEX_QUICK_CODEGEN_MIPS_CODEGENMIPS_H_ +#endif // ART_COMPILER_DEX_QUICK_MIPS_CODEGEN_MIPS_H_ diff --git a/compiler/dex/quick/mips/mips_lir.h b/compiler/dex/quick/mips/mips_lir.h index ceab9ab1e5..8a99e93f09 100644 --- a/compiler/dex/quick/mips/mips_lir.h +++ b/compiler/dex/quick/mips/mips_lir.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_QUICK_MIPS_MIPSLIR_H_ -#define ART_SRC_COMPILER_DEX_QUICK_MIPS_MIPSLIR_H_ +#ifndef ART_COMPILER_DEX_QUICK_MIPS_MIPS_LIR_H_ +#define ART_COMPILER_DEX_QUICK_MIPS_MIPS_LIR_H_ #include "dex/compiler_internals.h" @@ -429,4 +429,4 @@ extern MipsEncodingMap EncodingMap[kMipsLast]; } // namespace art -#endif // ART_SRC_COMPILER_DEX_QUICK_MIPS_MIPSLIR_H_ +#endif // ART_COMPILER_DEX_QUICK_MIPS_MIPS_LIR_H_ diff --git a/compiler/dex/quick/mir_to_lir-inl.h b/compiler/dex/quick/mir_to_lir-inl.h index 4eef264a0f..d9aef5d968 100644 --- a/compiler/dex/quick/mir_to_lir-inl.h +++ b/compiler/dex/quick/mir_to_lir-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_QUICK_MIR_TO_LIR_INL_H_ -#define ART_SRC_COMPILER_DEX_QUICK_MIR_TO_LIR_INL_H_ +#ifndef ART_COMPILER_DEX_QUICK_MIR_TO_LIR_INL_H_ +#define ART_COMPILER_DEX_QUICK_MIR_TO_LIR_INL_H_ #include "mir_to_lir.h" @@ -198,4 +198,4 @@ inline void Mir2Lir::SetupResourceMasks(LIR* lir) { } // namespace art -#endif // ART_SRC_COMPILER_DEX_QUICK_MIR_TO_LIR_INL_H_ +#endif // ART_COMPILER_DEX_QUICK_MIR_TO_LIR_INL_H_ diff --git a/compiler/dex/quick/mir_to_lir.h b/compiler/dex/quick/mir_to_lir.h index 47514f769f..bec86c181e 100644 --- a/compiler/dex/quick/mir_to_lir.h +++ b/compiler/dex/quick/mir_to_lir.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_QUICK_MIR_TO_LIR_H_ -#define ART_SRC_COMPILER_DEX_QUICK_MIR_TO_LIR_H_ +#ifndef ART_COMPILER_DEX_QUICK_MIR_TO_LIR_H_ +#define ART_COMPILER_DEX_QUICK_MIR_TO_LIR_H_ #include "invoke_type.h" #include "compiled_method.h" @@ -776,4 +776,4 @@ class Mir2Lir : public Backend { } // namespace art -#endif //ART_SRC_COMPILER_DEX_QUICK_MIR_TO_LIR_H_ +#endif // ART_COMPILER_DEX_QUICK_MIR_TO_LIR_H_ diff --git a/compiler/dex/quick/x86/codegen_x86.h b/compiler/dex/quick/x86/codegen_x86.h index 3e30141594..4fa9dfb4d9 100644 --- a/compiler/dex/quick/x86/codegen_x86.h +++ b/compiler/dex/quick/x86/codegen_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_QUICK_X86_CODEGENX86_H_ -#define ART_SRC_COMPILER_DEX_QUICK_X86_CODEGENX86_H_ +#ifndef ART_COMPILER_DEX_QUICK_X86_CODEGEN_X86_H_ +#define ART_COMPILER_DEX_QUICK_X86_CODEGEN_X86_H_ #include "dex/compiler_internals.h" #include "x86_lir.h" @@ -202,4 +202,4 @@ class X86Mir2Lir : public Mir2Lir { } // namespace art -#endif // ART_SRC_COMPILER_DEX_QUICK_X86_CODEGENX86_H_ +#endif // ART_COMPILER_DEX_QUICK_X86_CODEGEN_X86_H_ diff --git a/compiler/dex/quick/x86/x86_lir.h b/compiler/dex/quick/x86/x86_lir.h index 600bd03026..a39231b75a 100644 --- a/compiler/dex/quick/x86/x86_lir.h +++ b/compiler/dex/quick/x86/x86_lir.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_QUICK_X86_X86LIR_H_ -#define ART_SRC_COMPILER_DEX_QUICK_X86_X86LIR_H_ +#ifndef ART_COMPILER_DEX_QUICK_X86_X86_LIR_H_ +#define ART_COMPILER_DEX_QUICK_X86_X86_LIR_H_ #include "dex/compiler_internals.h" @@ -439,4 +439,4 @@ extern X86ConditionCode X86ConditionEncoding(ConditionCode cond); } // namespace art -#endif // ART_SRC_COMPILER_DEX_QUICK_X86_X86LIR_H_ +#endif // ART_COMPILER_DEX_QUICK_X86_X86_LIR_H_ diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index 4d7f0cf7b6..80cc89b95f 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DRIVER_COMPILER_DRIVER_H_ -#define ART_SRC_COMPILER_DRIVER_COMPILER_DRIVER_H_ +#ifndef ART_COMPILER_DRIVER_COMPILER_DRIVER_H_ +#define ART_COMPILER_DRIVER_COMPILER_DRIVER_H_ #include #include @@ -410,4 +410,4 @@ class CompilerDriver { } // namespace art -#endif // ART_SRC_COMPILER_DRIVER_COMPILER_DRIVER_H_ +#endif // ART_COMPILER_DRIVER_COMPILER_DRIVER_H_ diff --git a/compiler/driver/dex_compilation_unit.h b/compiler/driver/dex_compilation_unit.h index 3c6129d642..53efd12ba7 100644 --- a/compiler/driver/dex_compilation_unit.h +++ b/compiler/driver/dex_compilation_unit.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_DEX_DEX_COMPILATION_UNIT_H_ -#define ART_SRC_COMPILER_DEX_DEX_COMPILATION_UNIT_H_ +#ifndef ART_COMPILER_DRIVER_DEX_COMPILATION_UNIT_H_ +#define ART_COMPILER_DRIVER_DEX_COMPILATION_UNIT_H_ #include @@ -113,4 +113,4 @@ class DexCompilationUnit { } // namespace art -#endif // ART_SRC_COMPILER_DEX_DEX_COMPILATION_UNIT_H_ +#endif // ART_COMPILER_DRIVER_DEX_COMPILATION_UNIT_H_ diff --git a/compiler/elf_fixup.h b/compiler/elf_fixup.h index 79c45c1874..1abf06b1c5 100644 --- a/compiler/elf_fixup.h +++ b/compiler/elf_fixup.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ELF_FIXUP_H_ -#define ART_SRC_ELF_FIXUP_H_ +#ifndef ART_COMPILER_ELF_FIXUP_H_ +#define ART_COMPILER_ELF_FIXUP_H_ #include @@ -53,4 +53,4 @@ class ElfFixup { } // namespace art -#endif // ART_SRC_ELF_FIXUP_H_ +#endif // ART_COMPILER_ELF_FIXUP_H_ diff --git a/compiler/elf_stripper.h b/compiler/elf_stripper.h index b202e6e1f0..6015b30cb2 100644 --- a/compiler/elf_stripper.h +++ b/compiler/elf_stripper.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ELF_STRIPPER_H_ -#define ART_SRC_ELF_STRIPPER_H_ +#ifndef ART_COMPILER_ELF_STRIPPER_H_ +#define ART_COMPILER_ELF_STRIPPER_H_ #include "base/macros.h" #include "os.h" @@ -34,4 +34,4 @@ class ElfStripper { } // namespace art -#endif // ART_SRC_ELF_STRIPPER_H_ +#endif // ART_COMPILER_ELF_STRIPPER_H_ diff --git a/compiler/elf_writer.h b/compiler/elf_writer.h index 7392e67d7f..ab436e4fb3 100644 --- a/compiler/elf_writer.h +++ b/compiler/elf_writer.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ELF_WRITER_H_ -#define ART_SRC_ELF_WRITER_H_ +#ifndef ART_COMPILER_ELF_WRITER_H_ +#define ART_COMPILER_ELF_WRITER_H_ #include @@ -62,4 +62,4 @@ class ElfWriter { } // namespace art -#endif // ART_SRC_ELF_WRITER_H_ +#endif // ART_COMPILER_ELF_WRITER_H_ diff --git a/compiler/elf_writer_mclinker.h b/compiler/elf_writer_mclinker.h index 21f23e113d..468fa9a84f 100644 --- a/compiler/elf_writer_mclinker.h +++ b/compiler/elf_writer_mclinker.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ELF_WRITER_MCLINKER_H_ -#define ART_SRC_ELF_WRITER_MCLINKER_H_ +#ifndef ART_COMPILER_ELF_WRITER_MCLINKER_H_ +#define ART_COMPILER_ELF_WRITER_MCLINKER_H_ #include "elf_writer.h" @@ -96,4 +96,4 @@ class ElfWriterMclinker : public ElfWriter { } // namespace art -#endif // ART_SRC_ELF_WRITER_MCLINKER_H_ +#endif // ART_COMPILER_ELF_WRITER_MCLINKER_H_ diff --git a/compiler/elf_writer_quick.h b/compiler/elf_writer_quick.h index a1a386b3d7..a15c239de9 100644 --- a/compiler/elf_writer_quick.h +++ b/compiler/elf_writer_quick.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ELF_WRITER_MCLINKER_H_ -#define ART_SRC_ELF_WRITER_MCLINKER_H_ +#ifndef ART_COMPILER_ELF_WRITER_QUICK_H_ +#define ART_COMPILER_ELF_WRITER_QUICK_H_ #include "elf_writer.h" @@ -48,4 +48,4 @@ class ElfWriterQuick : public ElfWriter { } // namespace art -#endif // ART_SRC_ELF_WRITER_MCLINKER_H_ +#endif // ART_COMPILER_ELF_WRITER_QUICK_H_ diff --git a/compiler/image_writer.h b/compiler/image_writer.h index 9b0d671604..e43ec6338f 100644 --- a/compiler/image_writer.h +++ b/compiler/image_writer.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_IMAGE_WRITER_H_ -#define ART_SRC_IMAGE_WRITER_H_ +#ifndef ART_COMPILER_IMAGE_WRITER_H_ +#define ART_COMPILER_IMAGE_WRITER_H_ #include @@ -207,4 +207,4 @@ class ImageWriter { } // namespace art -#endif // ART_SRC_IMAGE_WRITER_H_ +#endif // ART_COMPILER_IMAGE_WRITER_H_ diff --git a/compiler/jni/portable/jni_compiler.h b/compiler/jni/portable/jni_compiler.h index a04277c9e6..9bdf35ef10 100644 --- a/compiler/jni/portable/jni_compiler.h +++ b/compiler/jni/portable/jni_compiler.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_JNI_PORTABLE_JNI_COMPILER_H_ -#define ART_SRC_COMPILER_JNI_PORTABLE_JNI_COMPILER_H_ +#ifndef ART_COMPILER_JNI_PORTABLE_JNI_COMPILER_H_ +#define ART_COMPILER_JNI_PORTABLE_JNI_COMPILER_H_ #include @@ -84,4 +84,4 @@ class JniCompiler { } // namespace art -#endif // ART_SRC_COMPILER_JNI_PORTABLE_JNI_COMPILER_H_ +#endif // ART_COMPILER_JNI_PORTABLE_JNI_COMPILER_H_ diff --git a/compiler/jni/quick/arm/calling_convention_arm.h b/compiler/jni/quick/arm/calling_convention_arm.h index 3787d45c6f..f188700746 100644 --- a/compiler/jni/quick/arm/calling_convention_arm.h +++ b/compiler/jni/quick/arm/calling_convention_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_JNI_ARM_CALLING_CONVENTION_ARM_H_ -#define ART_SRC_OAT_JNI_ARM_CALLING_CONVENTION_ARM_H_ +#ifndef ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ +#define ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ #include "jni/quick/calling_convention.h" @@ -85,4 +85,4 @@ class ArmJniCallingConvention : public JniCallingConvention { } // namespace arm } // namespace art -#endif // ART_SRC_OAT_JNI_ARM_CALLING_CONVENTION_ARM_H_ +#endif // ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_ diff --git a/compiler/jni/quick/calling_convention.h b/compiler/jni/quick/calling_convention.h index 121d1f80ae..d492b42237 100644 --- a/compiler/jni/quick/calling_convention.h +++ b/compiler/jni/quick/calling_convention.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_JNI_CALLING_CONVENTION_H_ -#define ART_SRC_OAT_JNI_CALLING_CONVENTION_H_ +#ifndef ART_COMPILER_JNI_QUICK_CALLING_CONVENTION_H_ +#define ART_COMPILER_JNI_QUICK_CALLING_CONVENTION_H_ #include #include "oat/utils/managed_register.h" @@ -286,4 +286,4 @@ class JniCallingConvention : public CallingConvention { } // namespace art -#endif // ART_SRC_OAT_JNI_CALLING_CONVENTION_H_ +#endif // ART_COMPILER_JNI_QUICK_CALLING_CONVENTION_H_ diff --git a/compiler/jni/quick/mips/calling_convention_mips.h b/compiler/jni/quick/mips/calling_convention_mips.h index 90681362bc..8412898dd8 100644 --- a/compiler/jni/quick/mips/calling_convention_mips.h +++ b/compiler/jni/quick/mips/calling_convention_mips.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_JNI_MIPS_CALLING_CONVENTION_MIPS_H_ -#define ART_SRC_OAT_JNI_MIPS_CALLING_CONVENTION_MIPS_H_ +#ifndef ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_ +#define ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_ #include "jni/quick/calling_convention.h" @@ -83,4 +83,4 @@ class MipsJniCallingConvention : public JniCallingConvention { } // namespace mips } // namespace art -#endif // ART_SRC_OAT_JNI_MIPS_CALLING_CONVENTION_MIPS_H_ +#endif // ART_COMPILER_JNI_QUICK_MIPS_CALLING_CONVENTION_MIPS_H_ diff --git a/compiler/jni/quick/x86/calling_convention_x86.h b/compiler/jni/quick/x86/calling_convention_x86.h index ea8a26e7d5..082c1c8eb1 100644 --- a/compiler/jni/quick/x86/calling_convention_x86.h +++ b/compiler/jni/quick/x86/calling_convention_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_JNI_X86_CALLING_CONVENTION_X86_H_ -#define ART_SRC_OAT_JNI_X86_CALLING_CONVENTION_X86_H_ +#ifndef ART_COMPILER_JNI_QUICK_X86_CALLING_CONVENTION_X86_H_ +#define ART_COMPILER_JNI_QUICK_X86_CALLING_CONVENTION_X86_H_ #include "jni/quick/calling_convention.h" @@ -80,4 +80,4 @@ class X86JniCallingConvention : public JniCallingConvention { } // namespace x86 } // namespace art -#endif // ART_SRC_OAT_JNI_X86_CALLING_CONVENTION_X86_H_ +#endif // ART_COMPILER_JNI_QUICK_X86_CALLING_CONVENTION_X86_H_ diff --git a/compiler/llvm/backend_options.h b/compiler/llvm/backend_options.h index 924a34639c..2a08bda2f1 100644 --- a/compiler/llvm/backend_options.h +++ b/compiler/llvm/backend_options.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_BACKEND_OPTIONS_H_ -#define ART_SRC_COMPILER_LLVM_BACKEND_OPTIONS_H_ +#ifndef ART_COMPILER_LLVM_BACKEND_OPTIONS_H_ +#define ART_COMPILER_LLVM_BACKEND_OPTIONS_H_ #include @@ -47,4 +47,4 @@ inline void InitialBackendOptions() { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_BACKEND_OPTIONS_H_ +#endif // ART_COMPILER_LLVM_BACKEND_OPTIONS_H_ diff --git a/compiler/llvm/backend_types.h b/compiler/llvm/backend_types.h index c89504a859..095040e5eb 100644 --- a/compiler/llvm/backend_types.h +++ b/compiler/llvm/backend_types.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_BACKEND_TYPES_H_ -#define ART_SRC_COMPILER_LLVM_BACKEND_TYPES_H_ +#ifndef ART_COMPILER_LLVM_BACKEND_TYPES_H_ +#define ART_COMPILER_LLVM_BACKEND_TYPES_H_ #include "base/logging.h" @@ -101,4 +101,4 @@ inline JType GetJTypeFromShorty(char shorty_jty) { } // namespace art -#endif // ART_SRC_COMPILER_LLVM_BACKEND_TYPES_H_ +#endif // ART_COMPILER_LLVM_BACKEND_TYPES_H_ diff --git a/compiler/llvm/compiler_llvm.h b/compiler/llvm/compiler_llvm.h index b70ddc5e20..77841d8564 100644 --- a/compiler/llvm/compiler_llvm.h +++ b/compiler/llvm/compiler_llvm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_COMPILER_LLVM_H_ -#define ART_SRC_COMPILER_LLVM_COMPILER_LLVM_H_ +#ifndef ART_COMPILER_LLVM_COMPILER_LLVM_H_ +#define ART_COMPILER_LLVM_COMPILER_LLVM_H_ #include "base/macros.h" #include "dex_file.h" @@ -100,4 +100,4 @@ class CompilerLLVM { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_COMPILER_LLVM_H_ +#endif // ART_COMPILER_LLVM_COMPILER_LLVM_H_ diff --git a/compiler/llvm/intrinsic_helper.h b/compiler/llvm/intrinsic_helper.h index 49b8a95230..bb123fd575 100644 --- a/compiler/llvm/intrinsic_helper.h +++ b/compiler/llvm/intrinsic_helper.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GREENLAND_INTRINSIC_HELPER_H_ -#define ART_SRC_GREENLAND_INTRINSIC_HELPER_H_ +#ifndef ART_COMPILER_LLVM_INTRINSIC_HELPER_H_ +#define ART_COMPILER_LLVM_INTRINSIC_HELPER_H_ #include "base/logging.h" @@ -154,4 +154,4 @@ class IntrinsicHelper { } // namespace llvm } // namespace art -#endif // ART_SRC_GREENLAND_INTRINSIC_HELPER_H_ +#endif // ART_COMPILER_LLVM_INTRINSIC_HELPER_H_ diff --git a/compiler/llvm/ir_builder.h b/compiler/llvm/ir_builder.h index 734b22f791..65da005e9b 100644 --- a/compiler/llvm/ir_builder.h +++ b/compiler/llvm/ir_builder.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_IR_BUILDER_H_ -#define ART_SRC_COMPILER_LLVM_IR_BUILDER_H_ +#ifndef ART_COMPILER_LLVM_IR_BUILDER_H_ +#define ART_COMPILER_LLVM_IR_BUILDER_H_ #include "backend_types.h" #include "dex/compiler_enums.h" @@ -487,4 +487,4 @@ class IRBuilder : public LLVMIRBuilder { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_IR_BUILDER_H_ +#endif // ART_COMPILER_LLVM_IR_BUILDER_H_ diff --git a/compiler/llvm/llvm_compilation_unit.h b/compiler/llvm/llvm_compilation_unit.h index a4f0adbab8..9de132379b 100644 --- a/compiler/llvm/llvm_compilation_unit.h +++ b/compiler/llvm/llvm_compilation_unit.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_ -#define ART_SRC_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_ +#ifndef ART_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_ +#define ART_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_ #include "base/logging.h" #include "base/mutex.h" @@ -135,4 +135,4 @@ class LlvmCompilationUnit { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_ +#endif // ART_COMPILER_LLVM_LLVM_COMPILATION_UNIT_H_ diff --git a/compiler/llvm/md_builder.h b/compiler/llvm/md_builder.h index 79a7caa04c..cc169a3219 100644 --- a/compiler/llvm/md_builder.h +++ b/compiler/llvm/md_builder.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_MD_BUILDER_H_ -#define ART_SRC_COMPILER_LLVM_MD_BUILDER_H_ +#ifndef ART_COMPILER_LLVM_MD_BUILDER_H_ +#define ART_COMPILER_LLVM_MD_BUILDER_H_ #include "backend_types.h" @@ -68,4 +68,4 @@ class MDBuilder : public LLVMMDBuilder { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_MD_BUILDER_H_ +#endif // ART_COMPILER_LLVM_MD_BUILDER_H_ diff --git a/compiler/llvm/runtime_support_builder.h b/compiler/llvm/runtime_support_builder.h index 267b406232..c3c0856bd0 100644 --- a/compiler/llvm/runtime_support_builder.h +++ b/compiler/llvm/runtime_support_builder.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_H_ -#define ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_H_ +#ifndef ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_H_ +#define ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_H_ #include "backend_types.h" #include "base/logging.h" @@ -95,4 +95,4 @@ class RuntimeSupportBuilder { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_H_ +#endif // ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_H_ diff --git a/compiler/llvm/runtime_support_builder_arm.h b/compiler/llvm/runtime_support_builder_arm.h index 3c5972fc33..6aa23b2306 100644 --- a/compiler/llvm/runtime_support_builder_arm.h +++ b/compiler/llvm/runtime_support_builder_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_ARM_H_ -#define ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_ARM_H_ +#ifndef ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_ARM_H_ +#define ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_ARM_H_ #include "runtime_support_builder.h" @@ -43,4 +43,4 @@ class RuntimeSupportBuilderARM : public RuntimeSupportBuilder { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_ARM_H_ +#endif // ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_ARM_H_ diff --git a/compiler/llvm/runtime_support_builder_thumb2.h b/compiler/llvm/runtime_support_builder_thumb2.h index 4762a269f9..941bd6b2bb 100644 --- a/compiler/llvm/runtime_support_builder_thumb2.h +++ b/compiler/llvm/runtime_support_builder_thumb2.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_THUMB2_H_ -#define ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_THUMB2_H_ +#ifndef ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_THUMB2_H_ +#define ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_THUMB2_H_ #include "runtime_support_builder_arm.h" @@ -34,4 +34,4 @@ class RuntimeSupportBuilderThumb2 : public RuntimeSupportBuilderARM { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_THUMB2_H_ +#endif // ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_THUMB2_H_ diff --git a/compiler/llvm/runtime_support_builder_x86.h b/compiler/llvm/runtime_support_builder_x86.h index e5fdbc2e26..831d022ce5 100644 --- a/compiler/llvm/runtime_support_builder_x86.h +++ b/compiler/llvm/runtime_support_builder_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_X86_H_ -#define ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_X86_H_ +#ifndef ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_X86_H_ +#define ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_X86_H_ #include "runtime_support_builder.h" @@ -39,4 +39,4 @@ class RuntimeSupportBuilderX86 : public RuntimeSupportBuilder { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_X86_H_ +#endif // ART_COMPILER_LLVM_RUNTIME_SUPPORT_BUILDER_X86_H_ diff --git a/compiler/llvm/runtime_support_llvm_func.h b/compiler/llvm/runtime_support_llvm_func.h index ac6f3b869f..c0e76addc6 100644 --- a/compiler/llvm/runtime_support_llvm_func.h +++ b/compiler/llvm/runtime_support_llvm_func.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_FUNC_H_ -#define ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_FUNC_H_ +#ifndef ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_H_ +#define ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_H_ namespace art { namespace llvm { @@ -35,4 +35,4 @@ namespace runtime_support { } // namespace llvm } // namespace art -#endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_FUNC_H_ +#endif // ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_H_ diff --git a/compiler/llvm/utils_llvm.h b/compiler/llvm/utils_llvm.h index 2e273f4fe9..a606b91958 100644 --- a/compiler/llvm/utils_llvm.h +++ b/compiler/llvm/utils_llvm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_UTILS_LLVM_H_ -#define ART_SRC_UTILS_LLVM_H_ +#ifndef ART_COMPILER_LLVM_UTILS_LLVM_H_ +#define ART_COMPILER_LLVM_UTILS_LLVM_H_ #include @@ -29,4 +29,4 @@ namespace art { } // namespace art -#endif // ART_SRC_UTILS_LLVM_H_ +#endif // ART_COMPILER_LLVM_UTILS_LLVM_H_ diff --git a/compiler/oat_writer.h b/compiler/oat_writer.h index 1f97bf853c..ea7156ea49 100644 --- a/compiler/oat_writer.h +++ b/compiler/oat_writer.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_WRITER_H_ -#define ART_SRC_OAT_WRITER_H_ +#ifndef ART_COMPILER_OAT_WRITER_H_ +#define ART_COMPILER_OAT_WRITER_H_ #include @@ -224,4 +224,4 @@ class OatWriter { } // namespace art -#endif // ART_SRC_OAT_WRITER_H_ +#endif // ART_COMPILER_OAT_WRITER_H_ diff --git a/compiler/sea_ir/instruction_tools.h b/compiler/sea_ir/instruction_tools.h index f68cdd0784..b0bbc272c8 100644 --- a/compiler/sea_ir/instruction_tools.h +++ b/compiler/sea_ir/instruction_tools.h @@ -17,8 +17,8 @@ #include "dex_instruction.h" -#ifndef INSTRUCTION_TOOLS_H_ -#define INSTRUCTION_TOOLS_H_ +#ifndef ART_COMPILER_SEA_IR_INSTRUCTION_TOOLS_H_ +#define ART_COMPILER_SEA_IR_INSTRUCTION_TOOLS_H_ // Note: This file has content cannibalized for SEA_IR from the MIR implementation, // to avoid having a dependence on MIR. @@ -121,4 +121,4 @@ class InstructionTools { static const int instruction_attributes_[]; }; } // end namespace sea_ir -#endif // INSTRUCTION_TOOLS_H_ +#endif // ART_COMPILER_SEA_IR_INSTRUCTION_TOOLS_H_ diff --git a/compiler/sea_ir/sea.h b/compiler/sea_ir/sea.h index f2c71469e5..ce4624d438 100644 --- a/compiler/sea_ir/sea.h +++ b/compiler/sea_ir/sea.h @@ -15,8 +15,8 @@ */ -#ifndef SEA_IR_H_ -#define SEA_IR_H_ +#ifndef ART_COMPILER_SEA_IR_SEA_H_ +#define ART_COMPILER_SEA_IR_SEA_H_ #include #include @@ -159,4 +159,4 @@ class SeaGraph { } // end namespace sea_ir -#endif +#endif // ART_COMPILER_SEA_IR_SEA_H_ diff --git a/compiler/stubs/stubs.h b/compiler/stubs/stubs.h index ebe761df35..d85eae8e1e 100644 --- a/compiler/stubs/stubs.h +++ b/compiler/stubs/stubs.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_STUBS_STUBS_H_ -#define ART_SRC_COMPILER_STUBS_STUBS_H_ +#ifndef ART_COMPILER_STUBS_STUBS_H_ +#define ART_COMPILER_STUBS_STUBS_H_ #include "runtime.h" @@ -56,4 +56,4 @@ const std::vector* CreateInterpreterToQuickEntry() } // namespace art -#endif // ART_SRC_COMPILER_STUBS_STUBS_H_ +#endif // ART_COMPILER_STUBS_STUBS_H_ diff --git a/jdwpspy/Common.h b/jdwpspy/Common.h index 0bd305643a..33f1a670ea 100644 --- a/jdwpspy/Common.h +++ b/jdwpspy/Common.h @@ -3,8 +3,8 @@ * * jdwpspy common stuff. */ -#ifndef _JDWPSPY_COMMON -#define _JDWPSPY_COMMON +#ifndef ART_JDWPSPY_COMMON_H_ +#define ART_JDWPSPY_COMMON_H_ #include #include @@ -99,4 +99,4 @@ void printHexDump2(const void* vaddr, size_t length, const char* prefix); void printHexDumpEx(FILE* fp, const void* vaddr, size_t length, HexDumpMode mode, const char* prefix); -#endif /*_JDWPSPY_COMMON*/ +#endif // ART_JDWPSPY_COMMON_H_ diff --git a/runtime/asm_support.h b/runtime/asm_support.h index 8ea4adfcf2..7b20c7aee0 100644 --- a/runtime/asm_support.h +++ b/runtime/asm_support.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ASM_SUPPORT_H_ -#define ART_SRC_ASM_SUPPORT_H_ +#ifndef ART_RUNTIME_ASM_SUPPORT_H_ +#define ART_RUNTIME_ASM_SUPPORT_H_ // Value loaded into rSUSPEND for quick. When this value is counted down to zero we do a suspend // check. @@ -55,4 +55,4 @@ #define THREAD_EXCEPTION_OFFSET 12 #endif -#endif // ART_SRC_ASM_SUPPORT_H_ +#endif // ART_RUNTIME_ASM_SUPPORT_H_ diff --git a/runtime/atomic.h b/runtime/atomic.h index d340dc5474..cb6f86b921 100644 --- a/runtime/atomic.h +++ b/runtime/atomic.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ATOMIC_H_ -#define ART_SRC_ATOMIC_H_ +#ifndef ART_RUNTIME_ATOMIC_H_ +#define ART_RUNTIME_ATOMIC_H_ #include @@ -54,4 +54,4 @@ class QuasiAtomic { } // namespace art -#endif // ART_SRC_ATOMIC_H_ +#endif // ART_RUNTIME_ATOMIC_H_ diff --git a/runtime/atomic_integer.h b/runtime/atomic_integer.h index c4a8de9817..57836d6e26 100644 --- a/runtime/atomic_integer.h +++ b/runtime/atomic_integer.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ATOMIC_INTEGER_H_ -#define ART_SRC_ATOMIC_INTEGER_H_ +#ifndef ART_RUNTIME_ATOMIC_INTEGER_H_ +#define ART_RUNTIME_ATOMIC_INTEGER_H_ #include "cutils/atomic.h" #include "cutils/atomic-inline.h" @@ -76,4 +76,4 @@ class AtomicInteger { } -#endif // ART_SRC_ATOMIC_INTEGER_H_ +#endif // ART_RUNTIME_ATOMIC_INTEGER_H_ diff --git a/runtime/barrier.h b/runtime/barrier.h index 2b0429a7c2..e0ad239eab 100644 --- a/runtime/barrier.h +++ b/runtime/barrier.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BARRIER_H_ -#define ART_SRC_BARRIER_H_ +#ifndef ART_RUNTIME_BARRIER_H_ +#define ART_RUNTIME_BARRIER_H_ #include "base/mutex.h" #include "locks.h" @@ -52,4 +52,4 @@ class Barrier { }; } // namespace art -#endif // ART_SRC_GC_BARRIER_H_ +#endif // ART_RUNTIME_BARRIER_H_ diff --git a/runtime/base/casts.h b/runtime/base/casts.h index 34c05af4e3..be94c2eb78 100644 --- a/runtime/base/casts.h +++ b/runtime/base/casts.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BASE_CASTS_H_ -#define ART_SRC_BASE_CASTS_H_ +#ifndef ART_RUNTIME_BASE_CASTS_H_ +#define ART_RUNTIME_BASE_CASTS_H_ #include #include @@ -90,4 +90,4 @@ inline Dest bit_cast(const Source& source) { } // namespace art -#endif // ART_SRC_BASE_CASTS_H_ +#endif // ART_RUNTIME_BASE_CASTS_H_ diff --git a/runtime/base/histogram-inl.h b/runtime/base/histogram-inl.h index 9514209c11..bbca60308a 100644 --- a/runtime/base/histogram-inl.h +++ b/runtime/base/histogram-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef SRC_BASE_HISTOGRAM_INL_H_ -#define SRC_BASE_HISTOGRAM_INL_H_ +#ifndef ART_RUNTIME_BASE_HISTOGRAM_INL_H_ +#define ART_RUNTIME_BASE_HISTOGRAM_INL_H_ #include "histogram.h" @@ -251,5 +251,5 @@ inline double Histogram::Percentile(double per) const { } } // namespace art -#endif // SRC_BASE_HISTOGRAM_INL_H_ +#endif // ART_RUNTIME_BASE_HISTOGRAM_INL_H_ diff --git a/runtime/base/histogram.h b/runtime/base/histogram.h index 6878e71ccc..8724d2c582 100644 --- a/runtime/base/histogram.h +++ b/runtime/base/histogram.h @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef ART_SRC_BASE_HISTOGRAM_H_ -#define ART_SRC_BASE_HISTOGRAM_H_ +#ifndef ART_RUNTIME_BASE_HISTOGRAM_H_ +#define ART_RUNTIME_BASE_HISTOGRAM_H_ #include #include @@ -117,4 +117,4 @@ template class Histogram { }; } -#endif // ART_SRC_BASE_HISTOGRAM_H_ +#endif // ART_RUNTIME_BASE_HISTOGRAM_H_ diff --git a/runtime/base/logging.h b/runtime/base/logging.h index 8d89e4d0cb..f02a39a1f9 100644 --- a/runtime/base/logging.h +++ b/runtime/base/logging.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BASE_LOGGING_H_ -#define ART_SRC_BASE_LOGGING_H_ +#ifndef ART_RUNTIME_BASE_LOGGING_H_ +#define ART_RUNTIME_BASE_LOGGING_H_ #include #include @@ -334,4 +334,4 @@ extern const char* ProgramInvocationShortName(); } // namespace art -#endif // ART_SRC_BASE_LOGGING_H_ +#endif // ART_RUNTIME_BASE_LOGGING_H_ diff --git a/runtime/base/macros.h b/runtime/base/macros.h index 847105d20c..4a196f28e7 100644 --- a/runtime/base/macros.h +++ b/runtime/base/macros.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BASE_MACROS_H_ -#define ART_SRC_BASE_MACROS_H_ +#ifndef ART_RUNTIME_BASE_MACROS_H_ +#define ART_RUNTIME_BASE_MACROS_H_ #include // for size_t @@ -198,4 +198,4 @@ template void UNUSED(const T&) {} #endif // defined(__SUPPORT_TS_ANNOTATION__) -#endif // ART_SRC_BASE_MACROS_H_ +#endif // ART_RUNTIME_BASE_MACROS_H_ diff --git a/runtime/base/mutex-inl.h b/runtime/base/mutex-inl.h index f911054b86..07157da7aa 100644 --- a/runtime/base/mutex-inl.h +++ b/runtime/base/mutex-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BASE_MUTEX_INL_H_ -#define ART_SRC_BASE_MUTEX_INL_H_ +#ifndef ART_RUNTIME_BASE_MUTEX_INL_H_ +#define ART_RUNTIME_BASE_MUTEX_INL_H_ #include "mutex.h" @@ -184,4 +184,4 @@ inline void ReaderWriterMutex::SharedUnlock(Thread* self) { } // namespace art -#endif // ART_SRC_BASE_MUTEX_INL_H_ +#endif // ART_RUNTIME_BASE_MUTEX_INL_H_ diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h index b62755917c..dea52a6615 100644 --- a/runtime/base/mutex.h +++ b/runtime/base/mutex.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BASE_MUTEX_H_ -#define ART_SRC_BASE_MUTEX_H_ +#ifndef ART_RUNTIME_BASE_MUTEX_H_ +#define ART_RUNTIME_BASE_MUTEX_H_ #include #include @@ -398,4 +398,4 @@ class SCOPED_LOCKABLE WriterMutexLock { } // namespace art -#endif // ART_SRC_BASE_MUTEX_H_ +#endif // ART_RUNTIME_BASE_MUTEX_H_ diff --git a/runtime/base/stl_util.h b/runtime/base/stl_util.h index eb8be42df3..ff9f40cbf8 100644 --- a/runtime/base/stl_util.h +++ b/runtime/base/stl_util.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BASE_STL_UTIL_H_ -#define ART_SRC_BASE_STL_UTIL_H_ +#ifndef ART_RUNTIME_BASE_STL_UTIL_H_ +#define ART_RUNTIME_BASE_STL_UTIL_H_ #include #include @@ -94,4 +94,4 @@ std::string ToString(const T& v) { } // namespace art -#endif // ART_SRC_BASE_STL_UTIL_H_ +#endif // ART_RUNTIME_BASE_STL_UTIL_H_ diff --git a/runtime/base/stringpiece.h b/runtime/base/stringpiece.h index 3664218860..62088cc183 100644 --- a/runtime/base/stringpiece.h +++ b/runtime/base/stringpiece.h @@ -25,8 +25,8 @@ // Systematic usage of StringPiece is encouraged as it will reduce unnecessary // conversions from "const char*" to "string" and back again. -#ifndef ART_SRC_BASE_STRINGPIECE_H_ -#define ART_SRC_BASE_STRINGPIECE_H_ +#ifndef ART_RUNTIME_BASE_STRINGPIECE_H_ +#define ART_RUNTIME_BASE_STRINGPIECE_H_ #include #include @@ -223,4 +223,4 @@ struct StringPieceHash { } // namespace art -#endif // ART_SRC_BASE_STRINGPIECE_H_ +#endif // ART_RUNTIME_BASE_STRINGPIECE_H_ diff --git a/runtime/base/stringprintf.h b/runtime/base/stringprintf.h index d707cc02d6..4767a750c3 100644 --- a/runtime/base/stringprintf.h +++ b/runtime/base/stringprintf.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_BASE_STRINGPRINTF_H_ -#define ART_SRC_BASE_STRINGPRINTF_H_ +#ifndef ART_RUNTIME_BASE_STRINGPRINTF_H_ +#define ART_RUNTIME_BASE_STRINGPRINTF_H_ #include #include @@ -35,4 +35,4 @@ void StringAppendV(std::string* dst, const char* format, va_list ap); } // namespace art -#endif // ART_SRC_BASE_STRINGPRINTF_H_ +#endif // ART_RUNTIME_BASE_STRINGPRINTF_H_ diff --git a/runtime/base/timing_logger.h b/runtime/base/timing_logger.h index 65732b170d..816cbeadec 100644 --- a/runtime/base/timing_logger.h +++ b/runtime/base/timing_logger.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_TIMING_LOGGER_H_ -#define ART_SRC_TIMING_LOGGER_H_ +#ifndef ART_RUNTIME_BASE_TIMING_LOGGER_H_ +#define ART_RUNTIME_BASE_TIMING_LOGGER_H_ #include "base/histogram.h" #include "base/macros.h" @@ -139,4 +139,4 @@ class NewTimingLogger { } // namespace base } // namespace art -#endif // ART_SRC_TIMING_LOGGER_H_ +#endif // ART_RUNTIME_BASE_TIMING_LOGGER_H_ diff --git a/runtime/base/unix_file/fd_file.h b/runtime/base/unix_file/fd_file.h index 2b339613ba..79a0db9eda 100644 --- a/runtime/base/unix_file/fd_file.h +++ b/runtime/base/unix_file/fd_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BASE_UNIX_FILE_FD_FILE_H_ -#define BASE_UNIX_FILE_FD_FILE_H_ +#ifndef ART_RUNTIME_BASE_UNIX_FILE_FD_FILE_H_ +#define ART_RUNTIME_BASE_UNIX_FILE_FD_FILE_H_ #include #include @@ -72,4 +72,4 @@ class FdFile : public RandomAccessFile { } // namespace unix_file -#endif // BASE_UNIX_FILE_FD_FILE_H_ +#endif // ART_RUNTIME_BASE_UNIX_FILE_FD_FILE_H_ diff --git a/runtime/base/unix_file/mapped_file.h b/runtime/base/unix_file/mapped_file.h index 161100b0d5..28cc5514f7 100644 --- a/runtime/base/unix_file/mapped_file.h +++ b/runtime/base/unix_file/mapped_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BASE_UNIX_FILE_MAPPED_FILE_H_ -#define BASE_UNIX_FILE_MAPPED_FILE_H_ +#ifndef ART_RUNTIME_BASE_UNIX_FILE_MAPPED_FILE_H_ +#define ART_RUNTIME_BASE_UNIX_FILE_MAPPED_FILE_H_ #include #include @@ -94,4 +94,4 @@ class MappedFile : public FdFile { } // namespace unix_file -#endif // BASE_UNIX_FILE_MAPPED_FILE_H_ +#endif // ART_RUNTIME_BASE_UNIX_FILE_MAPPED_FILE_H_ diff --git a/runtime/base/unix_file/null_file.h b/runtime/base/unix_file/null_file.h index e716603687..33947311f0 100644 --- a/runtime/base/unix_file/null_file.h +++ b/runtime/base/unix_file/null_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BASE_UNIX_FILE_NULL_FILE_H_ -#define BASE_UNIX_FILE_NULL_FILE_H_ +#ifndef ART_RUNTIME_BASE_UNIX_FILE_NULL_FILE_H_ +#define ART_RUNTIME_BASE_UNIX_FILE_NULL_FILE_H_ #include "base/unix_file/random_access_file.h" #include "base/macros.h" @@ -47,4 +47,4 @@ class NullFile : public RandomAccessFile { } // namespace unix_file -#endif // BASE_UNIX_FILE_NULL_FILE_H_ +#endif // ART_RUNTIME_BASE_UNIX_FILE_NULL_FILE_H_ diff --git a/runtime/base/unix_file/random_access_file.h b/runtime/base/unix_file/random_access_file.h index 22da37f03e..31a6dbe1fc 100644 --- a/runtime/base/unix_file/random_access_file.h +++ b/runtime/base/unix_file/random_access_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BASE_UNIX_FILE_RANDOM_ACCESS_FILE_H_ -#define BASE_UNIX_FILE_RANDOM_ACCESS_FILE_H_ +#ifndef ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_H_ +#define ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_H_ #include @@ -65,4 +65,4 @@ class RandomAccessFile { } // namespace unix_file -#endif // BASE_UNIX_FILE_RANDOM_ACCESS_FILE_H_ +#endif // ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_H_ diff --git a/runtime/base/unix_file/random_access_file_test.h b/runtime/base/unix_file/random_access_file_test.h index 3baaeae8ac..9d8550d6f6 100644 --- a/runtime/base/unix_file/random_access_file_test.h +++ b/runtime/base/unix_file/random_access_file_test.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_ -#define BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_ +#ifndef ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_ +#define ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_ #include @@ -169,4 +169,4 @@ class RandomAccessFileTest : public testing::Test { } // namespace unix_file -#endif // BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_ +#endif // ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_TEST_H_ diff --git a/runtime/base/unix_file/random_access_file_utils.h b/runtime/base/unix_file/random_access_file_utils.h index 0535ead8c5..30c81c09aa 100644 --- a/runtime/base/unix_file/random_access_file_utils.h +++ b/runtime/base/unix_file/random_access_file_utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BASE_UNIX_FILE_RANDOM_ACCESS_FILE_UTILS_H_ -#define BASE_UNIX_FILE_RANDOM_ACCESS_FILE_UTILS_H_ +#ifndef ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_UTILS_H_ +#define ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_UTILS_H_ namespace unix_file { @@ -27,4 +27,4 @@ bool CopyFile(const RandomAccessFile& src, RandomAccessFile* dst); } // namespace unix_file -#endif // BASE_UNIX_FILE_RANDOM_ACCESS_FILE_UTILS_H_ +#endif // ART_RUNTIME_BASE_UNIX_FILE_RANDOM_ACCESS_FILE_UTILS_H_ diff --git a/runtime/base/unix_file/string_file.h b/runtime/base/unix_file/string_file.h index 8944373344..26904f89a6 100644 --- a/runtime/base/unix_file/string_file.h +++ b/runtime/base/unix_file/string_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef BASE_UNIX_FILE_STRING_FILE_H_ -#define BASE_UNIX_FILE_STRING_FILE_H_ +#ifndef ART_RUNTIME_BASE_UNIX_FILE_STRING_FILE_H_ +#define ART_RUNTIME_BASE_UNIX_FILE_STRING_FILE_H_ #include @@ -56,4 +56,4 @@ class StringFile : public RandomAccessFile { } // namespace unix_file -#endif // BASE_UNIX_FILE_STRING_FILE_H_ +#endif // ART_RUNTIME_BASE_UNIX_FILE_STRING_FILE_H_ diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index 6cf49912a2..4d01b66f0a 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CLASS_LINKER_INL_H_ -#define ART_SRC_CLASS_LINKER_INL_H_ +#ifndef ART_RUNTIME_CLASS_LINKER_INL_H_ +#define ART_RUNTIME_CLASS_LINKER_INL_H_ #include "class_linker.h" @@ -143,4 +143,4 @@ inline mirror::Class* ClassLinker::GetClassRoot(ClassRoot class_root) } // namespace art -#endif // ART_SRC_CLASS_LINKER_INL_H_ +#endif // ART_RUNTIME_CLASS_LINKER_INL_H_ diff --git a/runtime/class_linker.h b/runtime/class_linker.h index df1ecc6207..3993cb214b 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CLASS_LINKER_H_ -#define ART_SRC_CLASS_LINKER_H_ +#ifndef ART_RUNTIME_CLASS_LINKER_H_ +#define ART_RUNTIME_CLASS_LINKER_H_ #include #include @@ -627,4 +627,4 @@ class ClassLinker { } // namespace art -#endif // ART_SRC_CLASS_LINKER_H_ +#endif // ART_RUNTIME_CLASS_LINKER_H_ diff --git a/runtime/class_reference.h b/runtime/class_reference.h index c3be720ea5..77c296facd 100644 --- a/runtime/class_reference.h +++ b/runtime/class_reference.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CLASS_REFERENCE_H_ -#define ART_SRC_CLASS_REFERENCE_H_ +#ifndef ART_RUNTIME_CLASS_REFERENCE_H_ +#define ART_RUNTIME_CLASS_REFERENCE_H_ #include @@ -38,4 +38,4 @@ inline bool operator<(const ClassReference& lhs, const ClassReference& rhs) { } // namespace art -#endif // ART_SRC_CLASS_REFERENCE_H_ +#endif // ART_RUNTIME_CLASS_REFERENCE_H_ diff --git a/runtime/closure.h b/runtime/closure.h index 17f2b84d82..9bea28fa58 100644 --- a/runtime/closure.h +++ b/runtime/closure.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CLOSURE_H_ -#define ART_SRC_CLOSURE_H_ +#ifndef ART_RUNTIME_CLOSURE_H_ +#define ART_RUNTIME_CLOSURE_H_ namespace art { @@ -29,4 +29,4 @@ class Closure { } // namespace art -#endif // ART_SRC_CLOSURE_H_ +#endif // ART_RUNTIME_CLOSURE_H_ diff --git a/runtime/common_test.h b/runtime/common_test.h index f03b1f9cdb..73c47b5a8c 100644 --- a/runtime/common_test.h +++ b/runtime/common_test.h @@ -14,6 +14,9 @@ * limitations under the License. */ +#ifndef ART_RUNTIME_COMMON_TEST_H_ +#define ART_RUNTIME_COMMON_TEST_H_ + #include #include #include @@ -586,3 +589,5 @@ std::ostream& operator<<(std::ostream& os, const std::vector& rhs) { } } // namespace std + +#endif // ART_RUNTIME_COMMON_TEST_H_ diff --git a/runtime/common_throws.h b/runtime/common_throws.h index 4bf12c0d01..b7f2754df1 100644 --- a/runtime/common_throws.h +++ b/runtime/common_throws.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMMON_THROWS__H_ -#define ART_SRC_COMMON_THROWS_H_ +#ifndef ART_RUNTIME_COMMON_THROWS_H_ +#define ART_RUNTIME_COMMON_THROWS_H_ #include "base/mutex.h" #include "invoke_type.h" @@ -183,4 +183,4 @@ void ThrowVerifyError(const mirror::Class* referrer, const char* fmt, ...) } // namespace art -#endif // ART_SRC_COMMON_THROWS_H_ +#endif // ART_RUNTIME_COMMON_THROWS_H_ diff --git a/runtime/compiled_class.h b/runtime/compiled_class.h index f050ee6a7e..c53d500502 100644 --- a/runtime/compiled_class.h +++ b/runtime/compiled_class.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILED_CLASS_H_ -#define ART_SRC_COMPILED_CLASS_H_ +#ifndef ART_RUNTIME_COMPILED_CLASS_H_ +#define ART_RUNTIME_COMPILED_CLASS_H_ #include "mirror/class.h" @@ -34,4 +34,4 @@ class CompiledClass { } // namespace art -#endif // ART_SRC_COMPILED_CLASS_H_ +#endif // ART_RUNTIME_COMPILED_CLASS_H_ diff --git a/runtime/compiled_method.h b/runtime/compiled_method.h index fb0172cc19..800dde2208 100644 --- a/runtime/compiled_method.h +++ b/runtime/compiled_method.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILED_METHOD_H_ -#define ART_SRC_COMPILED_METHOD_H_ +#ifndef ART_RUNTIME_COMPILED_METHOD_H_ +#define ART_RUNTIME_COMPILED_METHOD_H_ #include #include @@ -177,4 +177,4 @@ class CompiledMethod : public CompiledCode { } // namespace art -#endif // ART_SRC_COMPILED_METHOD_H_ +#endif // ART_RUNTIME_COMPILED_METHOD_H_ diff --git a/runtime/constants_arm.h b/runtime/constants_arm.h index 601c57247e..bbb9242def 100644 --- a/runtime/constants_arm.h +++ b/runtime/constants_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CONSTANTS_ARM_H_ -#define ART_SRC_CONSTANTS_ARM_H_ +#ifndef ART_RUNTIME_CONSTANTS_ARM_H_ +#define ART_RUNTIME_CONSTANTS_ARM_H_ #include @@ -516,4 +516,4 @@ class Instr { } // namespace arm } // namespace art -#endif // ART_SRC_CONSTANTS_ARM_H_ +#endif // ART_RUNTIME_CONSTANTS_ARM_H_ diff --git a/runtime/constants_mips.h b/runtime/constants_mips.h index 87a13554fb..fb56493a14 100644 --- a/runtime/constants_mips.h +++ b/runtime/constants_mips.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CONSTANTS_MIPS_H_ -#define ART_SRC_CONSTANTS_MIPS_H_ +#ifndef ART_RUNTIME_CONSTANTS_MIPS_H_ +#define ART_RUNTIME_CONSTANTS_MIPS_H_ #include @@ -183,4 +183,4 @@ class Instr { } // namespace mips } // namespace art -#endif // ART_SRC_CONSTANTS_MIPS_H_ +#endif // ART_RUNTIME_CONSTANTS_MIPS_H_ diff --git a/runtime/constants_x86.h b/runtime/constants_x86.h index e48b281599..bb18b6b23b 100644 --- a/runtime/constants_x86.h +++ b/runtime/constants_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CONSTANTS_X86_H_ -#define ART_SRC_CONSTANTS_X86_H_ +#ifndef ART_RUNTIME_CONSTANTS_X86_H_ +#define ART_RUNTIME_CONSTANTS_X86_H_ #include @@ -137,4 +137,4 @@ class Instr { } // namespace x86 } // namespace art -#endif // ART_SRC_CONSTANTS_X86_H_ +#endif // ART_RUNTIME_CONSTANTS_X86_H_ diff --git a/runtime/debugger.h b/runtime/debugger.h index eb17695249..94f3cbed76 100644 --- a/runtime/debugger.h +++ b/runtime/debugger.h @@ -18,8 +18,8 @@ * Dalvik-specific side of debugger support. (The JDWP code is intended to * be relatively generic.) */ -#ifndef ART_DEBUGGER_H_ -#define ART_DEBUGGER_H_ +#ifndef ART_RUNTIME_DEBUGGER_H_ +#define ART_RUNTIME_DEBUGGER_H_ #include @@ -429,4 +429,4 @@ class Dbg { } // namespace art -#endif // ART_DEBUGGER_H_ +#endif // ART_RUNTIME_DEBUGGER_H_ diff --git a/runtime/dex_file-inl.h b/runtime/dex_file-inl.h index 5d8216eda5..dee80269d6 100644 --- a/runtime/dex_file-inl.h +++ b/runtime/dex_file-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_FILE_INL_H_ -#define ART_SRC_DEX_FILE_INL_H_ +#ifndef ART_RUNTIME_DEX_FILE_INL_H_ +#define ART_RUNTIME_DEX_FILE_INL_H_ #include "base/logging.h" #include "dex_file.h" @@ -44,4 +44,4 @@ inline const DexFile::TryItem* DexFile::GetTryItems(const CodeItem& code_item, u } // namespace art -#endif // ART_SRC_DEX_FILE_INL_H_ +#endif // ART_RUNTIME_DEX_FILE_INL_H_ diff --git a/runtime/dex_file.h b/runtime/dex_file.h index e09270e018..28e06cc5b9 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_FILE_H_ -#define ART_SRC_DEX_FILE_H_ +#ifndef ART_RUNTIME_DEX_FILE_H_ +#define ART_RUNTIME_DEX_FILE_H_ #include #include @@ -1220,4 +1220,4 @@ class CatchHandlerIterator { } // namespace art -#endif // ART_SRC_DEX_FILE_H_ +#endif // ART_RUNTIME_DEX_FILE_H_ diff --git a/runtime/dex_file_verifier.h b/runtime/dex_file_verifier.h index 5538d4aa75..3797dc77e5 100644 --- a/runtime/dex_file_verifier.h +++ b/runtime/dex_file_verifier.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_FILE_VERIFIER_H_ -#define ART_SRC_DEX_FILE_VERIFIER_H_ +#ifndef ART_RUNTIME_DEX_FILE_VERIFIER_H_ +#define ART_RUNTIME_DEX_FILE_VERIFIER_H_ #include "dex_file.h" #include "safe_map.h" @@ -94,4 +94,4 @@ class DexFileVerifier { } // namespace art -#endif // ART_SRC_DEX_FILE_VERIFIER_H_ +#endif // ART_RUNTIME_DEX_FILE_VERIFIER_H_ diff --git a/runtime/dex_instruction-inl.h b/runtime/dex_instruction-inl.h index b426e66a1c..2cb5235417 100644 --- a/runtime/dex_instruction-inl.h +++ b/runtime/dex_instruction-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_INSTRUCTION_INL_H_ -#define ART_SRC_DEX_INSTRUCTION_INL_H_ +#ifndef ART_RUNTIME_DEX_INSTRUCTION_INL_H_ +#define ART_RUNTIME_DEX_INSTRUCTION_INL_H_ #include "dex_instruction.h" @@ -319,4 +319,4 @@ inline void Instruction::GetArgs(uint32_t arg[5]) const { } // namespace art -#endif // ART_SRC_DEX_INSTRUCTION_INL_H_ +#endif // ART_RUNTIME_DEX_INSTRUCTION_INL_H_ diff --git a/runtime/dex_instruction.h b/runtime/dex_instruction.h index 0407c57935..d2ad989395 100644 --- a/runtime/dex_instruction.h +++ b/runtime/dex_instruction.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_INSTRUCTION_H_ -#define ART_SRC_DEX_INSTRUCTION_H_ +#ifndef ART_RUNTIME_DEX_INSTRUCTION_H_ +#define ART_RUNTIME_DEX_INSTRUCTION_H_ #include "base/logging.h" #include "base/macros.h" @@ -443,4 +443,4 @@ struct DecodedInstruction { } // namespace art -#endif // ART_SRC_DEX_INSTRUCTION_H_ +#endif // ART_RUNTIME_DEX_INSTRUCTION_H_ diff --git a/runtime/dex_instruction_list.h b/runtime/dex_instruction_list.h index 8257c783e7..31d51c9b41 100644 --- a/runtime/dex_instruction_list.h +++ b/runtime/dex_instruction_list.h @@ -14,6 +14,9 @@ * limitations under the License. */ +#ifndef ART_RUNTIME_DEX_INSTRUCTION_LIST_H_ +#define ART_RUNTIME_DEX_INSTRUCTION_LIST_H_ + #define DEX_INSTRUCTION_LIST(V) \ V(0x00, NOP, "nop", k10x, false, kNone, kContinue, kVerifyNone) \ V(0x01, MOVE, "move", k12x, true, kNone, kContinue, kVerifyRegA | kVerifyRegB) \ @@ -297,3 +300,6 @@ V(k35c) \ V(k3rc) \ V(k51l) + +#endif // ART_RUNTIME_DEX_INSTRUCTION_LIST_H_ +#undef ART_RUNTIME_DEX_INSTRUCTION_LIST_H_ // the guard in this file is just for cpplint diff --git a/runtime/dex_instruction_visitor.h b/runtime/dex_instruction_visitor.h index ff4620f8f0..795b95bf76 100644 --- a/runtime/dex_instruction_visitor.h +++ b/runtime/dex_instruction_visitor.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_INSTRUCTION_VISITOR_H_ -#define ART_SRC_DEX_INSTRUCTION_VISITOR_H_ +#ifndef ART_RUNTIME_DEX_INSTRUCTION_VISITOR_H_ +#define ART_RUNTIME_DEX_INSTRUCTION_VISITOR_H_ #include "base/macros.h" #include "dex_instruction.h" @@ -69,4 +69,4 @@ class DexInstructionVisitor { } // namespace art -#endif // ART_SRC_DEX_INSTRUCTION_VISITOR_H_ +#endif // ART_RUNTIME_DEX_INSTRUCTION_VISITOR_H_ diff --git a/runtime/dex_method_iterator.h b/runtime/dex_method_iterator.h index dc2e712681..cb71cb5b11 100644 --- a/runtime/dex_method_iterator.h +++ b/runtime/dex_method_iterator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DEX_METHOD_ITERATOR_H_ -#define ART_SRC_DEX_METHOD_ITERATOR_H_ +#ifndef ART_RUNTIME_DEX_METHOD_ITERATOR_H_ +#define ART_RUNTIME_DEX_METHOD_ITERATOR_H_ #include @@ -147,4 +147,4 @@ class DexMethodIterator { } // namespace art -#endif // ART_SRC_DEX_METHOD_ITERATOR_H_ +#endif // ART_RUNTIME_DEX_METHOD_ITERATOR_H_ diff --git a/runtime/disassembler.h b/runtime/disassembler.h index 1f50bfc9c0..805ff4d079 100644 --- a/runtime/disassembler.h +++ b/runtime/disassembler.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DISASSEMBLER_H_ -#define ART_SRC_DISASSEMBLER_H_ +#ifndef ART_RUNTIME_DISASSEMBLER_H_ +#define ART_RUNTIME_DISASSEMBLER_H_ #include @@ -45,4 +45,4 @@ class Disassembler { } // namespace art -#endif // ART_SRC_DISASSEMBLER_H_ +#endif // ART_RUNTIME_DISASSEMBLER_H_ diff --git a/runtime/disassembler_arm.h b/runtime/disassembler_arm.h index 103876f33b..cab9150108 100644 --- a/runtime/disassembler_arm.h +++ b/runtime/disassembler_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DISASSEMBLER_ARM_H_ -#define ART_SRC_DISASSEMBLER_ARM_H_ +#ifndef ART_RUNTIME_DISASSEMBLER_ARM_H_ +#define ART_RUNTIME_DISASSEMBLER_ARM_H_ #include @@ -48,4 +48,4 @@ class DisassemblerArm : public Disassembler { } // namespace arm } // namespace art -#endif // ART_SRC_DISASSEMBLER_ARM_H_ +#endif // ART_RUNTIME_DISASSEMBLER_ARM_H_ diff --git a/runtime/disassembler_mips.h b/runtime/disassembler_mips.h index ed45113db7..e248503963 100644 --- a/runtime/disassembler_mips.h +++ b/runtime/disassembler_mips.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DISASSEMBLER_MIPS_H_ -#define ART_SRC_DISASSEMBLER_MIPS_H_ +#ifndef ART_RUNTIME_DISASSEMBLER_MIPS_H_ +#define ART_RUNTIME_DISASSEMBLER_MIPS_H_ #include @@ -37,4 +37,4 @@ class DisassemblerMips : public Disassembler { } // namespace mips } // namespace art -#endif // ART_SRC_DISASSEMBLER_MIPS_H_ +#endif // ART_RUNTIME_DISASSEMBLER_MIPS_H_ diff --git a/runtime/disassembler_x86.h b/runtime/disassembler_x86.h index 13f8503720..ff4322c8b8 100644 --- a/runtime/disassembler_x86.h +++ b/runtime/disassembler_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_DISASSEMBLER_X86_H_ -#define ART_SRC_DISASSEMBLER_X86_H_ +#ifndef ART_RUNTIME_DISASSEMBLER_X86_H_ +#define ART_RUNTIME_DISASSEMBLER_X86_H_ #include "disassembler.h" @@ -35,4 +35,4 @@ class DisassemblerX86 : public Disassembler { } // namespace x86 } // namespace art -#endif // ART_SRC_DISASSEMBLER_X86_H_ +#endif // ART_RUNTIME_DISASSEMBLER_X86_H_ diff --git a/runtime/elf_file.h b/runtime/elf_file.h index cb95cb0df0..33b5fc3f9b 100644 --- a/runtime/elf_file.h +++ b/runtime/elf_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ELF_FILE_H_ -#define ART_SRC_ELF_FILE_H_ +#ifndef ART_RUNTIME_ELF_FILE_H_ +#define ART_RUNTIME_ELF_FILE_H_ #include #include @@ -172,4 +172,4 @@ class ElfFile { } // namespace art -#endif // ART_SRC_ELF_FILE_H_ +#endif // ART_RUNTIME_ELF_FILE_H_ diff --git a/runtime/file_output_stream.h b/runtime/file_output_stream.h index b5eb4f8194..10405eff1f 100644 --- a/runtime/file_output_stream.h +++ b/runtime/file_output_stream.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_FILE_OUTPUT_STREAM_H_ -#define ART_SRC_FILE_OUTPUT_STREAM_H_ +#ifndef ART_RUNTIME_FILE_OUTPUT_STREAM_H_ +#define ART_RUNTIME_FILE_OUTPUT_STREAM_H_ #include "output_stream.h" @@ -41,4 +41,4 @@ class FileOutputStream : public OutputStream { } // namespace art -#endif // ART_SRC_FILE_OUTPUT_STREAM_H_ +#endif // ART_RUNTIME_FILE_OUTPUT_STREAM_H_ diff --git a/runtime/gc/accounting/atomic_stack.h b/runtime/gc/accounting/atomic_stack.h index 4e1c253bdf..5310c18ec6 100644 --- a/runtime/gc/accounting/atomic_stack.h +++ b/runtime/gc/accounting/atomic_stack.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_ACCOUNTING_ATOMIC_STACK_H_ -#define ART_SRC_GC_ACCOUNTING_ATOMIC_STACK_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_ATOMIC_STACK_H_ +#define ART_RUNTIME_GC_ACCOUNTING_ATOMIC_STACK_H_ #include @@ -189,4 +189,4 @@ typedef AtomicStack ObjectStack; } // namespace gc } // namespace art -#endif // ART_SRC_GC_ACCOUNTING_ATOMIC_STACK_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_ATOMIC_STACK_H_ diff --git a/runtime/gc/accounting/card_table-inl.h b/runtime/gc/accounting/card_table-inl.h index 1e7529084a..f8f2773582 100644 --- a/runtime/gc/accounting/card_table-inl.h +++ b/runtime/gc/accounting/card_table-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_CARDTABLE_INL_H_ -#define ART_SRC_GC_CARDTABLE_INL_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_INL_H_ +#define ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_INL_H_ #include "base/logging.h" #include "card_table.h" @@ -210,4 +210,4 @@ inline void CardTable::CheckCardValid(byte* card) const { } // namespace gc } // namespace art -#endif // ART_SRC_GC_CARDTABLE_INL_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_INL_H_ diff --git a/runtime/gc/accounting/card_table.h b/runtime/gc/accounting/card_table.h index cf85d15448..1acaf5bdfc 100644 --- a/runtime/gc/accounting/card_table.h +++ b/runtime/gc/accounting/card_table.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_CARDTABLE_H_ -#define ART_SRC_GC_CARDTABLE_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_H_ +#define ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_H_ #include "globals.h" #include "locks.h" @@ -153,4 +153,4 @@ class CardTable { } // namespace gc } // namespace art -#endif // ART_SRC_GC_CARDTABLE_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_CARD_TABLE_H_ diff --git a/runtime/gc/accounting/heap_bitmap-inl.h b/runtime/gc/accounting/heap_bitmap-inl.h index 8e3123b974..76226041d1 100644 --- a/runtime/gc/accounting/heap_bitmap-inl.h +++ b/runtime/gc/accounting/heap_bitmap-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_ACCOUNTING_HEAP_BITMAP_INL_H_ -#define ART_SRC_GC_ACCOUNTING_HEAP_BITMAP_INL_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_INL_H_ +#define ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_INL_H_ #include "heap_bitmap.h" @@ -47,4 +47,4 @@ inline void HeapBitmap::Visit(const Visitor& visitor) { } // namespace gc } // namespace art -#endif // ART_SRC_GC_ACCOUNTING_HEAP_BITMAP_INL_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_INL_H_ diff --git a/runtime/gc/accounting/heap_bitmap.h b/runtime/gc/accounting/heap_bitmap.h index 5ff40c6426..a12809ea55 100644 --- a/runtime/gc/accounting/heap_bitmap.h +++ b/runtime/gc/accounting/heap_bitmap.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_ACCOUNTING_HEAP_BITMAP_H_ -#define ART_SRC_GC_ACCOUNTING_HEAP_BITMAP_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_H_ +#define ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_H_ #include "base/logging.h" #include "locks.h" @@ -126,4 +126,4 @@ class HeapBitmap { } // namespace gc } // namespace art -#endif // ART_SRC_GC_ACCOUNTING_HEAP_BITMAP_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_HEAP_BITMAP_H_ diff --git a/runtime/gc/accounting/mod_union_table-inl.h b/runtime/gc/accounting/mod_union_table-inl.h index 656af94853..32ac95f9f8 100644 --- a/runtime/gc/accounting/mod_union_table-inl.h +++ b/runtime/gc/accounting/mod_union_table-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_MOD_UNION_TABLE_INL_H_ -#define ART_SRC_GC_MOD_UNION_TABLE_INL_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_INL_H_ +#define ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_INL_H_ #include "mod_union_table.h" @@ -72,4 +72,4 @@ class ModUnionTableToAllocspace : public ModUnionTableReferenceCache { } // namespace gc } // namespace art -#endif // ART_SRC_GC_MOD_UNION_TABLE_INL_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_INL_H_ diff --git a/runtime/gc/accounting/mod_union_table.h b/runtime/gc/accounting/mod_union_table.h index 5d25e05658..543562563b 100644 --- a/runtime/gc/accounting/mod_union_table.h +++ b/runtime/gc/accounting/mod_union_table.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_ACCOUNTING_MOD_UNION_TABLE_H_ -#define ART_SRC_GC_ACCOUNTING_MOD_UNION_TABLE_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_H_ +#define ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_H_ #include "globals.h" #include "safe_map.h" @@ -150,4 +150,4 @@ class ModUnionTableCardCache : public ModUnionTable { } // namespace gc } // namespace art -#endif // ART_SRC_GC_ACCOUNTING_MOD_UNION_TABLE_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_MOD_UNION_TABLE_H_ diff --git a/runtime/gc/accounting/space_bitmap-inl.h b/runtime/gc/accounting/space_bitmap-inl.h index a4fd330c8f..d074a0f578 100644 --- a/runtime/gc/accounting/space_bitmap-inl.h +++ b/runtime/gc/accounting/space_bitmap-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_ACCOUNTING_SPACE_BITMAP_INL_H_ -#define ART_SRC_GC_ACCOUNTING_SPACE_BITMAP_INL_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_INL_H_ +#define ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_INL_H_ #include "base/logging.h" #include "cutils/atomic-inline.h" @@ -144,4 +144,4 @@ inline bool SpaceBitmap::Modify(const mirror::Object* obj, bool do_set) { } // namespace gc } // namespace art -#endif // ART_SRC_GC_ACCOUNTING_SPACE_BITMAP_INL_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_INL_H_ diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h index bb487d88d0..32ab440f31 100644 --- a/runtime/gc/accounting/space_bitmap.h +++ b/runtime/gc/accounting/space_bitmap.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_ACCOUNTING_SPACE_BITMAP_H_ -#define ART_SRC_GC_ACCOUNTING_SPACE_BITMAP_H_ +#ifndef ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_H_ +#define ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_H_ #include "locks.h" #include "globals.h" @@ -262,4 +262,4 @@ std::ostream& operator << (std::ostream& stream, const SpaceBitmap& bitmap); } // namespace gc } // namespace art -#endif // ART_SRC_GC_ACCOUNTING_SPACE_BITMAP_H_ +#endif // ART_RUNTIME_GC_ACCOUNTING_SPACE_BITMAP_H_ diff --git a/runtime/gc/allocator/dlmalloc.h b/runtime/gc/allocator/dlmalloc.h index 6b02a44ffe..07ebd1c0e3 100644 --- a/runtime/gc/allocator/dlmalloc.h +++ b/runtime/gc/allocator/dlmalloc.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_ALLOCATOR_DLMALLOC_H_ -#define ART_SRC_GC_ALLOCATOR_DLMALLOC_H_ +#ifndef ART_RUNTIME_GC_ALLOCATOR_DLMALLOC_H_ +#define ART_RUNTIME_GC_ALLOCATOR_DLMALLOC_H_ // Configure dlmalloc for mspaces. #define HAVE_MMAP 0 @@ -37,4 +37,4 @@ extern "C" int dlmalloc_trim(size_t); // pages back to the kernel. extern "C" void DlmallocMadviseCallback(void* start, void* end, size_t used_bytes, void* /*arg*/); -#endif // ART_SRC_GC_ALLOCATOR_DLMALLOC_H_ +#endif // ART_RUNTIME_GC_ALLOCATOR_DLMALLOC_H_ diff --git a/runtime/gc/collector/garbage_collector.h b/runtime/gc/collector/garbage_collector.h index 1ab395775b..a22faac43b 100644 --- a/runtime/gc/collector/garbage_collector.h +++ b/runtime/gc/collector/garbage_collector.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_GARBAGE_COLLECTOR_H_ -#define ART_SRC_GC_GARBAGE_COLLECTOR_H_ +#ifndef ART_RUNTIME_GC_COLLECTOR_GARBAGE_COLLECTOR_H_ +#define ART_RUNTIME_GC_COLLECTOR_GARBAGE_COLLECTOR_H_ #include "gc_type.h" #include "locks.h" @@ -119,4 +119,4 @@ class GarbageCollector { } // namespace gc } // namespace art -#endif // ART_SRC_GC_GARBAGE_COLLECTOR_H_ +#endif // ART_RUNTIME_GC_COLLECTOR_GARBAGE_COLLECTOR_H_ diff --git a/runtime/gc/collector/gc_type.h b/runtime/gc/collector/gc_type.h index bb25bb93f9..f18e40fa74 100644 --- a/runtime/gc/collector/gc_type.h +++ b/runtime/gc/collector/gc_type.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_COLLECTOR_GC_TYPE_H_ -#define ART_SRC_GC_COLLECTOR_GC_TYPE_H_ +#ifndef ART_RUNTIME_GC_COLLECTOR_GC_TYPE_H_ +#define ART_RUNTIME_GC_COLLECTOR_GC_TYPE_H_ #include @@ -43,4 +43,4 @@ std::ostream& operator<<(std::ostream& os, const GcType& policy); } // namespace gc } // namespace art -#endif // ART_SRC_GC_COLLECTOR_GC_TYPE_H_ +#endif // ART_RUNTIME_GC_COLLECTOR_GC_TYPE_H_ diff --git a/runtime/gc/collector/mark_sweep-inl.h b/runtime/gc/collector/mark_sweep-inl.h index ea9fced84a..6b1b617eb4 100644 --- a/runtime/gc/collector/mark_sweep-inl.h +++ b/runtime/gc/collector/mark_sweep-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_MARK_SWEEP_INL_H_ -#define ART_SRC_GC_MARK_SWEEP_INL_H_ +#ifndef ART_RUNTIME_GC_COLLECTOR_MARK_SWEEP_INL_H_ +#define ART_RUNTIME_GC_COLLECTOR_MARK_SWEEP_INL_H_ #include "gc/collector/mark_sweep.h" @@ -162,4 +162,4 @@ inline void MarkSweep::VisitObjectArrayReferences(const mirror::ObjectArray #include @@ -609,4 +609,4 @@ class Heap { } // namespace gc } // namespace art -#endif // ART_SRC_GC_HEAP_H_ +#endif // ART_RUNTIME_GC_HEAP_H_ diff --git a/runtime/gc/space/dlmalloc_space.h b/runtime/gc/space/dlmalloc_space.h index 00df0e6d42..8a4314c716 100644 --- a/runtime/gc/space/dlmalloc_space.h +++ b/runtime/gc/space/dlmalloc_space.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_SPACE_DLMALLOC_SPACE_H_ -#define ART_SRC_GC_SPACE_DLMALLOC_SPACE_H_ +#ifndef ART_RUNTIME_GC_SPACE_DLMALLOC_SPACE_H_ +#define ART_RUNTIME_GC_SPACE_DLMALLOC_SPACE_H_ #include "gc/allocator/dlmalloc.h" #include "space.h" @@ -182,4 +182,4 @@ class DlMallocSpace : public MemMapSpace, public AllocSpace { } // namespace gc } // namespace art -#endif // ART_SRC_GC_SPACE_DLMALLOC_SPACE_H_ +#endif // ART_RUNTIME_GC_SPACE_DLMALLOC_SPACE_H_ diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h index 833fb8d73a..fde2b419ac 100644 --- a/runtime/gc/space/image_space.h +++ b/runtime/gc/space/image_space.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_SPACE_IMAGE_SPACE_H_ -#define ART_SRC_GC_SPACE_IMAGE_SPACE_H_ +#ifndef ART_RUNTIME_GC_SPACE_IMAGE_SPACE_H_ +#define ART_RUNTIME_GC_SPACE_IMAGE_SPACE_H_ #include "space.h" @@ -115,4 +115,4 @@ class ImageSpace : public MemMapSpace { } // namespace gc } // namespace art -#endif // ART_SRC_GC_SPACE_IMAGE_SPACE_H_ +#endif // ART_RUNTIME_GC_SPACE_IMAGE_SPACE_H_ diff --git a/runtime/gc/space/large_object_space.h b/runtime/gc/space/large_object_space.h index 197fad3854..74d9cca6db 100644 --- a/runtime/gc/space/large_object_space.h +++ b/runtime/gc/space/large_object_space.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_SPACE_LARGE_OBJECT_SPACE_H_ -#define ART_SRC_GC_SPACE_LARGE_OBJECT_SPACE_H_ +#ifndef ART_RUNTIME_GC_SPACE_LARGE_OBJECT_SPACE_H_ +#define ART_RUNTIME_GC_SPACE_LARGE_OBJECT_SPACE_H_ #include "dlmalloc_space.h" @@ -190,4 +190,4 @@ class FreeListSpace : public LargeObjectSpace { } // namespace gc } // namespace art -#endif // ART_SRC_GC_SPACE_LARGE_OBJECT_SPACE_H_ +#endif // ART_RUNTIME_GC_SPACE_LARGE_OBJECT_SPACE_H_ diff --git a/runtime/gc/space/space-inl.h b/runtime/gc/space/space-inl.h index 54bf604822..2c3b93c60d 100644 --- a/runtime/gc/space/space-inl.h +++ b/runtime/gc/space/space-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_SPACE_SPACE_INL_H_ -#define ART_SRC_GC_SPACE_SPACE_INL_H_ +#ifndef ART_RUNTIME_GC_SPACE_SPACE_INL_H_ +#define ART_RUNTIME_GC_SPACE_SPACE_INL_H_ #include "space.h" @@ -45,4 +45,4 @@ inline LargeObjectSpace* Space::AsLargeObjectSpace() { } // namespace gc } // namespace art -#endif // ART_SRC_GC_SPACE_SPACE_INL_H_ +#endif // ART_RUNTIME_GC_SPACE_SPACE_INL_H_ diff --git a/runtime/gc/space/space.h b/runtime/gc/space/space.h index ca01c55497..48f0579d83 100644 --- a/runtime/gc/space/space.h +++ b/runtime/gc/space/space.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_SPACE_SPACE_H_ -#define ART_SRC_GC_SPACE_SPACE_H_ +#ifndef ART_RUNTIME_GC_SPACE_SPACE_H_ +#define ART_RUNTIME_GC_SPACE_SPACE_H_ #include @@ -292,4 +292,4 @@ class MemMapSpace : public ContinuousSpace { } // namespace gc } // namespace art -#endif // ART_SRC_GC_SPACE_SPACE_H_ +#endif // ART_RUNTIME_GC_SPACE_SPACE_H_ diff --git a/runtime/gc_map.h b/runtime/gc_map.h index 473b39a629..33d09f29f6 100644 --- a/runtime/gc_map.h +++ b/runtime/gc_map.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GC_MAP_H_ -#define ART_SRC_GC_MAP_H_ +#ifndef ART_RUNTIME_GC_MAP_H_ +#define ART_RUNTIME_GC_MAP_H_ #include @@ -108,4 +108,4 @@ class NativePcOffsetToReferenceMap { } // namespace art -#endif // ART_SRC_GC_MAP_H_ +#endif // ART_RUNTIME_GC_MAP_H_ diff --git a/runtime/globals.h b/runtime/globals.h index dc9341ae0f..c3974943cd 100644 --- a/runtime/globals.h +++ b/runtime/globals.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_GLOBALS_H_ -#define ART_SRC_GLOBALS_H_ +#ifndef ART_RUNTIME_GLOBALS_H_ +#define ART_RUNTIME_GLOBALS_H_ #include #include @@ -75,4 +75,4 @@ const bool kIsTargetBuild = false; } // namespace art -#endif // ART_SRC_GLOBALS_H_ +#endif // ART_RUNTIME_GLOBALS_H_ diff --git a/runtime/hprof/hprof.h b/runtime/hprof/hprof.h index c6222dcb90..91684648a5 100644 --- a/runtime/hprof/hprof.h +++ b/runtime/hprof/hprof.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef HPROF_HPROF_H_ -#define HPROF_HPROF_H_ +#ifndef ART_RUNTIME_HPROF_HPROF_H_ +#define ART_RUNTIME_HPROF_HPROF_H_ namespace art { @@ -27,4 +27,4 @@ void DumpHeap(const char* filename, int fd, bool direct_to_ddms); } // namespace art -#endif // HPROF_HPROF_H_ +#endif // ART_RUNTIME_HPROF_HPROF_H_ diff --git a/runtime/image.h b/runtime/image.h index f14d7d190a..35e4c5cabd 100644 --- a/runtime/image.h +++ b/runtime/image.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_IMAGE_H_ -#define ART_SRC_IMAGE_H_ +#ifndef ART_RUNTIME_IMAGE_H_ +#define ART_RUNTIME_IMAGE_H_ #include @@ -131,4 +131,4 @@ class PACKED(4) ImageHeader { } // namespace art -#endif // ART_SRC_IMAGE_H_ +#endif // ART_RUNTIME_IMAGE_H_ diff --git a/runtime/indenter.h b/runtime/indenter.h index 4ac0c01163..c432e1ba8d 100644 --- a/runtime/indenter.h +++ b/runtime/indenter.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INDENTER_H_ -#define ART_SRC_INDENTER_H_ +#ifndef ART_RUNTIME_INDENTER_H_ +#define ART_RUNTIME_INDENTER_H_ #include "base/macros.h" #include @@ -60,4 +60,4 @@ class Indenter : public std::streambuf { DISALLOW_COPY_AND_ASSIGN(Indenter); }; -#endif // ART_SRC_INDENTER_H_ +#endif // ART_RUNTIME_INDENTER_H_ diff --git a/runtime/indirect_reference_table.h b/runtime/indirect_reference_table.h index e09043dba7..34b0f3abe2 100644 --- a/runtime/indirect_reference_table.h +++ b/runtime/indirect_reference_table.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INDIRECT_REFERENCE_TABLE_H_ -#define ART_SRC_INDIRECT_REFERENCE_TABLE_H_ +#ifndef ART_RUNTIME_INDIRECT_REFERENCE_TABLE_H_ +#define ART_RUNTIME_INDIRECT_REFERENCE_TABLE_H_ #include @@ -378,4 +378,4 @@ class IndirectReferenceTable { } // namespace art -#endif // ART_SRC_INDIRECT_REFERENCE_TABLE_H_ +#endif // ART_RUNTIME_INDIRECT_REFERENCE_TABLE_H_ diff --git a/runtime/instruction_set.h b/runtime/instruction_set.h index c4dae4dcb6..2217f7f76e 100644 --- a/runtime/instruction_set.h +++ b/runtime/instruction_set.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INSTRUCTION_SET_H_ -#define ART_SRC_INSTRUCTION_SET_H_ +#ifndef ART_RUNTIME_INSTRUCTION_SET_H_ +#define ART_RUNTIME_INSTRUCTION_SET_H_ #include @@ -33,4 +33,4 @@ std::ostream& operator<<(std::ostream& os, const InstructionSet& rhs); } // namespace art -#endif // ART_SRC_INSTRUCTION_SET_H_ +#endif // ART_RUNTIME_INSTRUCTION_SET_H_ diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h index 5fea34f388..e0f1fa978b 100644 --- a/runtime/instrumentation.h +++ b/runtime/instrumentation.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INSTRUMENTATION_H_ -#define ART_SRC_INSTRUMENTATION_H_ +#ifndef ART_RUNTIME_INSTRUMENTATION_H_ +#define ART_RUNTIME_INSTRUMENTATION_H_ #include "base/macros.h" #include "locks.h" @@ -290,4 +290,4 @@ struct InstrumentationStackFrame { } // namespace instrumentation } // namespace art -#endif // ART_SRC_INSTRUMENTATION_H_ +#endif // ART_RUNTIME_INSTRUMENTATION_H_ diff --git a/runtime/intern_table.h b/runtime/intern_table.h index 1ff4f6d3c6..5031ce3c5a 100644 --- a/runtime/intern_table.h +++ b/runtime/intern_table.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INTERN_TABLE_H_ -#define ART_SRC_INTERN_TABLE_H_ +#ifndef ART_RUNTIME_INTERN_TABLE_H_ +#define ART_RUNTIME_INTERN_TABLE_H_ #include "base/mutex.h" #include "root_visitor.h" @@ -95,4 +95,4 @@ class InternTable { } // namespace art -#endif // ART_SRC_CLASS_LINKER_H_ +#endif // ART_RUNTIME_INTERN_TABLE_H_ diff --git a/runtime/interpreter/interpreter.h b/runtime/interpreter/interpreter.h index 20166ac545..17884b9a63 100644 --- a/runtime/interpreter/interpreter.h +++ b/runtime/interpreter/interpreter.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INTERPRETER_INTERPRETER_H_ -#define ART_SRC_INTERPRETER_INTERPRETER_H_ +#ifndef ART_RUNTIME_INTERPRETER_INTERPRETER_H_ +#define ART_RUNTIME_INTERPRETER_INTERPRETER_H_ #include "dex_file.h" #include "locks.h" @@ -55,4 +55,4 @@ extern "C" void artInterpreterToInterpreterEntry(Thread* self, MethodHelper& mh, } // namespace interpreter } // namespace art -#endif // ART_SRC_INTERPRETER_INTERPRETER_H_ +#endif // ART_RUNTIME_INTERPRETER_INTERPRETER_H_ diff --git a/runtime/invoke_arg_array_builder.h b/runtime/invoke_arg_array_builder.h index b57d60a70f..c1d8249fd3 100644 --- a/runtime/invoke_arg_array_builder.h +++ b/runtime/invoke_arg_array_builder.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INVOKE_ARG_ARRAY_BUILDER_H_ -#define ART_SRC_INVOKE_ARG_ARRAY_BUILDER_H_ +#ifndef ART_RUNTIME_INVOKE_ARG_ARRAY_BUILDER_H_ +#define ART_RUNTIME_INVOKE_ARG_ARRAY_BUILDER_H_ #include "mirror/object.h" #include "scoped_thread_state_change.h" @@ -180,4 +180,4 @@ class ArgArray { } // namespace art -#endif // ART_SRC_INVOKE_ARG_ARRAY_BUILDER_H_ +#endif // ART_RUNTIME_INVOKE_ARG_ARRAY_BUILDER_H_ diff --git a/runtime/invoke_type.h b/runtime/invoke_type.h index d724fdb9c1..cdf9be87d9 100644 --- a/runtime/invoke_type.h +++ b/runtime/invoke_type.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_INVOKE_TYPE_H_ -#define ART_SRC_INVOKE_TYPE_H_ +#ifndef ART_RUNTIME_INVOKE_TYPE_H_ +#define ART_RUNTIME_INVOKE_TYPE_H_ #include @@ -34,4 +34,4 @@ std::ostream& operator<<(std::ostream& os, const InvokeType& rhs); } // namespace art -#endif // ART_SRC_INVOKE_TYPE_H_ +#endif // ART_RUNTIME_INVOKE_TYPE_H_ diff --git a/runtime/jdwp/jdwp.h b/runtime/jdwp/jdwp.h index 436525c3d0..6a5d0d19fb 100644 --- a/runtime/jdwp/jdwp.h +++ b/runtime/jdwp/jdwp.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_JDWP_JDWP_H_ -#define ART_JDWP_JDWP_H_ +#ifndef ART_RUNTIME_JDWP_JDWP_H_ +#define ART_RUNTIME_JDWP_JDWP_H_ #include "base/mutex.h" #include "jdwp/jdwp_bits.h" @@ -429,4 +429,4 @@ class Request { } // namespace art -#endif // ART_JDWP_JDWP_H_ +#endif // ART_RUNTIME_JDWP_JDWP_H_ diff --git a/runtime/jdwp/jdwp_bits.h b/runtime/jdwp/jdwp_bits.h index 2a3c775164..9f80cbe307 100644 --- a/runtime/jdwp/jdwp_bits.h +++ b/runtime/jdwp/jdwp_bits.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_JDWP_BITS_H_ -#define ART_JDWP_BITS_H_ +#ifndef ART_RUNTIME_JDWP_JDWP_BITS_H_ +#define ART_RUNTIME_JDWP_JDWP_BITS_H_ #include #include @@ -121,4 +121,4 @@ static inline void Write8BE(uint8_t** dst, uint64_t value) { } // namespace art -#endif // ART_JDWP_BITS_H_ +#endif // ART_RUNTIME_JDWP_JDWP_BITS_H_ diff --git a/runtime/jdwp/jdwp_constants.h b/runtime/jdwp/jdwp_constants.h index ebc575b6b6..a8db325c66 100644 --- a/runtime/jdwp/jdwp_constants.h +++ b/runtime/jdwp/jdwp_constants.h @@ -16,8 +16,8 @@ /* * These come out of the JDWP documentation. */ -#ifndef ART_JDWP_JDWPCONSTANTS_H_ -#define ART_JDWP_JDWPCONSTANTS_H_ +#ifndef ART_RUNTIME_JDWP_JDWP_CONSTANTS_H_ +#define ART_RUNTIME_JDWP_JDWP_CONSTANTS_H_ #include @@ -246,4 +246,4 @@ std::ostream& operator<<(std::ostream& os, const JdwpTag& value); } // namespace art -#endif // ART_JDWP_JDWPCONSTANTS_H_ +#endif // ART_RUNTIME_JDWP_JDWP_CONSTANTS_H_ diff --git a/runtime/jdwp/jdwp_event.h b/runtime/jdwp/jdwp_event.h index a6eabb1371..d269761999 100644 --- a/runtime/jdwp/jdwp_event.h +++ b/runtime/jdwp/jdwp_event.h @@ -16,8 +16,8 @@ /* * Handle registration of events, and debugger event notification. */ -#ifndef ART_JDWP_JDWPEVENT_H_ -#define ART_JDWP_JDWPEVENT_H_ +#ifndef ART_RUNTIME_JDWP_JDWP_EVENT_H_ +#define ART_RUNTIME_JDWP_JDWP_EVENT_H_ #include "jdwp/jdwp.h" #include "jdwp/jdwp_constants.h" @@ -110,4 +110,4 @@ void EventFree(JdwpEvent* pEvent); } // namespace art -#endif // ART_JDWP_JDWPEVENT_H_ +#endif // ART_RUNTIME_JDWP_JDWP_EVENT_H_ diff --git a/runtime/jdwp/jdwp_expand_buf.h b/runtime/jdwp/jdwp_expand_buf.h index 820f62d6a0..81e01e2100 100644 --- a/runtime/jdwp/jdwp_expand_buf.h +++ b/runtime/jdwp/jdwp_expand_buf.h @@ -16,8 +16,8 @@ /* * Expanding byte buffer, with primitives for appending basic data types. */ -#ifndef ART_JDWP_EXPANDBUF_H_ -#define ART_JDWP_EXPANDBUF_H_ +#ifndef ART_RUNTIME_JDWP_JDWP_EXPAND_BUF_H_ +#define ART_RUNTIME_JDWP_JDWP_EXPAND_BUF_H_ #include @@ -67,4 +67,4 @@ void expandBufAddLocation(ExpandBuf* pReply, const JdwpLocation& location); } // namespace art -#endif // ART_JDWP_EXPANDBUF_H_ +#endif // ART_RUNTIME_JDWP_JDWP_EXPAND_BUF_H_ diff --git a/runtime/jdwp/jdwp_priv.h b/runtime/jdwp/jdwp_priv.h index c8a7b2686d..ab89339347 100644 --- a/runtime/jdwp/jdwp_priv.h +++ b/runtime/jdwp/jdwp_priv.h @@ -16,8 +16,8 @@ /* * JDWP internal interfaces. */ -#ifndef ART_JDWP_JDWPPRIV_H_ -#define ART_JDWP_JDWPPRIV_H_ +#ifndef ART_RUNTIME_JDWP_JDWP_PRIV_H_ +#define ART_RUNTIME_JDWP_JDWP_PRIV_H_ #include "debugger.h" #include "jdwp/jdwp.h" @@ -101,4 +101,4 @@ class JdwpNetStateBase { } // namespace art -#endif // ART_JDWP_JDWPPRIV_H_ +#endif // ART_RUNTIME_JDWP_JDWP_PRIV_H_ diff --git a/runtime/jdwp/object_registry.h b/runtime/jdwp/object_registry.h index d0ea59da71..345f0ad73a 100644 --- a/runtime/jdwp/object_registry.h +++ b/runtime/jdwp/object_registry.h @@ -14,6 +14,9 @@ * limitations under the License. */ +#ifndef ART_RUNTIME_JDWP_OBJECT_REGISTRY_H_ +#define ART_RUNTIME_JDWP_OBJECT_REGISTRY_H_ + #include #include @@ -98,3 +101,5 @@ class ObjectRegistry { }; } // namespace art + +#endif // ART_RUNTIME_JDWP_OBJECT_REGISTRY_H_ diff --git a/runtime/jni_internal.h b/runtime/jni_internal.h index 7b43f95cb3..ad66ada329 100644 --- a/runtime/jni_internal.h +++ b/runtime/jni_internal.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_JNI_INTERNAL_H_ -#define ART_SRC_JNI_INTERNAL_H_ +#ifndef ART_RUNTIME_JNI_INTERNAL_H_ +#define ART_RUNTIME_JNI_INTERNAL_H_ #include "jni.h" @@ -198,4 +198,4 @@ class ScopedJniEnvLocalRefState { std::ostream& operator<<(std::ostream& os, const jobjectRefType& rhs); -#endif // ART_SRC_JNI_INTERNAL_H_ +#endif // ART_RUNTIME_JNI_INTERNAL_H_ diff --git a/runtime/jobject_comparator.h b/runtime/jobject_comparator.h index 17098aaebb..698d6678d6 100644 --- a/runtime/jobject_comparator.h +++ b/runtime/jobject_comparator.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_JOBJECT_COMPARATOR_H_ -#define ART_SRC_JOBJECT_COMPARATOR_H_ +#ifndef ART_RUNTIME_JOBJECT_COMPARATOR_H_ +#define ART_RUNTIME_JOBJECT_COMPARATOR_H_ #include @@ -27,4 +27,4 @@ struct JobjectComparator { } // namespace art -#endif // ART_SRC_JOBJECT_COMPARATOR_H_ +#endif // ART_RUNTIME_JOBJECT_COMPARATOR_H_ diff --git a/runtime/jvalue.h b/runtime/jvalue.h index 66cd93e2c0..0c1aadb462 100644 --- a/runtime/jvalue.h +++ b/runtime/jvalue.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_JVALUE_H_ -#define ART_SRC_JVALUE_H_ +#ifndef ART_RUNTIME_JVALUE_H_ +#define ART_RUNTIME_JVALUE_H_ #include "base/macros.h" @@ -75,4 +75,4 @@ union PACKED(4) JValue { } // namespace art -#endif // ART_SRC_JVALUE_H_ +#endif // ART_RUNTIME_JVALUE_H_ diff --git a/runtime/leb128.h b/runtime/leb128.h index a5a6683aee..ca955b0921 100644 --- a/runtime/leb128.h +++ b/runtime/leb128.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_LEB128_H_ -#define ART_SRC_LEB128_H_ +#ifndef ART_RUNTIME_LEB128_H_ +#define ART_RUNTIME_LEB128_H_ #include "globals.h" @@ -121,4 +121,4 @@ static inline uint8_t* WriteUnsignedLeb128(uint8_t* ptr, uint32_t data) { } // namespace art -#endif // ART_SRC_LEB128_H_ +#endif // ART_RUNTIME_LEB128_H_ diff --git a/runtime/locks.h b/runtime/locks.h index 91437e1830..6b0e96f8b9 100644 --- a/runtime/locks.h +++ b/runtime/locks.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_LOCKS_H_ -#define ART_SRC_LOCKS_H_ +#ifndef ART_RUNTIME_LOCKS_H_ +#define ART_RUNTIME_LOCKS_H_ #include @@ -165,4 +165,4 @@ class Locks { } // namespace art -#endif // ART_SRC_LOCKS_H_ +#endif // ART_RUNTIME_LOCKS_H_ diff --git a/runtime/log_severity.h b/runtime/log_severity.h index 126019bdb6..bb7679d218 100644 --- a/runtime/log_severity.h +++ b/runtime/log_severity.h @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef BASE_LOG_SEVERITY_H_ -#define BASE_LOG_SEVERITY_H_ +#ifndef ART_RUNTIME_LOG_SEVERITY_H_ +#define ART_RUNTIME_LOG_SEVERITY_H_ typedef int LogSeverity; const int VERBOSE = 0, DEBUG = 1, INFO = 2, WARNING = 3, ERROR = 4, FATAL = 5; const int INTERNAL_FATAL = 6; // For Runtime::Abort. -#endif // BASE_LOG_SEVERITY_H_ +#endif // ART_RUNTIME_LOG_SEVERITY_H_ diff --git a/runtime/mem_map.h b/runtime/mem_map.h index 2eb7772705..7d418a5c6a 100644 --- a/runtime/mem_map.h +++ b/runtime/mem_map.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MEM_MAP_H_ -#define ART_SRC_MEM_MAP_H_ +#ifndef ART_RUNTIME_MEM_MAP_H_ +#define ART_RUNTIME_MEM_MAP_H_ #include @@ -101,4 +101,4 @@ class MemMap { } // namespace art -#endif // ART_SRC_MEM_MAP_H_ +#endif // ART_RUNTIME_MEM_MAP_H_ diff --git a/runtime/memory_region.h b/runtime/memory_region.h index cfbe42dddf..849ab1c420 100644 --- a/runtime/memory_region.h +++ b/runtime/memory_region.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MEMORY_REGION_H_ -#define ART_SRC_MEMORY_REGION_H_ +#ifndef ART_RUNTIME_MEMORY_REGION_H_ +#define ART_RUNTIME_MEMORY_REGION_H_ #include @@ -96,4 +96,4 @@ class MemoryRegion { } // namespace art -#endif // ART_MEMORY_REGION_H_ +#endif // ART_RUNTIME_MEMORY_REGION_H_ diff --git a/runtime/method_reference.h b/runtime/method_reference.h index ff8bf313f0..1ff4ea0942 100644 --- a/runtime/method_reference.h +++ b/runtime/method_reference.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_METHOD_REFERENCE_H_ -#define ART_SRC_METHOD_REFERENCE_H_ +#ifndef ART_RUNTIME_METHOD_REFERENCE_H_ +#define ART_RUNTIME_METHOD_REFERENCE_H_ namespace art { @@ -44,4 +44,4 @@ struct MethodReferenceComparator { } // namespace art -#endif // ART_SRC_METHOD_REFERENCE_H_ +#endif // ART_RUNTIME_METHOD_REFERENCE_H_ diff --git a/runtime/mirror/abstract_method-inl.h b/runtime/mirror/abstract_method-inl.h index a8238867aa..6fcd705e55 100644 --- a/runtime/mirror/abstract_method-inl.h +++ b/runtime/mirror/abstract_method-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_METHOD_INL_H_ -#define ART_SRC_MIRROR_METHOD_INL_H_ +#ifndef ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_ +#define ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_ #include "abstract_method.h" @@ -196,4 +196,4 @@ inline bool AbstractMethod::IsResolutionMethod() const { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_METHOD_INL_H_ +#endif // ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_ diff --git a/runtime/mirror/abstract_method.h b/runtime/mirror/abstract_method.h index 339471dd5d..d909058e0d 100644 --- a/runtime/mirror/abstract_method.h +++ b/runtime/mirror/abstract_method.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_METHOD_H_ -#define ART_SRC_MIRROR_METHOD_H_ +#ifndef ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_ +#define ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_ #include "class.h" #include "dex_file.h" @@ -515,4 +515,4 @@ class MANAGED AbstractMethodClass : public Class { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_METHOD_H_ +#endif // ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_ diff --git a/runtime/mirror/array-inl.h b/runtime/mirror/array-inl.h index b7f212f50f..eb73c7dd38 100644 --- a/runtime/mirror/array-inl.h +++ b/runtime/mirror/array-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_ARRAY_INL_H_ -#define ART_SRC_MIRROR_ARRAY_INL_H_ +#ifndef ART_RUNTIME_MIRROR_ARRAY_INL_H_ +#define ART_RUNTIME_MIRROR_ARRAY_INL_H_ #include "array.h" @@ -36,4 +36,4 @@ inline size_t Array::SizeOf() const { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_ARRAY_INL_H_ +#endif // ART_RUNTIME_MIRROR_ARRAY_INL_H_ diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h index 98b8ea0008..b195a87fc0 100644 --- a/runtime/mirror/array.h +++ b/runtime/mirror/array.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_ARRAY_H_ -#define ART_SRC_MIRROR_ARRAY_H_ +#ifndef ART_RUNTIME_MIRROR_ARRAY_H_ +#define ART_RUNTIME_MIRROR_ARRAY_H_ #include "object.h" @@ -145,4 +145,4 @@ class MANAGED PrimitiveArray : public Array { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_ARRAY_H_ +#endif // ART_RUNTIME_MIRROR_ARRAY_H_ diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h index 6819fb2954..d323c3333b 100644 --- a/runtime/mirror/class-inl.h +++ b/runtime/mirror/class-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_CLASS_INL_H_ -#define ART_SRC_MIRROR_CLASS_INL_H_ +#ifndef ART_RUNTIME_MIRROR_CLASS_INL_H_ +#define ART_RUNTIME_MIRROR_CLASS_INL_H_ #include "class.h" @@ -346,4 +346,4 @@ inline void Class::SetName(String* name) { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_CLASS_INL_H_ +#endif // ART_RUNTIME_MIRROR_CLASS_INL_H_ diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h index 084aa24c7c..9a506c29af 100644 --- a/runtime/mirror/class.h +++ b/runtime/mirror/class.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_CLASS_H_ -#define ART_SRC_MIRROR_CLASS_H_ +#ifndef ART_RUNTIME_MIRROR_CLASS_H_ +#define ART_RUNTIME_MIRROR_CLASS_H_ #include "modifiers.h" #include "object.h" @@ -882,4 +882,4 @@ class MANAGED ClassClass : public Class { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_CLASS_H_ +#endif // ART_RUNTIME_MIRROR_CLASS_H_ diff --git a/runtime/mirror/class_loader.h b/runtime/mirror/class_loader.h index 0d635f1d21..415cb67c6c 100644 --- a/runtime/mirror/class_loader.h +++ b/runtime/mirror/class_loader.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_CLASS_LOADER_H_ -#define ART_SRC_CLASS_LOADER_H_ +#ifndef ART_RUNTIME_MIRROR_CLASS_LOADER_H_ +#define ART_RUNTIME_MIRROR_CLASS_LOADER_H_ #include @@ -43,4 +43,4 @@ class MANAGED ClassLoader : public Object { } // namespace mirror } // namespace art -#endif // ART_SRC_CLASS_LOADER_H_ +#endif // ART_RUNTIME_MIRROR_CLASS_LOADER_H_ diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h index 3b17c428a5..369dc49ed0 100644 --- a/runtime/mirror/dex_cache-inl.h +++ b/runtime/mirror/dex_cache-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_DEX_CACHE_INL_H_ -#define ART_SRC_MIRROR_DEX_CACHE_INL_H_ +#ifndef ART_RUNTIME_MIRROR_DEX_CACHE_INL_H_ +#define ART_RUNTIME_MIRROR_DEX_CACHE_INL_H_ #include "dex_cache.h" @@ -37,4 +37,4 @@ inline AbstractMethod* DexCache::GetResolvedMethod(uint32_t method_idx) const } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_DEX_CACHE_INL_H_ +#endif // ART_RUNTIME_MIRROR_DEX_CACHE_INL_H_ diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h index 307588b581..fd3f5f44b8 100644 --- a/runtime/mirror/dex_cache.h +++ b/runtime/mirror/dex_cache.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_DEX_CACHE_H_ -#define ART_SRC_MIRROR_DEX_CACHE_H_ +#ifndef ART_RUNTIME_MIRROR_DEX_CACHE_H_ +#define ART_RUNTIME_MIRROR_DEX_CACHE_H_ #include "abstract_method.h" #include "class.h" @@ -179,4 +179,4 @@ class MANAGED DexCache : public Object { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_DEX_CACHE_H_ +#endif // ART_RUNTIME_MIRROR_DEX_CACHE_H_ diff --git a/runtime/mirror/field-inl.h b/runtime/mirror/field-inl.h index be5dcab03d..3e3d6db4a6 100644 --- a/runtime/mirror/field-inl.h +++ b/runtime/mirror/field-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_FIELD_INL_H_ -#define ART_SRC_MIRROR_FIELD_INL_H_ +#ifndef ART_RUNTIME_MIRROR_FIELD_INL_H_ +#define ART_RUNTIME_MIRROR_FIELD_INL_H_ #include "field.h" @@ -218,4 +218,4 @@ inline void Field::SetObject(Object* object, const Object* l) const { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_FIELD_INL_H_ +#endif // ART_RUNTIME_MIRROR_FIELD_INL_H_ diff --git a/runtime/mirror/field.h b/runtime/mirror/field.h index 4e7abe8550..6e508a362f 100644 --- a/runtime/mirror/field.h +++ b/runtime/mirror/field.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_FIELD_H_ -#define ART_SRC_MIRROR_FIELD_H_ +#ifndef ART_RUNTIME_MIRROR_FIELD_H_ +#define ART_RUNTIME_MIRROR_FIELD_H_ #include "class.h" #include "modifiers.h" @@ -165,4 +165,4 @@ class MANAGED FieldClass : public Class { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_FIELD_H_ +#endif // ART_RUNTIME_MIRROR_FIELD_H_ diff --git a/runtime/mirror/iftable-inl.h b/runtime/mirror/iftable-inl.h index 72803b8002..9d5fa7475a 100644 --- a/runtime/mirror/iftable-inl.h +++ b/runtime/mirror/iftable-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_IFTABLE_INL_H_ -#define ART_SRC_MIRROR_IFTABLE_INL_H_ +#ifndef ART_RUNTIME_MIRROR_IFTABLE_INL_H_ +#define ART_RUNTIME_MIRROR_IFTABLE_INL_H_ #include "iftable.h" @@ -32,4 +32,4 @@ inline void IfTable::SetInterface(int32_t i, Class* interface) { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_IFTABLE_INL_H_ +#endif // ART_RUNTIME_MIRROR_IFTABLE_INL_H_ diff --git a/runtime/mirror/iftable.h b/runtime/mirror/iftable.h index ffb2e51582..aea8fddafe 100644 --- a/runtime/mirror/iftable.h +++ b/runtime/mirror/iftable.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_IFTABLE_H_ -#define ART_SRC_MIRROR_IFTABLE_H_ +#ifndef ART_RUNTIME_MIRROR_IFTABLE_H_ +#define ART_RUNTIME_MIRROR_IFTABLE_H_ #include "object_array.h" @@ -76,4 +76,4 @@ class MANAGED IfTable : public ObjectArray { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_IFTABLE_H_ +#endif // ART_RUNTIME_MIRROR_IFTABLE_H_ diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h index 1a91dd3e6f..5818a800bf 100644 --- a/runtime/mirror/object-inl.h +++ b/runtime/mirror/object-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_OBJECT_INL_H_ -#define ART_SRC_MIRROR_OBJECT_INL_H_ +#ifndef ART_RUNTIME_MIRROR_OBJECT_INL_H_ +#define ART_RUNTIME_MIRROR_OBJECT_INL_H_ #include "object.h" @@ -272,4 +272,4 @@ inline void Object::VerifyObject(const Object* obj) { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_OBJECT_INL_H_ +#endif // ART_RUNTIME_MIRROR_OBJECT_INL_H_ diff --git a/runtime/mirror/object.h b/runtime/mirror/object.h index 71b628db52..a40c906eb0 100644 --- a/runtime/mirror/object.h +++ b/runtime/mirror/object.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_OBJECT_H_ -#define ART_SRC_MIRROR_OBJECT_H_ +#ifndef ART_RUNTIME_MIRROR_OBJECT_H_ +#define ART_RUNTIME_MIRROR_OBJECT_H_ #include "base/casts.h" #include "base/logging.h" @@ -260,4 +260,4 @@ class MANAGED Object { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_OBJECT_H_ +#endif // ART_RUNTIME_MIRROR_OBJECT_H_ diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h index b130dac514..8675c31b37 100644 --- a/runtime/mirror/object_array-inl.h +++ b/runtime/mirror/object_array-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_OBJECT_ARRAY_INL_H_ -#define ART_SRC_MIRROR_OBJECT_ARRAY_INL_H_ +#ifndef ART_RUNTIME_MIRROR_OBJECT_ARRAY_INL_H_ +#define ART_RUNTIME_MIRROR_OBJECT_ARRAY_INL_H_ #include "object_array.h" @@ -142,4 +142,4 @@ inline ObjectArray* ObjectArray::CopyOf(Thread* self, int32_t new_length) } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_OBJET_ARRAY_INL_H_ +#endif // ART_RUNTIME_MIRROR_OBJECT_ARRAY_INL_H_ diff --git a/runtime/mirror/object_array.h b/runtime/mirror/object_array.h index 08a8d62567..09ff5193ae 100644 --- a/runtime/mirror/object_array.h +++ b/runtime/mirror/object_array.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_OBJECT_ARRAY_H_ -#define ART_SRC_MIRROR_OBJECT_ARRAY_H_ +#ifndef ART_RUNTIME_MIRROR_OBJECT_ARRAY_H_ +#define ART_RUNTIME_MIRROR_OBJECT_ARRAY_H_ #include "array.h" @@ -61,4 +61,4 @@ class MANAGED ObjectArray : public Array { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_OBJECT_ARRAY_H_ +#endif // ART_RUNTIME_MIRROR_OBJECT_ARRAY_H_ diff --git a/runtime/mirror/proxy.h b/runtime/mirror/proxy.h index cac028a731..7c5bc39429 100644 --- a/runtime/mirror/proxy.h +++ b/runtime/mirror/proxy.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_PROXY_H_ -#define ART_SRC_MIRROR_PROXY_H_ +#ifndef ART_RUNTIME_MIRROR_PROXY_H_ +#define ART_RUNTIME_MIRROR_PROXY_H_ #include "mirror/object.h" @@ -52,4 +52,4 @@ class MANAGED Proxy : public Object { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_PROXY_H_ +#endif // ART_RUNTIME_MIRROR_PROXY_H_ diff --git a/runtime/mirror/stack_trace_element.h b/runtime/mirror/stack_trace_element.h index d53c8602dc..a9751f9988 100644 --- a/runtime/mirror/stack_trace_element.h +++ b/runtime/mirror/stack_trace_element.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_STACK_TRACE_ELEMENT_H_ -#define ART_SRC_MIRROR_STACK_TRACE_ELEMENT_H_ +#ifndef ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_ +#define ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_ #include "object.h" @@ -80,4 +80,4 @@ class MANAGED StackTraceElement : public Object { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_STACK_TRACE_ELEMENT_H_ +#endif // ART_RUNTIME_MIRROR_STACK_TRACE_ELEMENT_H_ diff --git a/runtime/mirror/string.h b/runtime/mirror/string.h index 8109dcb9a9..bf545eaefb 100644 --- a/runtime/mirror/string.h +++ b/runtime/mirror/string.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_STRING_H_ -#define ART_SRC_MIRROR_STRING_H_ +#ifndef ART_RUNTIME_MIRROR_STRING_H_ +#define ART_RUNTIME_MIRROR_STRING_H_ #include "class.h" #include "gtest/gtest.h" @@ -164,4 +164,4 @@ class MANAGED StringClass : public Class { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_STRING_H_ +#endif // ART_RUNTIME_MIRROR_STRING_H_ diff --git a/runtime/mirror/throwable.h b/runtime/mirror/throwable.h index aafcc07d86..909228e4d9 100644 --- a/runtime/mirror/throwable.h +++ b/runtime/mirror/throwable.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MIRROR_THROWABLE_H_ -#define ART_SRC_MIRROR_THROWABLE_H_ +#ifndef ART_RUNTIME_MIRROR_THROWABLE_H_ +#define ART_RUNTIME_MIRROR_THROWABLE_H_ #include "object.h" #include "string.h" @@ -72,4 +72,4 @@ class MANAGED Throwable : public Object { } // namespace mirror } // namespace art -#endif // ART_SRC_MIRROR_THROWABLE_H_ +#endif // ART_RUNTIME_MIRROR_THROWABLE_H_ diff --git a/runtime/modifiers.h b/runtime/modifiers.h index 85bc06da65..9b61ee0cf0 100644 --- a/runtime/modifiers.h +++ b/runtime/modifiers.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MODIFIERS_H_ -#define ART_SRC_MODIFIERS_H_ +#ifndef ART_RUNTIME_MODIFIERS_H_ +#define ART_RUNTIME_MODIFIERS_H_ #include @@ -63,5 +63,5 @@ static const uint32_t kAccReferenceFlagsMask = (kAccClassIsReference | kAccClassIsFinalizerReference | kAccClassIsPhantomReference); -#endif // ART_SRC_MODIFIERS_H_ +#endif // ART_RUNTIME_MODIFIERS_H_ diff --git a/runtime/monitor.h b/runtime/monitor.h index 9194c08ab4..9206131a5b 100644 --- a/runtime/monitor.h +++ b/runtime/monitor.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_MONITOR_H_ -#define ART_SRC_MONITOR_H_ +#ifndef ART_RUNTIME_MONITOR_H_ +#define ART_RUNTIME_MONITOR_H_ #include #include @@ -208,4 +208,4 @@ class MonitorInfo { } // namespace art -#endif // ART_SRC_MONITOR_H_ +#endif // ART_RUNTIME_MONITOR_H_ diff --git a/runtime/nth_caller_visitor.h b/runtime/nth_caller_visitor.h index c32a46aa02..e3593d805d 100644 --- a/runtime/nth_caller_visitor.h +++ b/runtime/nth_caller_visitor.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_NTH_CALLER_VISITOR_H_ -#define ART_SRC_NTH_CALLER_VISITOR_H_ +#ifndef ART_RUNTIME_NTH_CALLER_VISITOR_H_ +#define ART_RUNTIME_NTH_CALLER_VISITOR_H_ #include "mirror/abstract_method.h" #include "locks.h" @@ -58,4 +58,4 @@ struct NthCallerVisitor : public StackVisitor { } // namespace art -#endif // ART_SRC_NTH_CALLER_VISITOR_H_ +#endif // ART_RUNTIME_NTH_CALLER_VISITOR_H_ diff --git a/runtime/oat.h b/runtime/oat.h index c67a1a6630..fb28962762 100644 --- a/runtime/oat.h +++ b/runtime/oat.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_H_ -#define ART_SRC_OAT_H_ +#ifndef ART_RUNTIME_OAT_H_ +#define ART_RUNTIME_OAT_H_ #include @@ -113,4 +113,4 @@ class PACKED(4) OatMethodOffsets { } // namespace art -#endif // ART_SRC_OAT_H_ +#endif // ART_RUNTIME_OAT_H_ diff --git a/runtime/oat/runtime/argument_visitor.h b/runtime/oat/runtime/argument_visitor.h index 4ab05b9e4d..d92ff19d13 100644 --- a/runtime/oat/runtime/argument_visitor.h +++ b/runtime/oat/runtime/argument_visitor.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_RUNTIME_ARGUMENT_VISITOR_H_ -#define ART_SRC_OAT_RUNTIME_ARGUMENT_VISITOR_H_ +#ifndef ART_RUNTIME_OAT_RUNTIME_ARGUMENT_VISITOR_H_ +#define ART_RUNTIME_OAT_RUNTIME_ARGUMENT_VISITOR_H_ #include "object_utils.h" @@ -246,4 +246,4 @@ class QuickArgumentVisitor { } -#endif // ART_SRC_OAT_RUNTIME_ARGUMENT_VISITOR_H_ +#endif // ART_RUNTIME_OAT_RUNTIME_ARGUMENT_VISITOR_H_ diff --git a/runtime/oat/runtime/arm/context_arm.h b/runtime/oat/runtime/arm/context_arm.h index ec1d4cb7f6..0be85e3577 100644 --- a/runtime/oat/runtime/arm/context_arm.h +++ b/runtime/oat/runtime/arm/context_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_RUNTIME_ARM_CONTEXT_ARM_H_ -#define ART_SRC_OAT_RUNTIME_ARM_CONTEXT_ARM_H_ +#ifndef ART_RUNTIME_OAT_RUNTIME_ARM_CONTEXT_ARM_H_ +#define ART_RUNTIME_OAT_RUNTIME_ARM_CONTEXT_ARM_H_ #include "locks.h" #include "constants_arm.h" @@ -64,4 +64,4 @@ class ArmContext : public Context { } // namespace arm } // namespace art -#endif // ART_SRC_OAT_RUNTIME_ARM_CONTEXT_ARM_H_ +#endif // ART_RUNTIME_OAT_RUNTIME_ARM_CONTEXT_ARM_H_ diff --git a/runtime/oat/runtime/callee_save_frame.h b/runtime/oat/runtime/callee_save_frame.h index dd2f3fa69e..59f46acbac 100644 --- a/runtime/oat/runtime/callee_save_frame.h +++ b/runtime/oat/runtime/callee_save_frame.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_ -#define ART_SRC_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_ +#ifndef ART_RUNTIME_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_ +#define ART_RUNTIME_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_ #include "base/mutex.h" #include "thread-inl.h" @@ -38,4 +38,4 @@ static void FinishCalleeSaveFrameSetup(Thread* self, mirror::AbstractMethod** sp } // namespace art -#endif // ART_SRC_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_ +#endif // ART_RUNTIME_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_ diff --git a/runtime/oat/runtime/context.h b/runtime/oat/runtime/context.h index 895abf99ed..ac43e9a7e9 100644 --- a/runtime/oat/runtime/context.h +++ b/runtime/oat/runtime/context.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_RUNTIME_CONTEXT_H_ -#define ART_SRC_OAT_RUNTIME_CONTEXT_H_ +#ifndef ART_RUNTIME_OAT_RUNTIME_CONTEXT_H_ +#define ART_RUNTIME_OAT_RUNTIME_CONTEXT_H_ #include #include @@ -67,4 +67,4 @@ class Context { } // namespace art -#endif // ART_SRC_OAT_RUNTIME_CONTEXT_H_ +#endif // ART_RUNTIME_OAT_RUNTIME_CONTEXT_H_ diff --git a/runtime/oat/runtime/mips/context_mips.h b/runtime/oat/runtime/mips/context_mips.h index fc8ef9655f..f27124c79b 100644 --- a/runtime/oat/runtime/mips/context_mips.h +++ b/runtime/oat/runtime/mips/context_mips.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ -#define ART_SRC_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ +#ifndef ART_RUNTIME_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ +#define ART_RUNTIME_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ #include "constants_mips.h" #include "oat/runtime/context.h" @@ -61,4 +61,4 @@ class MipsContext : public Context { } // namespace mips } // namespace art -#endif // ART_SRC_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ +#endif // ART_RUNTIME_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_ diff --git a/runtime/oat/runtime/oat_support_entrypoints.h b/runtime/oat/runtime/oat_support_entrypoints.h index c1a2587c45..546ee01c6f 100644 --- a/runtime/oat/runtime/oat_support_entrypoints.h +++ b/runtime/oat/runtime/oat_support_entrypoints.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_ -#define ART_SRC_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_ +#ifndef ART_RUNTIME_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_ +#define ART_RUNTIME_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_ #include "dex_file-inl.h" #include "runtime.h" @@ -174,4 +174,4 @@ void ChangeDebuggerEntryPoint(EntryPoints* points, bool enabled); } // namespace art -#endif // ART_SRC_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_ +#endif // ART_RUNTIME_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_ diff --git a/runtime/oat/runtime/x86/context_x86.h b/runtime/oat/runtime/x86/context_x86.h index 7928fd860f..4ecfc51b04 100644 --- a/runtime/oat/runtime/x86/context_x86.h +++ b/runtime/oat/runtime/x86/context_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_RUNTIME_X86_CONTEXT_X86_H_ -#define ART_SRC_OAT_RUNTIME_X86_CONTEXT_X86_H_ +#ifndef ART_RUNTIME_OAT_RUNTIME_X86_CONTEXT_X86_H_ +#define ART_RUNTIME_OAT_RUNTIME_X86_CONTEXT_X86_H_ #include "constants_x86.h" #include "oat/runtime/context.h" @@ -64,4 +64,4 @@ class X86Context : public Context { } // namespace x86 } // namespace art -#endif // ART_SRC_OAT_RUNTIME_X86_CONTEXT_X86_H_ +#endif // ART_RUNTIME_OAT_RUNTIME_X86_CONTEXT_X86_H_ diff --git a/runtime/oat/utils/arm/assembler_arm.h b/runtime/oat/utils/arm/assembler_arm.h index 06e0a55f63..b8c79d21b9 100644 --- a/runtime/oat/utils/arm/assembler_arm.h +++ b/runtime/oat/utils/arm/assembler_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_ARM_ASSEMBLER_ARM_H_ -#define ART_SRC_OAT_UTILS_ARM_ASSEMBLER_ARM_H_ +#ifndef ART_RUNTIME_OAT_UTILS_ARM_ASSEMBLER_ARM_H_ +#define ART_RUNTIME_OAT_UTILS_ARM_ASSEMBLER_ARM_H_ #include @@ -656,4 +656,4 @@ class ArmExceptionSlowPath : public SlowPath { } // namespace arm } // namespace art -#endif // ART_SRC_OAT_UTILS_ARM_ASSEMBLER_ARM_H_ +#endif // ART_RUNTIME_OAT_UTILS_ARM_ASSEMBLER_ARM_H_ diff --git a/runtime/oat/utils/arm/managed_register_arm.h b/runtime/oat/utils/arm/managed_register_arm.h index b069f6dedd..01596bb6b1 100644 --- a/runtime/oat/utils/arm/managed_register_arm.h +++ b/runtime/oat/utils/arm/managed_register_arm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_ -#define ART_SRC_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_ +#ifndef ART_RUNTIME_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_ +#define ART_RUNTIME_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_ #include "base/logging.h" #include "constants_arm.h" @@ -271,4 +271,4 @@ inline arm::ArmManagedRegister ManagedRegister::AsArm() const { } // namespace art -#endif // ART_SRC_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_ +#endif // ART_RUNTIME_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_ diff --git a/runtime/oat/utils/assembler.h b/runtime/oat/utils/assembler.h index cbf145b949..05e2732c5f 100644 --- a/runtime/oat/utils/assembler.h +++ b/runtime/oat/utils/assembler.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_ASSEMBLER_H_ -#define ART_SRC_OAT_UTILS_ASSEMBLER_H_ +#ifndef ART_RUNTIME_OAT_UTILS_ASSEMBLER_H_ +#define ART_RUNTIME_OAT_UTILS_ASSEMBLER_H_ #include @@ -456,4 +456,4 @@ class Assembler { } // namespace art -#endif // ART_SRC_OAT_UTILS_ASSEMBLER_H_ +#endif // ART_RUNTIME_OAT_UTILS_ASSEMBLER_H_ diff --git a/runtime/oat/utils/managed_register.h b/runtime/oat/utils/managed_register.h index a3d5795665..4dd2acd8fe 100644 --- a/runtime/oat/utils/managed_register.h +++ b/runtime/oat/utils/managed_register.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_MANAGED_REGISTER_H_ -#define ART_SRC_OAT_UTILS_MANAGED_REGISTER_H_ +#ifndef ART_RUNTIME_OAT_UTILS_MANAGED_REGISTER_H_ +#define ART_RUNTIME_OAT_UTILS_MANAGED_REGISTER_H_ namespace art { @@ -69,4 +69,4 @@ class ManagedRegister { } // namespace art -#endif // ART_SRC_OAT_UTILS_MANAGED_REGISTER_H_ +#endif // ART_RUNTIME_OAT_UTILS_MANAGED_REGISTER_H_ diff --git a/runtime/oat/utils/mips/assembler_mips.h b/runtime/oat/utils/mips/assembler_mips.h index 02759e4efb..eeb4a57db2 100644 --- a/runtime/oat/utils/mips/assembler_mips.h +++ b/runtime/oat/utils/mips/assembler_mips.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_ -#define ART_SRC_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_ +#ifndef ART_RUNTIME_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_ +#define ART_RUNTIME_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_ #include @@ -510,4 +510,4 @@ class MipsExceptionSlowPath : public SlowPath { } // namespace mips } // namespace art -#endif // ART_SRC_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_ +#endif // ART_RUNTIME_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_ diff --git a/runtime/oat/utils/mips/managed_register_mips.h b/runtime/oat/utils/mips/managed_register_mips.h index aaaabfcc0c..b335ff9649 100644 --- a/runtime/oat/utils/mips/managed_register_mips.h +++ b/runtime/oat/utils/mips/managed_register_mips.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_ -#define ART_SRC_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_ +#ifndef ART_RUNTIME_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_ +#define ART_RUNTIME_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_ #include "constants_mips.h" #include "oat/utils/managed_register.h" @@ -225,4 +225,4 @@ inline mips::MipsManagedRegister ManagedRegister::AsMips() const { } // namespace art -#endif // ART_SRC_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_ +#endif // ART_RUNTIME_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_ diff --git a/runtime/oat/utils/x86/assembler_x86.h b/runtime/oat/utils/x86/assembler_x86.h index dddb9b1885..390f7aa898 100644 --- a/runtime/oat/utils/x86/assembler_x86.h +++ b/runtime/oat/utils/x86/assembler_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_X86_ASSEMBLER_X86_H_ -#define ART_SRC_OAT_UTILS_X86_ASSEMBLER_X86_H_ +#ifndef ART_RUNTIME_OAT_UTILS_X86_ASSEMBLER_X86_H_ +#define ART_RUNTIME_OAT_UTILS_X86_ASSEMBLER_X86_H_ #include #include "base/macros.h" @@ -652,4 +652,4 @@ class X86ExceptionSlowPath : public SlowPath { } // namespace x86 } // namespace art -#endif // ART_SRC_OAT_UTILS_X86_ASSEMBLER_X86_H_ +#endif // ART_RUNTIME_OAT_UTILS_X86_ASSEMBLER_X86_H_ diff --git a/runtime/oat/utils/x86/managed_register_x86.h b/runtime/oat/utils/x86/managed_register_x86.h index 4481456315..b564a8396f 100644 --- a/runtime/oat/utils/x86/managed_register_x86.h +++ b/runtime/oat/utils/x86/managed_register_x86.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_ -#define ART_SRC_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_ +#ifndef ART_RUNTIME_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_ +#define ART_RUNTIME_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_ #include "constants_x86.h" #include "oat/utils/managed_register.h" @@ -215,4 +215,4 @@ inline x86::X86ManagedRegister ManagedRegister::AsX86() const { } // namespace art -#endif // ART_SRC_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_ +#endif // ART_RUNTIME_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_ diff --git a/runtime/oat_file.h b/runtime/oat_file.h index ecc8d0c965..fff6c8a1a6 100644 --- a/runtime/oat_file.h +++ b/runtime/oat_file.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OAT_FILE_H_ -#define ART_SRC_OAT_FILE_H_ +#ifndef ART_RUNTIME_OAT_FILE_H_ +#define ART_RUNTIME_OAT_FILE_H_ #include #include @@ -265,4 +265,4 @@ class OatFile { } // namespace art -#endif // ART_SRC_OAT_WRITER_H_ +#endif // ART_RUNTIME_OAT_FILE_H_ diff --git a/runtime/object_utils.h b/runtime/object_utils.h index 4af5d4c30b..fa7763e11f 100644 --- a/runtime/object_utils.h +++ b/runtime/object_utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OBJECT_UTILS_H_ -#define ART_SRC_OBJECT_UTILS_H_ +#ifndef ART_RUNTIME_OBJECT_UTILS_H_ +#define ART_RUNTIME_OBJECT_UTILS_H_ #include "class_linker-inl.h" #include "dex_file.h" @@ -684,4 +684,4 @@ class MethodHelper { } // namespace art -#endif // ART_SRC_OBJECT_UTILS_H_ +#endif // ART_RUNTIME_OBJECT_UTILS_H_ diff --git a/runtime/offsets.h b/runtime/offsets.h index f37dbd4413..94ae805e4a 100644 --- a/runtime/offsets.h +++ b/runtime/offsets.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OFFSETS_H_ -#define ART_SRC_OFFSETS_H_ +#ifndef ART_RUNTIME_OFFSETS_H_ +#define ART_RUNTIME_OFFSETS_H_ #include // NOLINT #include "globals.h" @@ -59,4 +59,4 @@ class MemberOffset : public Offset { } // namespace art -#endif // ART_SRC_OFFSETS_H_ +#endif // ART_RUNTIME_OFFSETS_H_ diff --git a/runtime/os.h b/runtime/os.h index 3428b6afb3..6767566673 100644 --- a/runtime/os.h +++ b/runtime/os.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OS_H_ -#define ART_SRC_OS_H_ +#ifndef ART_RUNTIME_OS_H_ +#define ART_RUNTIME_OS_H_ namespace unix_file { class FdFile; @@ -41,4 +41,4 @@ class OS { } // namespace art -#endif // ART_SRC_OS_H_ +#endif // ART_RUNTIME_OS_H_ diff --git a/runtime/output_stream.h b/runtime/output_stream.h index b03092ddf7..d2a77d898e 100644 --- a/runtime/output_stream.h +++ b/runtime/output_stream.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_OUTPUT_STREAM_H_ -#define ART_SRC_OUTPUT_STREAM_H_ +#ifndef ART_RUNTIME_OUTPUT_STREAM_H_ +#define ART_RUNTIME_OUTPUT_STREAM_H_ #include @@ -53,4 +53,4 @@ class OutputStream { } // namespace art -#endif // ART_SRC_OUTPUT_STREAM_H_ +#endif // ART_RUNTIME_OUTPUT_STREAM_H_ diff --git a/runtime/primitive.h b/runtime/primitive.h index eaa04cd054..5e07311073 100644 --- a/runtime/primitive.h +++ b/runtime/primitive.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_PRIMITIVE_H_ -#define ART_SRC_PRIMITIVE_H_ +#ifndef ART_RUNTIME_PRIMITIVE_H_ +#define ART_RUNTIME_PRIMITIVE_H_ #include @@ -123,4 +123,4 @@ std::ostream& operator<<(std::ostream& os, const Primitive::Type& state); } // namespace art -#endif // ART_SRC_PRIMITIVE_H_ +#endif // ART_RUNTIME_PRIMITIVE_H_ diff --git a/runtime/reference_table.h b/runtime/reference_table.h index 5abb5c7b46..4b6b50e183 100644 --- a/runtime/reference_table.h +++ b/runtime/reference_table.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_REFERENCE_TABLE_H_ -#define ART_SRC_REFERENCE_TABLE_H_ +#ifndef ART_RUNTIME_REFERENCE_TABLE_H_ +#define ART_RUNTIME_REFERENCE_TABLE_H_ #include #include @@ -62,4 +62,4 @@ class ReferenceTable { } // namespace art -#endif // ART_SRC_REFERENCE_TABLE_H_ +#endif // ART_RUNTIME_REFERENCE_TABLE_H_ diff --git a/runtime/reflection.h b/runtime/reflection.h index e9f4e0893e..56ab4712db 100644 --- a/runtime/reflection.h +++ b/runtime/reflection.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_REFLECTION_H_ -#define ART_SRC_REFLECTION_H_ +#ifndef ART_RUNTIME_REFLECTION_H_ +#define ART_RUNTIME_REFLECTION_H_ #include "jni.h" #include "primitive.h" @@ -56,4 +56,4 @@ bool VerifyObjectInClass(mirror::Object* o, mirror::Class* c) } // namespace art -#endif // ART_SRC_REFLECTION_H_ +#endif // ART_RUNTIME_REFLECTION_H_ diff --git a/runtime/root_visitor.h b/runtime/root_visitor.h index d53acd3621..3aa9b4bac0 100644 --- a/runtime/root_visitor.h +++ b/runtime/root_visitor.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ROOT_VISITOR_H_ -#define ART_SRC_ROOT_VISITOR_H_ +#ifndef ART_RUNTIME_ROOT_VISITOR_H_ +#define ART_RUNTIME_ROOT_VISITOR_H_ namespace art { namespace mirror { @@ -30,4 +30,4 @@ typedef bool (IsMarkedTester)(const mirror::Object* object, void* arg); } // namespace art -#endif // ART_SRC_ROOT_VISITOR_H_ +#endif // ART_RUNTIME_ROOT_VISITOR_H_ diff --git a/runtime/runtime.h b/runtime/runtime.h index 97b7c2518b..58f985fae7 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_RUNTIME_H_ -#define ART_SRC_RUNTIME_H_ +#ifndef ART_RUNTIME_RUNTIME_H_ +#define ART_RUNTIME_RUNTIME_H_ #include #include @@ -476,4 +476,4 @@ class Runtime { } // namespace art -#endif // ART_SRC_RUNTIME_H_ +#endif // ART_RUNTIME_RUNTIME_H_ diff --git a/runtime/runtime_stats.h b/runtime/runtime_stats.h index 55e57ecc1d..05d3fbb60f 100644 --- a/runtime/runtime_stats.h +++ b/runtime/runtime_stats.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_RUNTIME_STATS_H_ -#define ART_SRC_RUNTIME_STATS_H_ +#ifndef ART_RUNTIME_RUNTIME_STATS_H_ +#define ART_RUNTIME_RUNTIME_STATS_H_ #include @@ -111,4 +111,4 @@ struct PACKED(4) RuntimeStats { } // namespace art -#endif // ART_SRC_HEAP_H_ +#endif // ART_RUNTIME_RUNTIME_STATS_H_ diff --git a/runtime/runtime_support.h b/runtime/runtime_support.h index 0cb82a5466..051981f99e 100644 --- a/runtime/runtime_support.h +++ b/runtime/runtime_support.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_RUNTIME_SUPPORT_H_ -#define ART_SRC_RUNTIME_SUPPORT_H_ +#ifndef ART_RUNTIME_RUNTIME_SUPPORT_H_ +#define ART_RUNTIME_RUNTIME_SUPPORT_H_ #include "class_linker.h" #include "common_throws.h" @@ -412,4 +412,4 @@ static inline void* GetJniDlsymLookupStub() { } // namespace art -#endif // ART_SRC_RUNTIME_SUPPORT_H_ +#endif // ART_RUNTIME_RUNTIME_SUPPORT_H_ diff --git a/runtime/runtime_support_llvm.h b/runtime/runtime_support_llvm.h index af99842089..566f7bcb16 100644 --- a/runtime/runtime_support_llvm.h +++ b/runtime/runtime_support_llvm.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_H_ -#define ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_H_ +#ifndef ART_RUNTIME_RUNTIME_SUPPORT_LLVM_H_ +#define ART_RUNTIME_RUNTIME_SUPPORT_LLVM_H_ extern "C" { @@ -27,4 +27,4 @@ void* art_portable_find_runtime_support_func(void* context, const char* name); } // extern "C" -#endif // ART_SRC_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_H_ +#endif // ART_RUNTIME_RUNTIME_SUPPORT_LLVM_H_ diff --git a/runtime/runtime_support_llvm_func_list.h b/runtime/runtime_support_llvm_func_list.h index a58b061e16..d371421a16 100644 --- a/runtime/runtime_support_llvm_func_list.h +++ b/runtime/runtime_support_llvm_func_list.h @@ -14,6 +14,9 @@ * limitations under the License. */ +#ifndef ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_ +#define ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_ + #define RUNTIME_SUPPORT_FUNC_LIST(V) \ V(LockObject, art_portable_lock_object_from_code) \ V(UnlockObject, art_portable_unlock_object_from_code) \ @@ -74,3 +77,6 @@ V(JniMethodEndSynchronized, art_portable_jni_method_end_synchronized) \ V(JniMethodEndWithReference, art_portable_jni_method_end_with_reference) \ V(JniMethodEndWithReferenceSynchronized, art_portable_jni_method_end_with_reference_synchronized) + +#endif // ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_ +#undef ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_ // the guard in this file is just for cpplint diff --git a/runtime/safe_map.h b/runtime/safe_map.h index b9a6ecf5e7..dcc172de01 100644 --- a/runtime/safe_map.h +++ b/runtime/safe_map.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_SAFE_MAP_H_ -#define ART_SRC_SAFE_MAP_H_ +#ifndef ART_RUNTIME_SAFE_MAP_H_ +#define ART_RUNTIME_SAFE_MAP_H_ #include @@ -102,4 +102,4 @@ bool operator!=(const SafeMap& lhs, const SafeMap @@ -59,4 +59,4 @@ class SignalSet { } // namespace art -#endif // ART_SRC_SIGNAL_SET_H_ +#endif // ART_RUNTIME_SIGNAL_SET_H_ diff --git a/runtime/sirt_ref.h b/runtime/sirt_ref.h index 12f8326347..81f0dff217 100644 --- a/runtime/sirt_ref.h +++ b/runtime/sirt_ref.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_SIRT_REF_H_ -#define ART_SRC_SIRT_REF_H_ +#ifndef ART_RUNTIME_SIRT_REF_H_ +#define ART_RUNTIME_SIRT_REF_H_ #include "base/logging.h" #include "base/macros.h" @@ -52,4 +52,4 @@ class SirtRef { } // namespace art -#endif // ART_SRC_SIRT_REF_H_ +#endif // ART_RUNTIME_SIRT_REF_H_ diff --git a/runtime/stack.h b/runtime/stack.h index fbfacb1733..0e2c4c5b86 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_STACK_H_ -#define ART_SRC_STACK_H_ +#ifndef ART_RUNTIME_STACK_H_ +#define ART_RUNTIME_STACK_H_ #include "dex_file.h" #include "instrumentation.h" @@ -644,4 +644,4 @@ class VmapTable { } // namespace art -#endif // ART_SRC_STACK_H_ +#endif // ART_RUNTIME_STACK_H_ diff --git a/runtime/stack_indirect_reference_table.h b/runtime/stack_indirect_reference_table.h index dd106344de..4c9b038423 100644 --- a/runtime/stack_indirect_reference_table.h +++ b/runtime/stack_indirect_reference_table.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_STACK_INDIRECT_REFERENCE_TABLE_H_ -#define ART_SRC_STACK_INDIRECT_REFERENCE_TABLE_H_ +#ifndef ART_RUNTIME_STACK_INDIRECT_REFERENCE_TABLE_H_ +#define ART_RUNTIME_STACK_INDIRECT_REFERENCE_TABLE_H_ #include "base/logging.h" #include "base/macros.h" @@ -96,4 +96,4 @@ class StackIndirectReferenceTable { } // namespace art -#endif // ART_SRC_STACK_INDIRECT_REFERENCE_TABLE_H_ +#endif // ART_RUNTIME_STACK_INDIRECT_REFERENCE_TABLE_H_ diff --git a/runtime/strutil.h b/runtime/strutil.h index b8769183da..c8d39e2311 100644 --- a/runtime/strutil.h +++ b/runtime/strutil.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_STRUTIL_H_ -#define ART_SRC_STRUTIL_H_ +#ifndef ART_RUNTIME_STRUTIL_H_ +#define ART_RUNTIME_STRUTIL_H_ #include @@ -37,4 +37,4 @@ struct CStringEq { } // namespace art -#endif // ART_SRC_STRUTIL_H_ +#endif // ART_RUNTIME_STRUTIL_H_ diff --git a/runtime/thread-inl.h b/runtime/thread-inl.h index 2fc5987306..c22f2cd921 100644 --- a/runtime/thread-inl.h +++ b/runtime/thread-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_THREAD_INL_H_ -#define ART_SRC_THREAD_INL_H_ +#ifndef ART_RUNTIME_THREAD_INL_H_ +#define ART_RUNTIME_THREAD_INL_H_ #include "thread.h" @@ -133,4 +133,4 @@ inline void Thread::VerifyStack() { } // namespace art -#endif // ART_SRC_THREAD_INL_H_ +#endif // ART_RUNTIME_THREAD_INL_H_ diff --git a/runtime/thread.h b/runtime/thread.h index 0daf763359..64ff7c22fa 100644 --- a/runtime/thread.h +++ b/runtime/thread.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_THREAD_H_ -#define ART_SRC_THREAD_H_ +#ifndef ART_RUNTIME_THREAD_H_ +#define ART_RUNTIME_THREAD_H_ #include @@ -788,4 +788,4 @@ std::ostream& operator<<(std::ostream& os, const ThreadState& state); } // namespace art -#endif // ART_SRC_THREAD_H_ +#endif // ART_RUNTIME_THREAD_H_ diff --git a/runtime/thread_list.h b/runtime/thread_list.h index 0470cfc3b9..87abbda479 100644 --- a/runtime/thread_list.h +++ b/runtime/thread_list.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_THREAD_LIST_H_ -#define ART_SRC_THREAD_LIST_H_ +#ifndef ART_RUNTIME_THREAD_LIST_H_ +#define ART_RUNTIME_THREAD_LIST_H_ #include "base/mutex.h" #include "root_visitor.h" @@ -144,4 +144,4 @@ class ThreadList { } // namespace art -#endif // ART_SRC_THREAD_LIST_H_ +#endif // ART_RUNTIME_THREAD_LIST_H_ diff --git a/runtime/thread_pool.h b/runtime/thread_pool.h index 814e654ad7..3462d5efbb 100644 --- a/runtime/thread_pool.h +++ b/runtime/thread_pool.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_THREAD_POOL_H_ -#define ART_SRC_THREAD_POOL_H_ +#ifndef ART_RUNTIME_THREAD_POOL_H_ +#define ART_RUNTIME_THREAD_POOL_H_ #include #include @@ -177,4 +177,4 @@ class WorkStealingThreadPool : public ThreadPool { } // namespace art -#endif // ART_SRC_THREAD_POOL_H_ +#endif // ART_RUNTIME_THREAD_POOL_H_ diff --git a/runtime/thread_state.h b/runtime/thread_state.h index 52f092efa0..fc4812a427 100644 --- a/runtime/thread_state.h +++ b/runtime/thread_state.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_THREAD_STATE_H_ -#define ART_SRC_THREAD_STATE_H_ +#ifndef ART_RUNTIME_THREAD_STATE_H_ +#define ART_RUNTIME_THREAD_STATE_H_ namespace art { @@ -44,4 +44,4 @@ enum ThreadState { } // namespace art -#endif // ART_SRC_THREAD_STATE_H_ +#endif // ART_RUNTIME_THREAD_STATE_H_ diff --git a/runtime/throw_location.h b/runtime/throw_location.h index 8c1b9410af..b2cd4d5803 100644 --- a/runtime/throw_location.h +++ b/runtime/throw_location.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_THROW_LOCATION_H_ -#define ART_SRC_THROW_LOCATION_H_ +#ifndef ART_RUNTIME_THROW_LOCATION_H_ +#define ART_RUNTIME_THROW_LOCATION_H_ #include "base/macros.h" #include "root_visitor.h" @@ -75,4 +75,4 @@ class PACKED(4) ThrowLocation { } // namespace art -#endif // ART_SRC_THROW_LOCATION_H_ +#endif // ART_RUNTIME_THROW_LOCATION_H_ diff --git a/runtime/trace.h b/runtime/trace.h index 9432e718ff..5bd6a8d5ca 100644 --- a/runtime/trace.h +++ b/runtime/trace.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_TRACE_H_ -#define ART_SRC_TRACE_H_ +#ifndef ART_RUNTIME_TRACE_H_ +#define ART_RUNTIME_TRACE_H_ #include #include @@ -129,4 +129,4 @@ class Trace : public instrumentation::InstrumentationListener { } // namespace art -#endif // ART_SRC_TRACE_H_ +#endif // ART_RUNTIME_TRACE_H_ diff --git a/runtime/utf.h b/runtime/utf.h index 57c811f21d..4c9a1d959e 100644 --- a/runtime/utf.h +++ b/runtime/utf.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_UTF_H_ -#define ART_SRC_UTF_H_ +#ifndef ART_RUNTIME_UTF_H_ +#define ART_RUNTIME_UTF_H_ #include "base/macros.h" @@ -94,4 +94,4 @@ uint16_t GetUtf16FromUtf8(const char** utf8_data_in); } // namespace art -#endif // ART_SRC_UTF_H_ +#endif // ART_RUNTIME_UTF_H_ diff --git a/runtime/utils.h b/runtime/utils.h index e5028bae86..a08e46524b 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_UTILS_H_ -#define ART_SRC_UTILS_H_ +#ifndef ART_RUNTIME_UTILS_H_ +#define ART_RUNTIME_UTILS_H_ #include @@ -372,4 +372,4 @@ class VoidFunctor { } // namespace art -#endif // ART_SRC_UTILS_H_ +#endif // ART_RUNTIME_UTILS_H_ diff --git a/runtime/vector_output_stream.h b/runtime/vector_output_stream.h index 3546c8d577..7daa39ffa5 100644 --- a/runtime/vector_output_stream.h +++ b/runtime/vector_output_stream.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VECTOR_OUTPUT_STREAM_H_ -#define ART_SRC_VECTOR_OUTPUT_STREAM_H_ +#ifndef ART_RUNTIME_VECTOR_OUTPUT_STREAM_H_ +#define ART_RUNTIME_VECTOR_OUTPUT_STREAM_H_ #include "output_stream.h" @@ -62,4 +62,4 @@ class VectorOutputStream : public OutputStream { } // namespace art -#endif // ART_SRC_VECTOR_OUTPUT_STREAM_H_ +#endif // ART_RUNTIME_VECTOR_OUTPUT_STREAM_H_ diff --git a/runtime/verifier/dex_gc_map.h b/runtime/verifier/dex_gc_map.h index 673112b213..be7415e1d6 100644 --- a/runtime/verifier/dex_gc_map.h +++ b/runtime/verifier/dex_gc_map.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_DEX_GC_MAP_H_ -#define ART_SRC_VERIFIER_DEX_GC_MAP_H_ +#ifndef ART_RUNTIME_VERIFIER_DEX_GC_MAP_H_ +#define ART_RUNTIME_VERIFIER_DEX_GC_MAP_H_ #include @@ -119,4 +119,4 @@ class DexPcToReferenceMap { } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_DEX_GC_MAP_H_ +#endif // ART_RUNTIME_VERIFIER_DEX_GC_MAP_H_ diff --git a/runtime/verifier/instruction_flags.h b/runtime/verifier/instruction_flags.h index 9dc3ea7a7c..df89beecfb 100644 --- a/runtime/verifier/instruction_flags.h +++ b/runtime/verifier/instruction_flags.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_METHOD_INSTRUCTION_FLAGS_H_ -#define ART_SRC_VERIFIER_METHOD_INSTRUCTION_FLAGS_H_ +#ifndef ART_RUNTIME_VERIFIER_INSTRUCTION_FLAGS_H_ +#define ART_RUNTIME_VERIFIER_INSTRUCTION_FLAGS_H_ #include "base/logging.h" @@ -113,4 +113,4 @@ class InstructionFlags { } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_METHOD_INSTRUCTION_FLAGS_H_ +#endif // ART_RUNTIME_VERIFIER_INSTRUCTION_FLAGS_H_ diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index ac0de9e1f7..57d630de5a 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_METHOD_VERIFIER_H_ -#define ART_SRC_VERIFIER_METHOD_VERIFIER_H_ +#ifndef ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_ +#define ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_ #include #include @@ -723,4 +723,4 @@ std::ostream& operator<<(std::ostream& os, const MethodVerifier::FailureKind& rh } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_METHOD_VERIFIER_H_ +#endif // ART_RUNTIME_VERIFIER_METHOD_VERIFIER_H_ diff --git a/runtime/verifier/reg_type.h b/runtime/verifier/reg_type.h index 9ac0ecac8a..1553f1e554 100644 --- a/runtime/verifier/reg_type.h +++ b/runtime/verifier/reg_type.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_REG_TYPE_H_ -#define ART_SRC_VERIFIER_REG_TYPE_H_ +#ifndef ART_RUNTIME_VERIFIER_REG_TYPE_H_ +#define ART_RUNTIME_VERIFIER_REG_TYPE_H_ #include "base/macros.h" #include "globals.h" @@ -922,4 +922,4 @@ std::ostream& operator<<(std::ostream& os, const RegType& rhs) } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_REG_TYPE_H_ +#endif // ART_RUNTIME_VERIFIER_REG_TYPE_H_ diff --git a/runtime/verifier/reg_type_cache-inl.h b/runtime/verifier/reg_type_cache-inl.h index 42474d1849..295e27198d 100644 --- a/runtime/verifier/reg_type_cache-inl.h +++ b/runtime/verifier/reg_type_cache-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_REG_TYPE_CACHE_INL_H_ -#define ART_SRC_VERIFIER_REG_TYPE_CACHE_INL_H_ +#ifndef ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_INL_H_ +#define ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_INL_H_ #include "reg_type.h" #include "reg_type_cache.h" @@ -43,4 +43,4 @@ inline const art::verifier::RegType& RegTypeCache::GetFromId(uint16_t id) const } } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_REG_TYPE_CACHE_INL_H_ +#endif // ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_INL_H_ diff --git a/runtime/verifier/reg_type_cache.h b/runtime/verifier/reg_type_cache.h index d70123c2de..814dff79f6 100644 --- a/runtime/verifier/reg_type_cache.h +++ b/runtime/verifier/reg_type_cache.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_REG_TYPE_CACHE_H_ -#define ART_SRC_VERIFIER_REG_TYPE_CACHE_H_ +#ifndef ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_H_ +#define ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_H_ #include "base/casts.h" #include "base/macros.h" @@ -163,4 +163,4 @@ class RegTypeCache { } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_REG_TYPE_CACHE_H_ +#endif // ART_RUNTIME_VERIFIER_REG_TYPE_CACHE_H_ diff --git a/runtime/verifier/register_line-inl.h b/runtime/verifier/register_line-inl.h index 157e136cc1..b3a28470db 100644 --- a/runtime/verifier/register_line-inl.h +++ b/runtime/verifier/register_line-inl.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_REGISTER_LINE_INL_H_ -#define ART_SRC_VERIFIER_REGISTER_LINE_INL_H_ +#ifndef ART_RUNTIME_VERIFIER_REGISTER_LINE_INL_H_ +#define ART_RUNTIME_VERIFIER_REGISTER_LINE_INL_H_ #include "register_line.h" #include "method_verifier.h" @@ -32,4 +32,4 @@ inline const RegType& RegisterLine::GetRegisterType(uint32_t vsrc) const { } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_REGISTER_LINE_INL_H_ +#endif // ART_RUNTIME_VERIFIER_REGISTER_LINE_INL_H_ diff --git a/runtime/verifier/register_line.h b/runtime/verifier/register_line.h index 5f17049e8e..cde7b9b0be 100644 --- a/runtime/verifier/register_line.h +++ b/runtime/verifier/register_line.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_VERIFIER_REGISTER_LINE_H_ -#define ART_SRC_VERIFIER_REGISTER_LINE_H_ +#ifndef ART_RUNTIME_VERIFIER_REGISTER_LINE_H_ +#define ART_RUNTIME_VERIFIER_REGISTER_LINE_H_ #include #include @@ -355,4 +355,4 @@ std::ostream& operator<<(std::ostream& os, const RegisterLine& rhs); } // namespace verifier } // namespace art -#endif // ART_SRC_VERIFIER_REGISTER_LINE_H_ +#endif // ART_RUNTIME_VERIFIER_REGISTER_LINE_H_ diff --git a/runtime/well_known_classes.h b/runtime/well_known_classes.h index 8170520d45..a8069bc9cb 100644 --- a/runtime/well_known_classes.h +++ b/runtime/well_known_classes.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_WELL_KNOWN_CLASSES_H_ -#define ART_SRC_WELL_KNOWN_CLASSES_H_ +#ifndef ART_RUNTIME_WELL_KNOWN_CLASSES_H_ +#define ART_RUNTIME_WELL_KNOWN_CLASSES_H_ #include "base/mutex.h" #include "jni.h" @@ -104,4 +104,4 @@ struct WellKnownClasses { } // namespace art -#endif // ART_SRC_WELL_KNOWN_CLASSES_H_ +#endif // ART_RUNTIME_WELL_KNOWN_CLASSES_H_ diff --git a/runtime/zip_archive.h b/runtime/zip_archive.h index ef3148696e..d648517aae 100644 --- a/runtime/zip_archive.h +++ b/runtime/zip_archive.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ART_SRC_ZIP_ARCHIVE_H_ -#define ART_SRC_ZIP_ARCHIVE_H_ +#ifndef ART_RUNTIME_ZIP_ARCHIVE_H_ +#define ART_RUNTIME_ZIP_ARCHIVE_H_ #include #include @@ -129,4 +129,4 @@ class ZipArchive { } // namespace art -#endif // ART_SRC_ZIP_ARCHIVE_H_ +#endif // ART_RUNTIME_ZIP_ARCHIVE_H_ diff --git a/tools/cpplint.py b/tools/cpplint.py index ff92d70f06..30c712856e 100755 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -726,7 +726,11 @@ class FileInfo: os.path.exists(os.path.join(root_dir, ".hg")) or os.path.exists(os.path.join(root_dir, ".svn"))): prefix = os.path.commonprefix([root_dir, project_dir]) - return fullname[len(prefix) + 1:] + # BEGIN android-changed + # return fullname[len(prefix) + 1:] + return "art/" + fullname[len(prefix) + 1:] + # END android-changed + # Don't know what to do; header guard warnings may be wrong... return fullname @@ -1032,7 +1036,6 @@ def GetHeaderGuardCPPVariable(filename): # Restores original filename in case that cpplint is invoked from Emacs's # flymake. filename = re.sub(r'_flymake\.h$', '.h', filename) - fileinfo = FileInfo(filename) return re.sub(r'[-./\s]', '_', fileinfo.RepositoryName()).upper() + '_' -- cgit v1.2.3-59-g8ed1b From 08bf1967611965b65ffd5de1aa603b60e7b2d6a8 Mon Sep 17 00:00:00 2001 From: Dragos Sbirlea Date: Mon, 12 Aug 2013 08:53:04 -0700 Subject: Work on SMALL_ART and PORTABLE working at the same time. Change-Id: Iddedf63b6f9d908717a4d30f963e9b81a9604d49 --- oatdump/oatdump.cc | 4 +- runtime/Android.mk | 3 +- runtime/arch/arm/entrypoints_init_arm.cc | 4 +- runtime/arch/arm/portable_entrypoints_arm.S | 74 +++- runtime/arch/mips/entrypoints_init_mips.cc | 4 +- runtime/arch/x86/entrypoints_init_x86.cc | 4 +- runtime/class_linker.cc | 6 +- .../interpreter/interpreter_entrypoints.cc | 10 +- .../portable/portable_argument_visitor.h | 136 ------- .../portable/portable_proxy_entrypoints.cc | 109 ------ .../portable/portable_stub_entrypoints.cc | 145 ------- .../portable/portable_trampoline_entrypoints.cc | 433 +++++++++++++++++++++ runtime/invoke_arg_array_builder.h | 34 +- runtime/verifier/method_verifier.cc | 6 +- 14 files changed, 557 insertions(+), 415 deletions(-) delete mode 100644 runtime/entrypoints/portable/portable_argument_visitor.h delete mode 100644 runtime/entrypoints/portable/portable_proxy_entrypoints.cc delete mode 100644 runtime/entrypoints/portable/portable_stub_entrypoints.cc create mode 100644 runtime/entrypoints/portable/portable_trampoline_entrypoints.cc (limited to 'runtime/invoke_arg_array_builder.h') diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index a717f192b9..a6f295f46d 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -990,7 +990,9 @@ class ImageDumper { DCHECK(method->GetNativeGcMap() == NULL) << PrettyMethod(method); DCHECK(method->GetMappingTable() == NULL) << PrettyMethod(method); } else { - CHECK((method->GetEntryPointFromCompiledCode() == NULL) || (method->GetNativeGcMap() != NULL)); + // TODO: we check there is a GC map here, we may not have a GC map if the code is pointing + // to the quick/portable to interpreter bridge. + CHECK(method->GetNativeGcMap() != NULL) << PrettyMethod(method); const DexFile::CodeItem* code_item = MethodHelper(method).GetCodeItem(); size_t dex_instruction_bytes = code_item->insns_size_in_code_units_ * 2; diff --git a/runtime/Android.mk b/runtime/Android.mk index 4f25c00546..69e13e58f5 100644 --- a/runtime/Android.mk +++ b/runtime/Android.mk @@ -153,10 +153,9 @@ LIBART_COMMON_SRC_FILES += \ entrypoints/portable/portable_invoke_entrypoints.cc \ entrypoints/portable/portable_jni_entrypoints.cc \ entrypoints/portable/portable_lock_entrypoints.cc \ - entrypoints/portable/portable_proxy_entrypoints.cc \ - entrypoints/portable/portable_stub_entrypoints.cc \ entrypoints/portable/portable_thread_entrypoints.cc \ entrypoints/portable/portable_throw_entrypoints.cc \ + entrypoints/portable/portable_trampoline_entrypoints.cc \ entrypoints/quick/quick_alloc_entrypoints.cc \ entrypoints/quick/quick_cast_entrypoints.cc \ entrypoints/quick/quick_deoptimization_entrypoints.cc \ diff --git a/runtime/arch/arm/entrypoints_init_arm.cc b/runtime/arch/arm/entrypoints_init_arm.cc index 848bacca52..810a6832b6 100644 --- a/runtime/arch/arm/entrypoints_init_arm.cc +++ b/runtime/arch/arm/entrypoints_init_arm.cc @@ -26,7 +26,7 @@ namespace art { extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); -extern "C" void artInterperterToCompiledCodeBridge(Thread* self, MethodHelper& mh, +extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); @@ -137,7 +137,7 @@ void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) { // Interpreter ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterperterToCompiledCodeBridge; + ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/arch/arm/portable_entrypoints_arm.S b/runtime/arch/arm/portable_entrypoints_arm.S index adfd22b331..f21ae28164 100644 --- a/runtime/arch/arm/portable_entrypoints_arm.S +++ b/runtime/arch/arm/portable_entrypoints_arm.S @@ -31,7 +31,6 @@ ENTRY art_portable_invoke_stub push {r0, r4, r5, r9, r11, lr} @ spill regs .save {r0, r4, r5, r9, r11, lr} - .pad #24 .cfi_adjust_cfa_offset 24 .cfi_rel_offset r0, 0 .cfi_rel_offset r4, 4 @@ -41,6 +40,7 @@ ENTRY art_portable_invoke_stub .cfi_rel_offset lr, 20 mov r11, sp @ save the stack pointer .cfi_def_cfa_register r11 + @.movsp r11 mov r9, r3 @ move managed thread pointer into r9 mov r4, #SUSPEND_CHECK_INTERVAL @ reset r4 to suspend check interval add r5, r2, #16 @ create space for method pointer in frame @@ -97,5 +97,73 @@ ENTRY art_portable_proxy_invoke_handler bx lr @ return END art_portable_proxy_invoke_handler -UNIMPLEMENTED art_portable_resolution_trampoline -UNIMPLEMENTED art_portable_to_interpreter_bridge + .extern artPortableResolutionTrampoline +ENTRY art_portable_resolution_trampoline + @ Fake callee save ref and args frame set up, note portable doesn't use callee save frames. + @ TODO: just save the registers that are needed in artPortableResolutionTrampoline. + push {r1-r3, r5-r8, r10-r11, lr} @ 10 words of callee saves + .save {r1-r3, r5-r8, r10-r11, lr} + .cfi_adjust_cfa_offset 40 + .cfi_rel_offset r1, 0 + .cfi_rel_offset r2, 4 + .cfi_rel_offset r3, 8 + .cfi_rel_offset r5, 12 + .cfi_rel_offset r6, 16 + .cfi_rel_offset r7, 20 + .cfi_rel_offset r8, 24 + .cfi_rel_offset r10, 28 + .cfi_rel_offset r11, 32 + .cfi_rel_offset lr, 36 + sub sp, #8 @ 2 words of space, bottom word will hold Method* + .pad #8 + .cfi_adjust_cfa_offset 8 + mov r2, r9 @ pass Thread::Current + mov r3, sp @ pass SP + blx artPortableResolutionTrampoline @ (Method* called, receiver, Thread*, SP) + cmp r0, #0 @ is code pointer null? + beq 1f @ goto exception + mov r12, r0 + ldr r0, [sp, #0] @ load resolved method in r0 + ldr r1, [sp, #8] @ restore non-callee save r1 + ldrd r2, [sp, #12] @ restore non-callee saves r2-r3 + ldr lr, [sp, #44] @ restore lr + add sp, #48 @ rewind sp + .cfi_adjust_cfa_offset -48 + bx r12 @ tail-call into actual code +1: + ldr r1, [sp, #8] @ restore non-callee save r1 + ldrd r2, [sp, #12] @ restore non-callee saves r2-r3 + ldr lr, [sp, #44] @ restore lr + add sp, #48 @ rewind sp + .cfi_adjust_cfa_offset -48 + bx lr +END art_portable_resolution_trampoline + + .extern artPortableToInterpreterBridge +ENTRY art_portable_to_interpreter_bridge + @ Fake callee save ref and args frame set up, note portable doesn't use callee save frames. + @ TODO: just save the registers that are needed in artPortableToInterpreterBridge. + push {r1-r3, r5-r8, r10-r11, lr} @ 10 words of callee saves + .save {r1-r3, r5-r8, r10-r11, lr} + .cfi_adjust_cfa_offset 40 + .cfi_rel_offset r1, 0 + .cfi_rel_offset r2, 4 + .cfi_rel_offset r3, 8 + .cfi_rel_offset r5, 12 + .cfi_rel_offset r6, 16 + .cfi_rel_offset r7, 20 + .cfi_rel_offset r8, 24 + .cfi_rel_offset r10, 28 + .cfi_rel_offset r11, 32 + .cfi_rel_offset lr, 36 + sub sp, #8 @ 2 words of space, bottom word will hold Method* + .pad #8 + .cfi_adjust_cfa_offset 8 + mov r1, r9 @ pass Thread::Current + mov r2, sp @ pass SP + blx artPortableToInterpreterBridge @ (Method* method, Thread*, SP) + ldr lr, [sp, #44] @ restore lr + add sp, #48 @ pop frame + .cfi_adjust_cfa_offset -48 + bx lr @ return +END art_portable_to_interpreter_bridge diff --git a/runtime/arch/mips/entrypoints_init_mips.cc b/runtime/arch/mips/entrypoints_init_mips.cc index a18079b628..a0d3995bce 100644 --- a/runtime/arch/mips/entrypoints_init_mips.cc +++ b/runtime/arch/mips/entrypoints_init_mips.cc @@ -25,7 +25,7 @@ namespace art { extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); -extern "C" void artInterperterToCompiledCodeBridge(Thread* self, MethodHelper& mh, +extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); @@ -138,7 +138,7 @@ void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) { // Interpreter ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterperterToCompiledCodeBridge; + ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/arch/x86/entrypoints_init_x86.cc b/runtime/arch/x86/entrypoints_init_x86.cc index 91526741cf..9b54d55bfc 100644 --- a/runtime/arch/x86/entrypoints_init_x86.cc +++ b/runtime/arch/x86/entrypoints_init_x86.cc @@ -24,7 +24,7 @@ namespace art { extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); -extern "C" void artInterperterToCompiledCodeBridge(Thread* self, MethodHelper& mh, +extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); @@ -120,7 +120,7 @@ void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) { // Interpreter ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; - ipoints->pInterpreterToCompiledCodeBridge = artInterperterToCompiledCodeBridge; + ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; // JNI jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 71959c66ab..c7a8f7e3d4 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -71,7 +71,7 @@ namespace art { -extern "C" void artInterperterToCompiledCodeBridge(Thread* self, MethodHelper& mh, +extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); @@ -1649,7 +1649,7 @@ static void LinkCode(SirtRef& method, const OatFile::Oat if (enter_interpreter) { method->SetEntryPointFromInterpreter(interpreter::artInterpreterToInterpreterBridge); } else { - method->SetEntryPointFromInterpreter(artInterperterToCompiledCodeBridge); + method->SetEntryPointFromInterpreter(artInterpreterToCompiledCodeBridge); } if (method->IsAbstract()) { @@ -2633,7 +2633,7 @@ mirror::AbstractMethod* ClassLinker::CreateProxyMethod(Thread* self, SirtRefSetFpSpillMask(refs_and_args->GetFpSpillMask()); method->SetFrameSizeInBytes(refs_and_args->GetFrameSizeInBytes()); method->SetEntryPointFromCompiledCode(GetProxyInvokeHandler()); - method->SetEntryPointFromInterpreter(artInterperterToCompiledCodeBridge); + method->SetEntryPointFromInterpreter(artInterpreterToCompiledCodeBridge); return method; } diff --git a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc index d99c43e052..67f6d98493 100644 --- a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc +++ b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc @@ -25,7 +25,7 @@ namespace art { -extern "C" void artInterperterToCompiledCodeBridge(Thread* self, MethodHelper& mh, +extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -35,9 +35,15 @@ extern "C" void artInterperterToCompiledCodeBridge(Thread* self, MethodHelper& m Runtime::Current()->GetClassLinker()->EnsureInitialized(method->GetDeclaringClass(), true, true); } uint16_t arg_offset = (code_item == NULL) ? 0 : code_item->registers_size_ - code_item->ins_size_; +#if defined(ART_USE_PORTABLE_COMPILER) ArgArray arg_array(mh.GetShorty(), mh.GetShortyLength()); - arg_array.BuildArgArray(shadow_frame, arg_offset); + arg_array.BuildArgArrayFromFrame(shadow_frame, arg_offset); method->Invoke(self, arg_array.GetArray(), arg_array.GetNumBytes(), result, mh.GetShorty()[0]); +#else + method->Invoke(self, shadow_frame->GetVRegArgs(arg_offset), + (shadow_frame->NumberOfVRegs() - arg_offset) * 4, + result, mh.GetShorty()[0]); +#endif } } // namespace art diff --git a/runtime/entrypoints/portable/portable_argument_visitor.h b/runtime/entrypoints/portable/portable_argument_visitor.h deleted file mode 100644 index f268baf790..0000000000 --- a/runtime/entrypoints/portable/portable_argument_visitor.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2013 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_ENTRYPOINTS_PORTABLE_PORTABLE_ARGUMENT_VISITOR_H_ -#define ART_RUNTIME_ENTRYPOINTS_PORTABLE_PORTABLE_ARGUMENT_VISITOR_H_ - -#include "object_utils.h" - -namespace art { - -// Visits the arguments as saved to the stack by a Runtime::kRefAndArgs callee save frame. -class PortableArgumentVisitor { - public: -// Offset to first (not the Method*) argument in a Runtime::kRefAndArgs callee save frame. -// Size of Runtime::kRefAndArgs callee save frame. -// Size of Method* and register parameters in out stack arguments. -#if defined(__arm__) -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 8 -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 48 -#define PORTABLE_STACK_ARG_SKIP 0 -#elif defined(__mips__) -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 4 -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 64 -#define PORTABLE_STACK_ARG_SKIP 16 -#elif defined(__i386__) -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 4 -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 32 -#define PORTABLE_STACK_ARG_SKIP 4 -#else -#error "Unsupported architecture" -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 0 -#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 0 -#define PORTABLE_STACK_ARG_SKIP 0 -#endif - - PortableArgumentVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : - caller_mh_(caller_mh), - args_in_regs_(ComputeArgsInRegs(caller_mh)), - num_params_(caller_mh.NumArgs()), - reg_args_(reinterpret_cast(sp) + PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET), - stack_args_(reinterpret_cast(sp) + PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE - + PORTABLE_STACK_ARG_SKIP), - cur_args_(reg_args_), - cur_arg_index_(0), - param_index_(0) { - } - - virtual ~PortableArgumentVisitor() {} - - virtual void Visit() = 0; - - bool IsParamAReference() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - return caller_mh_.IsParamAReference(param_index_); - } - - bool IsParamALongOrDouble() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - return caller_mh_.IsParamALongOrDouble(param_index_); - } - - Primitive::Type GetParamPrimitiveType() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - return caller_mh_.GetParamPrimitiveType(param_index_); - } - - byte* GetParamAddress() const { - return cur_args_ + (cur_arg_index_ * kPointerSize); - } - - void VisitArguments() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - for (cur_arg_index_ = 0; cur_arg_index_ < args_in_regs_ && param_index_ < num_params_; ) { -#if (defined(__arm__) || defined(__mips__)) - if (IsParamALongOrDouble() && cur_arg_index_ == 2) { - break; - } -#endif - Visit(); - cur_arg_index_ += (IsParamALongOrDouble() ? 2 : 1); - param_index_++; - } - cur_args_ = stack_args_; - cur_arg_index_ = 0; - while (param_index_ < num_params_) { -#if (defined(__arm__) || defined(__mips__)) - if (IsParamALongOrDouble() && cur_arg_index_ % 2 != 0) { - cur_arg_index_++; - } -#endif - Visit(); - cur_arg_index_ += (IsParamALongOrDouble() ? 2 : 1); - param_index_++; - } - } - - private: - static size_t ComputeArgsInRegs(MethodHelper& mh) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { -#if (defined(__i386__)) - return 0; -#else - size_t args_in_regs = 0; - size_t num_params = mh.NumArgs(); - for (size_t i = 0; i < num_params; i++) { - args_in_regs = args_in_regs + (mh.IsParamALongOrDouble(i) ? 2 : 1); - if (args_in_regs > 3) { - args_in_regs = 3; - break; - } - } - return args_in_regs; -#endif - } - MethodHelper& caller_mh_; - const size_t args_in_regs_; - const size_t num_params_; - byte* const reg_args_; - byte* const stack_args_; - byte* cur_args_; - size_t cur_arg_index_; - size_t param_index_; -}; - -} // namespace art - -#endif // ART_RUNTIME_ENTRYPOINTS_PORTABLE_PORTABLE_ARGUMENT_VISITOR_H_ diff --git a/runtime/entrypoints/portable/portable_proxy_entrypoints.cc b/runtime/entrypoints/portable/portable_proxy_entrypoints.cc deleted file mode 100644 index 3db39cd0bd..0000000000 --- a/runtime/entrypoints/portable/portable_proxy_entrypoints.cc +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2012 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 "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" -#include "mirror/object-inl.h" -#include "portable_argument_visitor.h" -#include "scoped_thread_state_change.h" - -namespace art { - -// Visits arguments on the stack placing them into the args vector, Object* arguments are converted -// to jobjects. -class BuildPortableArgumentVisitor : public PortableArgumentVisitor { - public: - BuildPortableArgumentVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp, - ScopedObjectAccessUnchecked& soa, std::vector& args) : - PortableArgumentVisitor(caller_mh, sp), soa_(soa), args_(args) {} - - virtual void Visit() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - jvalue val; - Primitive::Type type = GetParamPrimitiveType(); - switch (type) { - case Primitive::kPrimNot: { - mirror::Object* obj = *reinterpret_cast(GetParamAddress()); - val.l = soa_.AddLocalReference(obj); - break; - } - case Primitive::kPrimLong: // Fall-through. - case Primitive::kPrimDouble: - val.j = *reinterpret_cast(GetParamAddress()); - break; - case Primitive::kPrimBoolean: // Fall-through. - case Primitive::kPrimByte: // Fall-through. - case Primitive::kPrimChar: // Fall-through. - case Primitive::kPrimShort: // Fall-through. - case Primitive::kPrimInt: // Fall-through. - case Primitive::kPrimFloat: - val.i = *reinterpret_cast(GetParamAddress()); - break; - case Primitive::kPrimVoid: - LOG(FATAL) << "UNREACHABLE"; - val.j = 0; - break; - } - args_.push_back(val); - } - - private: - ScopedObjectAccessUnchecked& soa_; - std::vector& args_; - - DISALLOW_COPY_AND_ASSIGN(BuildPortableArgumentVisitor); -}; - -// Handler for invocation on proxy methods. On entry a frame will exist for the proxy object method -// which is responsible for recording callee save registers. We explicitly place into jobjects the -// incoming reference arguments (so they survive GC). We invoke the invocation handler, which is a -// field within the proxy object, which will box the primitive arguments and deal with error cases. -extern "C" uint64_t artPortableProxyInvokeHandler(mirror::AbstractMethod* proxy_method, - mirror::Object* receiver, - Thread* self, mirror::AbstractMethod** sp) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - // Ensure we don't get thread suspension until the object arguments are safely in jobjects. - const char* old_cause = - self->StartAssertNoThreadSuspension("Adding to IRT proxy object arguments"); - self->VerifyStack(); - // Start new JNI local reference state. - JNIEnvExt* env = self->GetJniEnv(); - ScopedObjectAccessUnchecked soa(env); - ScopedJniEnvLocalRefState env_state(env); - // Create local ref. copies of proxy method and the receiver. - jobject rcvr_jobj = soa.AddLocalReference(receiver); - - // Placing arguments into args vector and remove the receiver. - MethodHelper proxy_mh(proxy_method); - std::vector args; - BuildPortableArgumentVisitor local_ref_visitor(proxy_mh, sp, soa, args); - local_ref_visitor.VisitArguments(); - args.erase(args.begin()); - - // Convert proxy method into expected interface method. - mirror::AbstractMethod* interface_method = proxy_method->FindOverriddenMethod(); - DCHECK(interface_method != NULL); - DCHECK(!interface_method->IsProxyMethod()) << PrettyMethod(interface_method); - jobject interface_method_jobj = soa.AddLocalReference(interface_method); - - // All naked Object*s should now be in jobjects, so its safe to go into the main invoke code - // that performs allocations. - self->EndAssertNoThreadSuspension(old_cause); - JValue result = InvokeProxyInvocationHandler(soa, proxy_mh.GetShorty(), - rcvr_jobj, interface_method_jobj, args); - return result.GetJ(); -} - -} // namespace art diff --git a/runtime/entrypoints/portable/portable_stub_entrypoints.cc b/runtime/entrypoints/portable/portable_stub_entrypoints.cc deleted file mode 100644 index c510c653ba..0000000000 --- a/runtime/entrypoints/portable/portable_stub_entrypoints.cc +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2012 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 "dex_instruction-inl.h" -#include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" -#include "mirror/object-inl.h" - -namespace art { - -// Lazily resolve a method for portable. Called by stub code. -extern "C" const void* artPortableResolutionTrampoline(mirror::AbstractMethod* called, - mirror::Object* receiver, - mirror::AbstractMethod** called_addr, - Thread* thread) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - uint32_t dex_pc; - mirror::AbstractMethod* caller = thread->GetCurrentMethod(&dex_pc); - - ClassLinker* linker = Runtime::Current()->GetClassLinker(); - InvokeType invoke_type; - bool is_range; - if (called->IsRuntimeMethod()) { - const DexFile::CodeItem* code = MethodHelper(caller).GetCodeItem(); - CHECK_LT(dex_pc, code->insns_size_in_code_units_); - const Instruction* instr = Instruction::At(&code->insns_[dex_pc]); - Instruction::Code instr_code = instr->Opcode(); - switch (instr_code) { - case Instruction::INVOKE_DIRECT: - invoke_type = kDirect; - is_range = false; - break; - case Instruction::INVOKE_DIRECT_RANGE: - invoke_type = kDirect; - is_range = true; - break; - case Instruction::INVOKE_STATIC: - invoke_type = kStatic; - is_range = false; - break; - case Instruction::INVOKE_STATIC_RANGE: - invoke_type = kStatic; - is_range = true; - break; - case Instruction::INVOKE_SUPER: - invoke_type = kSuper; - is_range = false; - break; - case Instruction::INVOKE_SUPER_RANGE: - invoke_type = kSuper; - is_range = true; - break; - case Instruction::INVOKE_VIRTUAL: - invoke_type = kVirtual; - is_range = false; - break; - case Instruction::INVOKE_VIRTUAL_RANGE: - invoke_type = kVirtual; - is_range = true; - break; - case Instruction::INVOKE_INTERFACE: - invoke_type = kInterface; - is_range = false; - break; - case Instruction::INVOKE_INTERFACE_RANGE: - invoke_type = kInterface; - is_range = true; - break; - default: - LOG(FATAL) << "Unexpected call into trampoline: " << instr->DumpString(NULL); - // Avoid used uninitialized warnings. - invoke_type = kDirect; - is_range = true; - } - uint32_t dex_method_idx = (is_range) ? instr->VRegB_3rc() : instr->VRegB_35c(); - called = linker->ResolveMethod(dex_method_idx, caller, invoke_type); - // Refine called method based on receiver. - if (invoke_type == kVirtual) { - called = receiver->GetClass()->FindVirtualMethodForVirtual(called); - } else if (invoke_type == kInterface) { - called = receiver->GetClass()->FindVirtualMethodForInterface(called); - } - } else { - CHECK(called->IsStatic()) << PrettyMethod(called); - invoke_type = kStatic; - } - const void* code = NULL; - if (LIKELY(!thread->IsExceptionPending())) { - // Incompatible class change should have been handled in resolve method. - CHECK(!called->CheckIncompatibleClassChange(invoke_type)); - // Ensure that the called method's class is initialized. - mirror::Class* called_class = called->GetDeclaringClass(); - linker->EnsureInitialized(called_class, true, true); - if (LIKELY(called_class->IsInitialized())) { - code = called->GetEntryPointFromCompiledCode(); - // TODO: remove this after we solve the link issue. - { // for lazy link. - if (code == NULL) { - code = linker->GetOatCodeFor(called); - } - } - } else if (called_class->IsInitializing()) { - if (invoke_type == kStatic) { - // Class is still initializing, go to oat and grab code (trampoline must be left in place - // until class is initialized to stop races between threads). - code = linker->GetOatCodeFor(called); - } else { - // No trampoline for non-static methods. - code = called->GetEntryPointFromCompiledCode(); - // TODO: remove this after we solve the link issue. - { // for lazy link. - if (code == NULL) { - code = linker->GetOatCodeFor(called); - } - } - } - } else { - DCHECK(called_class->IsErroneous()); - } - } - if (LIKELY(code != NULL)) { - // Expect class to at least be initializing. - DCHECK(called->GetDeclaringClass()->IsInitializing()); - // Don't want infinite recursion. - DCHECK(code != GetResolutionTrampoline(linker)); - // Set up entry into main method - *called_addr = called; - } - return code; -} - -} // namespace art diff --git a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc new file mode 100644 index 0000000000..c02ace88c1 --- /dev/null +++ b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc @@ -0,0 +1,433 @@ +/* + * Copyright (C) 2013 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_ENTRYPOINTS_PORTABLE_PORTABLE_ARGUMENT_VISITOR_H_ +#define ART_RUNTIME_ENTRYPOINTS_PORTABLE_PORTABLE_ARGUMENT_VISITOR_H_ + +#include "dex_instruction-inl.h" +#include "entrypoints/entrypoint_utils.h" +#include "interpreter/interpreter.h" +#include "mirror/abstract_method-inl.h" +#include "mirror/object-inl.h" +#include "object_utils.h" +#include "scoped_thread_state_change.h" + +namespace art { + +// Visits the arguments as saved to the stack by a Runtime::kRefAndArgs callee save frame. +class PortableArgumentVisitor { + public: +// Offset to first (not the Method*) argument in a Runtime::kRefAndArgs callee save frame. +// Size of Runtime::kRefAndArgs callee save frame. +// Size of Method* and register parameters in out stack arguments. +#if defined(__arm__) +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 8 +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 48 +#define PORTABLE_STACK_ARG_SKIP 0 +#elif defined(__mips__) +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 4 +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 64 +#define PORTABLE_STACK_ARG_SKIP 16 +#elif defined(__i386__) +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 4 +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 32 +#define PORTABLE_STACK_ARG_SKIP 4 +#else +#error "Unsupported architecture" +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET 0 +#define PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE 0 +#define PORTABLE_STACK_ARG_SKIP 0 +#endif + + PortableArgumentVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : + caller_mh_(caller_mh), + args_in_regs_(ComputeArgsInRegs(caller_mh)), + num_params_(caller_mh.NumArgs()), + reg_args_(reinterpret_cast(sp) + PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__R1_OFFSET), + stack_args_(reinterpret_cast(sp) + PORTABLE_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE + + PORTABLE_STACK_ARG_SKIP), + cur_args_(reg_args_), + cur_arg_index_(0), + param_index_(0) { + } + + virtual ~PortableArgumentVisitor() {} + + virtual void Visit() = 0; + + bool IsParamAReference() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + return caller_mh_.IsParamAReference(param_index_); + } + + bool IsParamALongOrDouble() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + return caller_mh_.IsParamALongOrDouble(param_index_); + } + + Primitive::Type GetParamPrimitiveType() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + return caller_mh_.GetParamPrimitiveType(param_index_); + } + + byte* GetParamAddress() const { + return cur_args_ + (cur_arg_index_ * kPointerSize); + } + + void VisitArguments() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + for (cur_arg_index_ = 0; cur_arg_index_ < args_in_regs_ && param_index_ < num_params_; ) { +#if (defined(__arm__) || defined(__mips__)) + if (IsParamALongOrDouble() && cur_arg_index_ == 2) { + break; + } +#endif + Visit(); + cur_arg_index_ += (IsParamALongOrDouble() ? 2 : 1); + param_index_++; + } + cur_args_ = stack_args_; + cur_arg_index_ = 0; + while (param_index_ < num_params_) { +#if (defined(__arm__) || defined(__mips__)) + if (IsParamALongOrDouble() && cur_arg_index_ % 2 != 0) { + cur_arg_index_++; + } +#endif + Visit(); + cur_arg_index_ += (IsParamALongOrDouble() ? 2 : 1); + param_index_++; + } + } + + private: + static size_t ComputeArgsInRegs(MethodHelper& mh) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +#if (defined(__i386__)) + return 0; +#else + size_t args_in_regs = 0; + size_t num_params = mh.NumArgs(); + for (size_t i = 0; i < num_params; i++) { + args_in_regs = args_in_regs + (mh.IsParamALongOrDouble(i) ? 2 : 1); + if (args_in_regs > 3) { + args_in_regs = 3; + break; + } + } + return args_in_regs; +#endif + } + MethodHelper& caller_mh_; + const size_t args_in_regs_; + const size_t num_params_; + byte* const reg_args_; + byte* const stack_args_; + byte* cur_args_; + size_t cur_arg_index_; + size_t param_index_; +}; + +// Visits arguments on the stack placing them into the shadow frame. +class BuildPortableShadowFrameVisitor : public PortableArgumentVisitor { + public: + BuildPortableShadowFrameVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp, + ShadowFrame& sf, size_t first_arg_reg) : + PortableArgumentVisitor(caller_mh, sp), sf_(sf), cur_reg_(first_arg_reg) { } + virtual void Visit() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Primitive::Type type = GetParamPrimitiveType(); + switch (type) { + case Primitive::kPrimLong: // Fall-through. + case Primitive::kPrimDouble: + sf_.SetVRegLong(cur_reg_, *reinterpret_cast(GetParamAddress())); + ++cur_reg_; + break; + case Primitive::kPrimNot: + sf_.SetVRegReference(cur_reg_, *reinterpret_cast(GetParamAddress())); + break; + case Primitive::kPrimBoolean: // Fall-through. + case Primitive::kPrimByte: // Fall-through. + case Primitive::kPrimChar: // Fall-through. + case Primitive::kPrimShort: // Fall-through. + case Primitive::kPrimInt: // Fall-through. + case Primitive::kPrimFloat: + sf_.SetVReg(cur_reg_, *reinterpret_cast(GetParamAddress())); + break; + case Primitive::kPrimVoid: + LOG(FATAL) << "UNREACHABLE"; + break; + } + ++cur_reg_; + } + + private: + ShadowFrame& sf_; + size_t cur_reg_; + + DISALLOW_COPY_AND_ASSIGN(BuildPortableShadowFrameVisitor); +}; + +extern "C" uint64_t artPortableToInterpreterBridge(mirror::AbstractMethod* method, Thread* self, + mirror::AbstractMethod** sp) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + // Ensure we don't get thread suspension until the object arguments are safely in the shadow + // frame. + // FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsAndArgs); + + if (method->IsAbstract()) { + ThrowAbstractMethodError(method); + return 0; + } else { + const char* old_cause = self->StartAssertNoThreadSuspension("Building interpreter shadow frame"); + MethodHelper mh(method); + const DexFile::CodeItem* code_item = mh.GetCodeItem(); + uint16_t num_regs = code_item->registers_size_; + void* memory = alloca(ShadowFrame::ComputeSize(num_regs)); + ShadowFrame* shadow_frame(ShadowFrame::Create(num_regs, NULL, // No last shadow coming from quick. + method, 0, memory)); + size_t first_arg_reg = code_item->registers_size_ - code_item->ins_size_; + BuildPortableShadowFrameVisitor shadow_frame_builder(mh, sp, + *shadow_frame, first_arg_reg); + shadow_frame_builder.VisitArguments(); + // Push a transition back into managed code onto the linked list in thread. + ManagedStack fragment; + self->PushManagedStackFragment(&fragment); + self->PushShadowFrame(shadow_frame); + self->EndAssertNoThreadSuspension(old_cause); + + if (method->IsStatic() && !method->GetDeclaringClass()->IsInitializing()) { + // Ensure static method's class is initialized. + if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(method->GetDeclaringClass(), + true, true)) { + DCHECK(Thread::Current()->IsExceptionPending()); + self->PopManagedStackFragment(fragment); + return 0; + } + } + + JValue result = interpreter::EnterInterpreterFromStub(self, mh, code_item, *shadow_frame); + // Pop transition. + self->PopManagedStackFragment(fragment); + return result.GetJ(); + } +} + +// Visits arguments on the stack placing them into the args vector, Object* arguments are converted +// to jobjects. +class BuildPortableArgumentVisitor : public PortableArgumentVisitor { + public: + BuildPortableArgumentVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp, + ScopedObjectAccessUnchecked& soa, std::vector& args) : + PortableArgumentVisitor(caller_mh, sp), soa_(soa), args_(args) {} + + virtual void Visit() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + jvalue val; + Primitive::Type type = GetParamPrimitiveType(); + switch (type) { + case Primitive::kPrimNot: { + mirror::Object* obj = *reinterpret_cast(GetParamAddress()); + val.l = soa_.AddLocalReference(obj); + break; + } + case Primitive::kPrimLong: // Fall-through. + case Primitive::kPrimDouble: + val.j = *reinterpret_cast(GetParamAddress()); + break; + case Primitive::kPrimBoolean: // Fall-through. + case Primitive::kPrimByte: // Fall-through. + case Primitive::kPrimChar: // Fall-through. + case Primitive::kPrimShort: // Fall-through. + case Primitive::kPrimInt: // Fall-through. + case Primitive::kPrimFloat: + val.i = *reinterpret_cast(GetParamAddress()); + break; + case Primitive::kPrimVoid: + LOG(FATAL) << "UNREACHABLE"; + val.j = 0; + break; + } + args_.push_back(val); + } + + private: + ScopedObjectAccessUnchecked& soa_; + std::vector& args_; + + DISALLOW_COPY_AND_ASSIGN(BuildPortableArgumentVisitor); +}; + +// Handler for invocation on proxy methods. On entry a frame will exist for the proxy object method +// which is responsible for recording callee save registers. We explicitly place into jobjects the +// incoming reference arguments (so they survive GC). We invoke the invocation handler, which is a +// field within the proxy object, which will box the primitive arguments and deal with error cases. +extern "C" uint64_t artPortableProxyInvokeHandler(mirror::AbstractMethod* proxy_method, + mirror::Object* receiver, + Thread* self, mirror::AbstractMethod** sp) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + // Ensure we don't get thread suspension until the object arguments are safely in jobjects. + const char* old_cause = + self->StartAssertNoThreadSuspension("Adding to IRT proxy object arguments"); + self->VerifyStack(); + // Start new JNI local reference state. + JNIEnvExt* env = self->GetJniEnv(); + ScopedObjectAccessUnchecked soa(env); + ScopedJniEnvLocalRefState env_state(env); + // Create local ref. copies of proxy method and the receiver. + jobject rcvr_jobj = soa.AddLocalReference(receiver); + + // Placing arguments into args vector and remove the receiver. + MethodHelper proxy_mh(proxy_method); + std::vector args; + BuildPortableArgumentVisitor local_ref_visitor(proxy_mh, sp, soa, args); + local_ref_visitor.VisitArguments(); + args.erase(args.begin()); + + // Convert proxy method into expected interface method. + mirror::AbstractMethod* interface_method = proxy_method->FindOverriddenMethod(); + DCHECK(interface_method != NULL); + DCHECK(!interface_method->IsProxyMethod()) << PrettyMethod(interface_method); + jobject interface_method_jobj = soa.AddLocalReference(interface_method); + + // All naked Object*s should now be in jobjects, so its safe to go into the main invoke code + // that performs allocations. + self->EndAssertNoThreadSuspension(old_cause); + JValue result = InvokeProxyInvocationHandler(soa, proxy_mh.GetShorty(), + rcvr_jobj, interface_method_jobj, args); + return result.GetJ(); +} + +// Lazily resolve a method for portable. Called by stub code. +extern "C" const void* artPortableResolutionTrampoline(mirror::AbstractMethod* called, + mirror::Object* receiver, + Thread* thread, + mirror::AbstractMethod** called_addr) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + uint32_t dex_pc; + mirror::AbstractMethod* caller = thread->GetCurrentMethod(&dex_pc); + + ClassLinker* linker = Runtime::Current()->GetClassLinker(); + InvokeType invoke_type; + bool is_range; + if (called->IsRuntimeMethod()) { + const DexFile::CodeItem* code = MethodHelper(caller).GetCodeItem(); + CHECK_LT(dex_pc, code->insns_size_in_code_units_); + const Instruction* instr = Instruction::At(&code->insns_[dex_pc]); + Instruction::Code instr_code = instr->Opcode(); + switch (instr_code) { + case Instruction::INVOKE_DIRECT: + invoke_type = kDirect; + is_range = false; + break; + case Instruction::INVOKE_DIRECT_RANGE: + invoke_type = kDirect; + is_range = true; + break; + case Instruction::INVOKE_STATIC: + invoke_type = kStatic; + is_range = false; + break; + case Instruction::INVOKE_STATIC_RANGE: + invoke_type = kStatic; + is_range = true; + break; + case Instruction::INVOKE_SUPER: + invoke_type = kSuper; + is_range = false; + break; + case Instruction::INVOKE_SUPER_RANGE: + invoke_type = kSuper; + is_range = true; + break; + case Instruction::INVOKE_VIRTUAL: + invoke_type = kVirtual; + is_range = false; + break; + case Instruction::INVOKE_VIRTUAL_RANGE: + invoke_type = kVirtual; + is_range = true; + break; + case Instruction::INVOKE_INTERFACE: + invoke_type = kInterface; + is_range = false; + break; + case Instruction::INVOKE_INTERFACE_RANGE: + invoke_type = kInterface; + is_range = true; + break; + default: + LOG(FATAL) << "Unexpected call into trampoline: " << instr->DumpString(NULL); + // Avoid used uninitialized warnings. + invoke_type = kDirect; + is_range = true; + } + uint32_t dex_method_idx = (is_range) ? instr->VRegB_3rc() : instr->VRegB_35c(); + called = linker->ResolveMethod(dex_method_idx, caller, invoke_type); + // Incompatible class change should have been handled in resolve method. + CHECK(!called->CheckIncompatibleClassChange(invoke_type)); + // Refine called method based on receiver. + if (invoke_type == kVirtual) { + called = receiver->GetClass()->FindVirtualMethodForVirtual(called); + } else if (invoke_type == kInterface) { + called = receiver->GetClass()->FindVirtualMethodForInterface(called); + } + } else { + CHECK(called->IsStatic()) << PrettyMethod(called); + invoke_type = kStatic; + // Incompatible class change should have been handled in resolve method. + CHECK(!called->CheckIncompatibleClassChange(invoke_type)); + } + const void* code = NULL; + if (LIKELY(!thread->IsExceptionPending())) { + // Ensure that the called method's class is initialized. + mirror::Class* called_class = called->GetDeclaringClass(); + linker->EnsureInitialized(called_class, true, true); + if (LIKELY(called_class->IsInitialized())) { + code = called->GetEntryPointFromCompiledCode(); + // TODO: remove this after we solve the link issue. + { // for lazy link. + if (code == NULL) { + code = linker->GetOatCodeFor(called); + } + } + } else if (called_class->IsInitializing()) { + if (invoke_type == kStatic) { + // Class is still initializing, go to oat and grab code (trampoline must be left in place + // until class is initialized to stop races between threads). + code = linker->GetOatCodeFor(called); + } else { + // No trampoline for non-static methods. + code = called->GetEntryPointFromCompiledCode(); + // TODO: remove this after we solve the link issue. + { // for lazy link. + if (code == NULL) { + code = linker->GetOatCodeFor(called); + } + } + } + } else { + DCHECK(called_class->IsErroneous()); + } + } + if (LIKELY(code != NULL)) { + // Expect class to at least be initializing. + DCHECK(called->GetDeclaringClass()->IsInitializing()); + // Don't want infinite recursion. + DCHECK(code != GetResolutionTrampoline(linker)); + // Set up entry into main method + *called_addr = called; + } + return code; +} + +} // namespace art + +#endif // ART_RUNTIME_ENTRYPOINTS_PORTABLE_PORTABLE_ARGUMENT_VISITOR_H_ diff --git a/runtime/invoke_arg_array_builder.h b/runtime/invoke_arg_array_builder.h index c1d8249fd3..084d005e96 100644 --- a/runtime/invoke_arg_array_builder.h +++ b/runtime/invoke_arg_array_builder.h @@ -17,6 +17,7 @@ #ifndef ART_RUNTIME_INVOKE_ARG_ARRAY_BUILDER_H_ #define ART_RUNTIME_INVOKE_ARG_ARRAY_BUILDER_H_ +#include "mirror/abstract_method.h" #include "mirror/object.h" #include "scoped_thread_state_change.h" @@ -162,10 +163,35 @@ class ArgArray { } } - void BuildArgArray(ShadowFrame* shadow_frame, uint32_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - arg_array_ = shadow_frame->GetVRegArgs(arg_offset); - num_bytes_ = (shadow_frame->NumberOfVRegs() - arg_offset) * 4; + + void BuildArgArrayFromFrame(ShadowFrame* shadow_frame, uint32_t arg_offset) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + // Set receiver if non-null (method is not static) + size_t cur_arg = arg_offset; + if (!shadow_frame->GetMethod()->IsStatic()) { + Append(shadow_frame->GetVReg(cur_arg)); + cur_arg++; + } + for (size_t i = 1; i < shorty_len_; ++i) { + switch (shorty_[i]) { + case 'Z': + case 'B': + case 'C': + case 'S': + case 'I': + case 'F': + case 'L': + Append(shadow_frame->GetVReg(cur_arg)); + cur_arg++; + break; + case 'D': + case 'J': + AppendWide(shadow_frame->GetVRegLong(cur_arg)); + cur_arg++; + cur_arg++; + break; + } + } } private: diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index eb6e3c3453..fc595d90d9 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -4090,10 +4090,8 @@ const std::vector* MethodVerifier::GetDexGcMap(MethodReference ref) { DCHECK(Runtime::Current()->IsCompiler()); ReaderMutexLock mu(Thread::Current(), *dex_gc_maps_lock_); DexGcMapTable::const_iterator it = dex_gc_maps_->find(ref); - if (it == dex_gc_maps_->end()) { - LOG(WARNING) << "Didn't find GC map for: " << PrettyMethod(ref.dex_method_index, *ref.dex_file); - return NULL; - } + CHECK(it != dex_gc_maps_->end()) + << "Didn't find GC map for: " << PrettyMethod(ref.dex_method_index, *ref.dex_file); CHECK(it->second != NULL); return it->second; } -- cgit v1.2.3-59-g8ed1b From ea46f950e7a51585db293cd7f047de190a482414 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Tue, 30 Jul 2013 01:26:50 -0700 Subject: Refactor java.lang.reflect implementation Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1. Move to ArtMethod/Field instead of AbstractMethod/Field and have java.lang.reflect APIs delegate to ArtMethod/ArtField. Bug: 10014286. Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7 --- compiler/dex/dex_to_dex_compiler.cc | 4 +- compiler/dex/quick/gen_common.cc | 26 +- compiler/dex/quick/gen_invoke.cc | 10 +- compiler/driver/compiler_driver.cc | 34 +- compiler/driver/compiler_driver.h | 6 +- compiler/driver/compiler_driver_test.cc | 6 +- compiler/elf_writer.cc | 2 +- compiler/elf_writer_mclinker.cc | 6 +- compiler/image_writer.cc | 46 +- compiler/image_writer.h | 2 +- compiler/jni/jni_compiler_test.cc | 4 +- compiler/jni/portable/jni_compiler.cc | 6 +- compiler/jni/portable/jni_compiler.h | 2 +- compiler/jni/quick/jni_compiler.cc | 4 +- compiler/llvm/compiler_llvm.h | 2 +- compiler/llvm/gbc_expander.cc | 20 +- compiler/oat_writer.cc | 4 +- dex2oat/dex2oat.cc | 4 +- oatdump/oatdump.cc | 46 +- runtime/Android.mk | 4 +- runtime/arch/arm/context_arm.cc | 4 +- runtime/arch/arm/entrypoints_init_arm.cc | 8 +- runtime/arch/mips/context_mips.cc | 4 +- runtime/arch/mips/entrypoints_init_mips.cc | 8 +- runtime/arch/x86/context_x86.cc | 4 +- runtime/arch/x86/entrypoints_init_x86.cc | 8 +- runtime/check_jni.cc | 38 +- runtime/class_linker-inl.h | 48 +-- runtime/class_linker.cc | 379 +++++++---------- runtime/class_linker.h | 103 +++-- runtime/class_linker_test.cc | 470 ++++++++++---------- runtime/common_test.h | 10 +- runtime/common_throws.cc | 51 +-- runtime/common_throws.h | 34 +- runtime/debugger.cc | 110 ++--- runtime/debugger.h | 10 +- runtime/dex_file.cc | 9 +- runtime/dex_file.h | 12 +- runtime/entrypoints/entrypoint_utils.cc | 46 +- runtime/entrypoints/entrypoint_utils.h | 52 +-- .../interpreter/interpreter_entrypoints.cc | 4 +- runtime/entrypoints/jni/jni_entrypoints.cc | 6 +- .../portable/portable_alloc_entrypoints.cc | 14 +- .../portable/portable_dexcache_entrypoints.cc | 10 +- .../entrypoints/portable/portable_entrypoints.h | 6 +- .../portable/portable_field_entrypoints.cc | 60 +-- .../portable/portable_fillarray_entrypoints.cc | 4 +- .../portable/portable_invoke_entrypoints.cc | 20 +- .../portable/portable_jni_entrypoints.cc | 2 +- .../portable/portable_thread_entrypoints.cc | 6 +- .../portable/portable_throw_entrypoints.cc | 4 +- .../portable/portable_trampoline_entrypoints.cc | 24 +- runtime/entrypoints/quick/callee_save_frame.h | 4 +- .../entrypoints/quick/quick_alloc_entrypoints.cc | 26 +- .../entrypoints/quick/quick_cast_entrypoints.cc | 4 +- .../quick/quick_deoptimization_entrypoints.cc | 4 +- .../quick/quick_dexcache_entrypoints.cc | 18 +- runtime/entrypoints/quick/quick_entrypoints.h | 10 +- .../entrypoints/quick/quick_field_entrypoints.cc | 112 ++--- .../quick/quick_fillarray_entrypoints.cc | 2 +- .../quick/quick_instrumentation_entrypoints.cc | 10 +- .../entrypoints/quick/quick_invoke_entrypoints.cc | 36 +- runtime/entrypoints/quick/quick_jni_entrypoints.cc | 2 +- .../entrypoints/quick/quick_lock_entrypoints.cc | 4 +- .../entrypoints/quick/quick_thread_entrypoints.cc | 2 +- .../entrypoints/quick/quick_throw_entrypoints.cc | 14 +- .../quick/quick_trampoline_entrypoints.cc | 32 +- runtime/exception_test.cc | 4 +- runtime/gc/accounting/mod_union_table.cc | 2 +- runtime/gc/accounting/space_bitmap.cc | 10 +- runtime/gc/collector/mark_sweep-inl.h | 6 +- runtime/gc/collector/mark_sweep.cc | 10 +- runtime/gc/heap.cc | 8 +- runtime/gc/space/image_space.cc | 10 +- runtime/hprof/hprof.cc | 9 +- runtime/instrumentation.cc | 32 +- runtime/instrumentation.h | 52 +-- runtime/interpreter/interpreter.cc | 70 +-- runtime/interpreter/interpreter.h | 6 +- runtime/invoke_arg_array_builder.h | 2 +- runtime/jdwp/jdwp.h | 2 +- runtime/jdwp/object_registry.h | 2 +- runtime/jni_internal.cc | 120 ++++-- runtime/jni_internal.h | 12 +- runtime/jni_internal_test.cc | 110 +++-- runtime/mirror/abstract_method-inl.h | 203 --------- runtime/mirror/abstract_method.cc | 350 --------------- runtime/mirror/abstract_method.h | 471 --------------------- runtime/mirror/art_field-inl.h | 221 ++++++++++ runtime/mirror/art_field.cc | 56 +++ runtime/mirror/art_field.h | 165 ++++++++ runtime/mirror/art_method-inl.h | 203 +++++++++ runtime/mirror/art_method.cc | 342 +++++++++++++++ runtime/mirror/art_method.h | 457 ++++++++++++++++++++ runtime/mirror/class-inl.h | 87 ++-- runtime/mirror/class.cc | 97 +++-- runtime/mirror/class.h | 102 ++--- runtime/mirror/dex_cache-inl.h | 4 +- runtime/mirror/dex_cache.cc | 12 +- runtime/mirror/dex_cache.h | 30 +- runtime/mirror/field-inl.h | 221 ---------- runtime/mirror/field.cc | 56 --- runtime/mirror/field.h | 168 -------- runtime/mirror/iftable.h | 12 +- runtime/mirror/object-inl.h | 40 +- runtime/mirror/object.cc | 14 +- runtime/mirror/object.h | 16 +- runtime/mirror/object_array-inl.h | 2 +- runtime/mirror/object_test.cc | 40 +- runtime/mirror/throwable.cc | 4 +- runtime/monitor.cc | 10 +- runtime/monitor.h | 8 +- runtime/monitor_android.cc | 2 +- runtime/native/dalvik_system_VMStack.cc | 2 +- runtime/native/java_lang_reflect_Constructor.cc | 10 +- runtime/native/java_lang_reflect_Field.cc | 23 +- runtime/native/java_lang_reflect_Method.cc | 23 +- runtime/native/java_lang_reflect_Proxy.cc | 6 +- runtime/nth_caller_visitor.h | 6 +- runtime/oat_file.cc | 6 +- runtime/oat_file.h | 4 +- runtime/oat_test.cc | 4 +- runtime/object_utils.h | 26 +- runtime/reflection.cc | 17 +- runtime/reflection.h | 12 +- runtime/runtime.cc | 29 +- runtime/runtime.h | 22 +- runtime/scoped_thread_state_change.h | 12 +- runtime/stack.cc | 29 +- runtime/stack.h | 38 +- runtime/thread.cc | 54 +-- runtime/thread.h | 6 +- runtime/throw_location.cc | 2 +- runtime/throw_location.h | 8 +- runtime/trace.cc | 34 +- runtime/trace.h | 18 +- runtime/utils.cc | 13 +- runtime/utils.h | 12 +- runtime/utils_test.cc | 4 +- runtime/verifier/method_verifier.cc | 80 ++-- runtime/verifier/method_verifier.h | 43 +- runtime/well_known_classes.cc | 24 +- runtime/well_known_classes.h | 11 +- test/046-reflect/expected.txt | 9 +- test/046-reflect/src/Main.java | 43 +- test/100-reflect2/expected.txt | 2 +- test/ReferenceMap/stack_walk_refmap_jni.cc | 6 +- test/StackWalk/stack_walk_jni.cc | 6 +- 148 files changed, 3300 insertions(+), 3290 deletions(-) delete mode 100644 runtime/mirror/abstract_method-inl.h delete mode 100644 runtime/mirror/abstract_method.cc delete mode 100644 runtime/mirror/abstract_method.h create mode 100644 runtime/mirror/art_field-inl.h create mode 100644 runtime/mirror/art_field.cc create mode 100644 runtime/mirror/art_field.h create mode 100644 runtime/mirror/art_method-inl.h create mode 100644 runtime/mirror/art_method.cc create mode 100644 runtime/mirror/art_method.h delete mode 100644 runtime/mirror/field-inl.h delete mode 100644 runtime/mirror/field.cc delete mode 100644 runtime/mirror/field.h (limited to 'runtime/invoke_arg_array_builder.h') diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc index 60e638c584..a0e2c1e9aa 100644 --- a/compiler/dex/dex_to_dex_compiler.cc +++ b/compiler/dex/dex_to_dex_compiler.cc @@ -20,10 +20,10 @@ #include "dex_instruction-inl.h" #include "driver/compiler_driver.h" #include "driver/dex_compilation_unit.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/dex_cache.h" -#include "mirror/field-inl.h" namespace art { namespace optimizer { diff --git a/compiler/dex/quick/gen_common.cc b/compiler/dex/quick/gen_common.cc index 298d3898c8..e5c7fb150e 100644 --- a/compiler/dex/quick/gen_common.cc +++ b/compiler/dex/quick/gen_common.cc @@ -347,7 +347,7 @@ void Mir2Lir::GenSput(uint32_t field_idx, RegLocation rl_src, bool is_long_or_do RegLocation rl_method = LoadCurrMethod(); rBase = AllocTemp(); LoadWordDisp(rl_method.low_reg, - mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), rBase); + mirror::ArtMethod::DeclaringClassOffset().Int32Value(), rBase); if (IsTemp(rl_method.low_reg)) { FreeTemp(rl_method.low_reg); } @@ -365,7 +365,7 @@ void Mir2Lir::GenSput(uint32_t field_idx, RegLocation rl_src, bool is_long_or_do rBase = TargetReg(kArg0); LockTemp(rBase); LoadWordDisp(r_method, - mirror::AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(), + mirror::ArtMethod::DexCacheInitializedStaticStorageOffset().Int32Value(), rBase); LoadWordDisp(rBase, mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() + @@ -433,7 +433,7 @@ void Mir2Lir::GenSget(uint32_t field_idx, RegLocation rl_dest, RegLocation rl_method = LoadCurrMethod(); rBase = AllocTemp(); LoadWordDisp(rl_method.low_reg, - mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), rBase); + mirror::ArtMethod::DeclaringClassOffset().Int32Value(), rBase); } else { // Medium path, static storage base in a different class which requires checks that the other // class is initialized @@ -448,7 +448,7 @@ void Mir2Lir::GenSget(uint32_t field_idx, RegLocation rl_dest, rBase = TargetReg(kArg0); LockTemp(rBase); LoadWordDisp(r_method, - mirror::AbstractMethod::DexCacheInitializedStaticStorageOffset().Int32Value(), + mirror::ArtMethod::DexCacheInitializedStaticStorageOffset().Int32Value(), rBase); LoadWordDisp(rBase, mirror::Array::DataOffset(sizeof(mirror::Object*)).Int32Value() + sizeof(int32_t*) * ssb_index, rBase); @@ -746,7 +746,7 @@ void Mir2Lir::GenConstClass(uint32_t type_idx, RegLocation rl_dest) { } else { // We're don't need access checks, load type from dex cache int32_t dex_cache_offset = - mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(); + mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(); LoadWordDisp(rl_method.low_reg, dex_cache_offset, res_reg); int32_t offset_of_type = mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*) @@ -799,7 +799,7 @@ void Mir2Lir::GenConstString(uint32_t string_idx, RegLocation rl_dest) { LockCallTemps(); // Using explicit registers LoadCurrMethodDirect(TargetReg(kArg2)); LoadWordDisp(TargetReg(kArg2), - mirror::AbstractMethod::DexCacheStringsOffset().Int32Value(), TargetReg(kArg0)); + mirror::ArtMethod::DexCacheStringsOffset().Int32Value(), TargetReg(kArg0)); // Might call out to helper, which will return resolved string in kRet0 int r_tgt = CallHelperSetup(QUICK_ENTRYPOINT_OFFSET(pResolveString)); LoadWordDisp(TargetReg(kArg0), offset_of_string, TargetReg(kRet0)); @@ -835,7 +835,7 @@ void Mir2Lir::GenConstString(uint32_t string_idx, RegLocation rl_dest) { int res_reg = AllocTemp(); RegLocation rl_result = EvalLoc(rl_dest, kCoreReg, true); LoadWordDisp(rl_method.low_reg, - mirror::AbstractMethod::DexCacheStringsOffset().Int32Value(), res_reg); + mirror::ArtMethod::DexCacheStringsOffset().Int32Value(), res_reg); LoadWordDisp(res_reg, offset_of_string, rl_result.low_reg); StoreValue(rl_dest, rl_result); } @@ -884,11 +884,11 @@ void Mir2Lir::GenInstanceofFinal(bool use_declaring_class, uint32_t type_idx, Re LoadCurrMethodDirect(check_class); if (use_declaring_class) { - LoadWordDisp(check_class, mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), + LoadWordDisp(check_class, mirror::ArtMethod::DeclaringClassOffset().Int32Value(), check_class); LoadWordDisp(object.low_reg, mirror::Object::ClassOffset().Int32Value(), object_class); } else { - LoadWordDisp(check_class, mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), + LoadWordDisp(check_class, mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), check_class); LoadWordDisp(object.low_reg, mirror::Object::ClassOffset().Int32Value(), object_class); int32_t offset_of_type = @@ -940,12 +940,12 @@ void Mir2Lir::GenInstanceofCallingHelper(bool needs_access_check, bool type_know } else if (use_declaring_class) { LoadValueDirectFixed(rl_src, TargetReg(kArg0)); // kArg0 <= ref LoadWordDisp(TargetReg(kArg1), - mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), class_reg); + mirror::ArtMethod::DeclaringClassOffset().Int32Value(), class_reg); } else { // Load dex cache entry into class_reg (kArg2) LoadValueDirectFixed(rl_src, TargetReg(kArg0)); // kArg0 <= ref LoadWordDisp(TargetReg(kArg1), - mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg); + mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg); int32_t offset_of_type = mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*) * type_idx); @@ -1078,11 +1078,11 @@ void Mir2Lir::GenCheckCast(uint32_t insn_idx, uint32_t type_idx, RegLocation rl_ OpRegCopy(class_reg, TargetReg(kRet0)); // Align usage with fast path } else if (use_declaring_class) { LoadWordDisp(TargetReg(kArg1), - mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), class_reg); + mirror::ArtMethod::DeclaringClassOffset().Int32Value(), class_reg); } else { // Load dex cache entry into class_reg (kArg2) LoadWordDisp(TargetReg(kArg1), - mirror::AbstractMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg); + mirror::ArtMethod::DexCacheResolvedTypesOffset().Int32Value(), class_reg); int32_t offset_of_type = mirror::Array::DataOffset(sizeof(mirror::Class*)).Int32Value() + (sizeof(mirror::Class*) * type_idx); diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc index 20d683a947..073b550d78 100644 --- a/compiler/dex/quick/gen_invoke.cc +++ b/compiler/dex/quick/gen_invoke.cc @@ -365,7 +365,7 @@ static int NextSDCallInsn(CompilationUnit* cu, CallInfo* info, break; case 1: // Get method->dex_cache_resolved_methods_ cg->LoadWordDisp(cg->TargetReg(kArg0), - mirror::AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(), cg->TargetReg(kArg0)); + mirror::ArtMethod::DexCacheResolvedMethodsOffset().Int32Value(), cg->TargetReg(kArg0)); // Set up direct code if known. if (direct_code != 0) { if (direct_code != static_cast(-1)) { @@ -395,7 +395,7 @@ static int NextSDCallInsn(CompilationUnit* cu, CallInfo* info, if (cu->instruction_set != kX86) { if (direct_code == 0) { cg->LoadWordDisp(cg->TargetReg(kArg0), - mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), + mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), cg->TargetReg(kInvokeTgt)); } break; @@ -448,7 +448,7 @@ static int NextVCallInsn(CompilationUnit* cu, CallInfo* info, case 4: // Get the compiled code address [uses kArg0, sets kInvokeTgt] if (cu->instruction_set != kX86) { cg->LoadWordDisp(cg->TargetReg(kArg0), - mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), + mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), cg->TargetReg(kInvokeTgt)); break; } @@ -514,7 +514,7 @@ static int NextInterfaceCallInsn(CompilationUnit* cu, CallInfo* info, int state, break; case 1: // Get method->dex_cache_resolved_methods_ [set/use kArg0] cg->LoadWordDisp(cg->TargetReg(kArg0), - mirror::AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(), + mirror::ArtMethod::DexCacheResolvedMethodsOffset().Int32Value(), cg->TargetReg(kArg0)); break; case 2: // Grab target method* [set/use kArg0] @@ -1407,7 +1407,7 @@ void Mir2Lir::GenInvoke(CallInfo* info) { } else { if (fast_path && info->type != kInterface) { call_inst = OpMem(kOpBlx, TargetReg(kArg0), - mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value()); + mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value()); } else { ThreadOffset trampoline(-1); switch (info->type) { diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 144271d581..82f51f200a 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -33,11 +33,11 @@ #include "gc/accounting/card_table-inl.h" #include "gc/accounting/heap_bitmap.h" #include "gc/space/space.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class_loader.h" #include "mirror/class-inl.h" #include "mirror/dex_cache-inl.h" -#include "mirror/field-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/throwable.h" @@ -515,7 +515,7 @@ static DexToDexCompilationLevel GetDexToDexCompilationlevel(mirror::ClassLoader* } } -void CompilerDriver::CompileOne(const mirror::AbstractMethod* method, base::TimingLogger& timings) { +void CompilerDriver::CompileOne(const mirror::ArtMethod* method, base::TimingLogger& timings) { DCHECK(!Runtime::Current()->IsStarted()); Thread* self = Thread::Current(); jobject jclass_loader; @@ -632,12 +632,12 @@ static bool ResolveCatchBlockExceptionsClassVisitor(mirror::Class* c, void* arg) reinterpret_cast >*>(arg); MethodHelper mh; for (size_t i = 0; i < c->NumVirtualMethods(); ++i) { - mirror::AbstractMethod* m = c->GetVirtualMethod(i); + mirror::ArtMethod* m = c->GetVirtualMethod(i); mh.ChangeMethod(m); ResolveExceptionsForMethod(&mh, *exceptions_to_resolve); } for (size_t i = 0; i < c->NumDirectMethods(); ++i) { - mirror::AbstractMethod* m = c->GetDirectMethod(i); + mirror::ArtMethod* m = c->GetDirectMethod(i); mh.ChangeMethod(m); ResolveExceptionsForMethod(&mh, *exceptions_to_resolve); } @@ -895,7 +895,7 @@ static mirror::Class* ComputeCompilingMethodsClass(ScopedObjectAccess& soa, dex_cache, class_loader); } -static mirror::Field* ComputeFieldReferencedFromCompilingMethod(ScopedObjectAccess& soa, +static mirror::ArtField* ComputeFieldReferencedFromCompilingMethod(ScopedObjectAccess& soa, const DexCompilationUnit* mUnit, uint32_t field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -905,7 +905,7 @@ static mirror::Field* ComputeFieldReferencedFromCompilingMethod(ScopedObjectAcce class_loader, false); } -static mirror::AbstractMethod* ComputeMethodReferencedFromCompilingMethod(ScopedObjectAccess& soa, +static mirror::ArtMethod* ComputeMethodReferencedFromCompilingMethod(ScopedObjectAccess& soa, const DexCompilationUnit* mUnit, uint32_t method_idx, InvokeType type) @@ -923,7 +923,7 @@ bool CompilerDriver::ComputeInstanceFieldInfo(uint32_t field_idx, const DexCompi field_offset = -1; is_volatile = true; // Try to resolve field and ignore if an Incompatible Class Change Error (ie is static). - mirror::Field* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx); + mirror::ArtField* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx); if (resolved_field != NULL && !resolved_field->IsStatic()) { mirror::Class* referrer_class = ComputeCompilingMethodsClass(soa, resolved_field->GetDeclaringClass()->GetDexCache(), @@ -974,7 +974,7 @@ bool CompilerDriver::ComputeStaticFieldInfo(uint32_t field_idx, const DexCompila is_referrers_class = false; is_volatile = true; // Try to resolve field and ignore if an Incompatible Class Change Error (ie isn't static). - mirror::Field* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx); + mirror::ArtField* resolved_field = ComputeFieldReferencedFromCompilingMethod(soa, mUnit, field_idx); if (resolved_field != NULL && resolved_field->IsStatic()) { mirror::Class* referrer_class = ComputeCompilingMethodsClass(soa, resolved_field->GetDeclaringClass()->GetDexCache(), @@ -1051,7 +1051,7 @@ bool CompilerDriver::ComputeStaticFieldInfo(uint32_t field_idx, const DexCompila void CompilerDriver::GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_type, mirror::Class* referrer_class, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, uintptr_t& direct_code, uintptr_t& direct_method, bool update_stats) { @@ -1114,7 +1114,7 @@ bool CompilerDriver::ComputeInvokeInfo(const DexCompilationUnit* mUnit, const ui vtable_idx = -1; direct_code = 0; direct_method = 0; - mirror::AbstractMethod* resolved_method = + mirror::ArtMethod* resolved_method = ComputeMethodReferencedFromCompilingMethod(soa, mUnit, target_method.dex_method_index, invoke_type); if (resolved_method != NULL) { @@ -1179,7 +1179,7 @@ bool CompilerDriver::ComputeInvokeInfo(const DexCompilationUnit* mUnit, const ui mUnit->GetClassLinker()->FindDexCache(*devirt_map_target->dex_file); mirror::ClassLoader* class_loader = soa.Decode(mUnit->GetClassLoader()); - mirror::AbstractMethod* called_method = + mirror::ArtMethod* called_method = mUnit->GetClassLinker()->ResolveMethod(*devirt_map_target->dex_file, devirt_map_target->dex_method_index, target_dex_cache, class_loader, NULL, @@ -1471,7 +1471,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag mirror::DexCache* dex_cache = class_linker->FindDexCache(dex_file); ClassDataItemIterator it(dex_file, class_data); while (it.HasNextStaticField()) { - mirror::Field* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache, + mirror::ArtField* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache, class_loader, true); if (field == NULL) { CHECK(self->IsExceptionPending()); @@ -1487,7 +1487,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag requires_constructor_barrier = true; } - mirror::Field* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache, + mirror::ArtField* field = class_linker->ResolveField(dex_file, it.GetMemberIndex(), dex_cache, class_loader, false); if (field == NULL) { CHECK(self->IsExceptionPending()); @@ -1500,7 +1500,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag class_def_index); } while (it.HasNextDirectMethod()) { - mirror::AbstractMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(), + mirror::ArtMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(), dex_cache, class_loader, NULL, it.GetMethodInvokeType(class_def)); if (method == NULL) { @@ -1510,7 +1510,7 @@ static void ResolveClassFieldsAndMethods(const ParallelCompilationManager* manag it.Next(); } while (it.HasNextVirtualMethod()) { - mirror::AbstractMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(), + mirror::ArtMethod* method = class_linker->ResolveMethod(dex_file, it.GetMemberIndex(), dex_cache, class_loader, NULL, it.GetMethodInvokeType(class_def)); if (method == NULL) { @@ -2073,7 +2073,7 @@ static void InitializeClass(const ParallelCompilationManager* manager, size_t cl LOG(INFO) << "Initializing: " << descriptor; if (StringPiece(descriptor) == "Ljava/lang/Void;") { // Hand initialize j.l.Void to avoid Dex file operations in un-started runtime. - mirror::ObjectArray* fields = klass->GetSFields(); + mirror::ObjectArray* fields = klass->GetSFields(); CHECK_EQ(fields->GetLength(), 1); fields->Get(0)->SetObj(klass, manager->GetClassLinker()->FindPrimitiveClass('V')); klass->SetStatus(mirror::Class::kStatusInitialized); diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index b5222c99b8..21a44eaf12 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -99,7 +99,7 @@ class CompilerDriver { LOCKS_EXCLUDED(Locks::mutator_lock_); // Compile a single Method - void CompileOne(const mirror::AbstractMethod* method, base::TimingLogger& timings) + void CompileOne(const mirror::ArtMethod* method, base::TimingLogger& timings) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); InstructionSet GetInstructionSet() const { @@ -301,7 +301,7 @@ class CompilerDriver { // Compute constant code and method pointers when possible void GetCodeAndMethodForDirectCall(InvokeType type, InvokeType sharp_type, mirror::Class* referrer_class, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, uintptr_t& direct_code, uintptr_t& direct_method, bool update_stats) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -425,7 +425,7 @@ class CompilerDriver { CompilerEnableAutoElfLoadingFn compiler_enable_auto_elf_loading_; typedef const void* (*CompilerGetMethodCodeAddrFn) - (const CompilerDriver& driver, const CompiledMethod* cm, const mirror::AbstractMethod* method); + (const CompilerDriver& driver, const CompiledMethod* cm, const mirror::ArtMethod* method); CompilerGetMethodCodeAddrFn compiler_get_method_code_addr_; bool support_boot_image_fixup_; diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc index 8ee9cf6442..c6687bb4aa 100644 --- a/compiler/driver/compiler_driver_test.cc +++ b/compiler/driver/compiler_driver_test.cc @@ -24,10 +24,10 @@ #include "common_test.h" #include "dex_file.h" #include "gc/heap.h" +#include "mirror/art_method-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" #include "mirror/dex_cache-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" @@ -115,7 +115,7 @@ TEST_F(CompilerDriverTest, DISABLED_LARGE_CompileDexLibCore) { } EXPECT_EQ(dex->NumMethodIds(), dex_cache->NumResolvedMethods()); for (size_t i = 0; i < dex_cache->NumResolvedMethods(); i++) { - mirror::AbstractMethod* method = dex_cache->GetResolvedMethod(i); + mirror::ArtMethod* method = dex_cache->GetResolvedMethod(i); EXPECT_TRUE(method != NULL) << "method_idx=" << i << " " << dex->GetMethodDeclaringClassDescriptor(dex->GetMethodId(i)) << " " << dex->GetMethodName(dex->GetMethodId(i)); @@ -126,7 +126,7 @@ TEST_F(CompilerDriverTest, DISABLED_LARGE_CompileDexLibCore) { } EXPECT_EQ(dex->NumFieldIds(), dex_cache->NumResolvedFields()); for (size_t i = 0; i < dex_cache->NumResolvedFields(); i++) { - mirror::Field* field = dex_cache->GetResolvedField(i); + mirror::ArtField* field = dex_cache->GetResolvedField(i); EXPECT_TRUE(field != NULL) << "field_idx=" << i << " " << dex->GetFieldDeclaringClassDescriptor(dex->GetFieldId(i)) << " " << dex->GetFieldName(dex->GetFieldId(i)); diff --git a/compiler/elf_writer.cc b/compiler/elf_writer.cc index 70d17de102..d3c13dd791 100644 --- a/compiler/elf_writer.cc +++ b/compiler/elf_writer.cc @@ -24,7 +24,7 @@ #include "elf_file.h" #include "invoke_type.h" #include "llvm/utils_llvm.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" #include "oat.h" #include "scoped_thread_state_change.h" diff --git a/compiler/elf_writer_mclinker.cc b/compiler/elf_writer_mclinker.cc index 2a9bc35559..e496ace27a 100644 --- a/compiler/elf_writer_mclinker.cc +++ b/compiler/elf_writer_mclinker.cc @@ -33,8 +33,8 @@ #include "driver/compiler_driver.h" #include "elf_file.h" #include "globals.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" #include "oat_writer.h" #include "scoped_thread_state_change.h" @@ -353,7 +353,7 @@ void ElfWriterMclinker::FixupOatMethodOffsets(const std::vector& const DexFile& dex_file = it.GetDexFile(); uint32_t method_idx = it.GetMemberIndex(); InvokeType invoke_type = it.GetInvokeType(); - mirror::AbstractMethod* method = NULL; + mirror::ArtMethod* method = NULL; if (compiler_driver_->IsImage()) { ClassLinker* linker = Runtime::Current()->GetClassLinker(); mirror::DexCache* dex_cache = linker->FindDexCache(dex_file); diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index 3432c8cbee..a40e3fc149 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -35,12 +35,12 @@ #include "globals.h" #include "image.h" #include "intern_table.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/array-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/dex_cache-inl.h" -#include "mirror/field-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "oat.h" @@ -52,11 +52,11 @@ #include "UniquePtr.h" #include "utils.h" -using ::art::mirror::AbstractMethod; +using ::art::mirror::ArtField; +using ::art::mirror::ArtMethod; using ::art::mirror::Class; using ::art::mirror::DexCache; using ::art::mirror::EntryPointFromInterpreter; -using ::art::mirror::Field; using ::art::mirror::Object; using ::art::mirror::ObjectArray; using ::art::mirror::String; @@ -257,7 +257,7 @@ void ImageWriter::PruneNonImageClasses() { } // Clear references to removed classes from the DexCaches. - AbstractMethod* resolution_method = runtime->GetResolutionMethod(); + ArtMethod* resolution_method = runtime->GetResolutionMethod(); typedef Set::const_iterator CacheIt; // TODO: C++0x auto for (CacheIt it = dex_caches_.begin(), end = dex_caches_.end(); it != end; ++it) { DexCache* dex_cache = *it; @@ -269,13 +269,13 @@ void ImageWriter::PruneNonImageClasses() { } } for (size_t i = 0; i < dex_cache->NumResolvedMethods(); i++) { - AbstractMethod* method = dex_cache->GetResolvedMethod(i); + ArtMethod* method = dex_cache->GetResolvedMethod(i); if (method != NULL && !IsImageClass(method->GetDeclaringClass())) { dex_cache->SetResolvedMethod(i, resolution_method); } } for (size_t i = 0; i < dex_cache->NumResolvedFields(); i++) { - Field* field = dex_cache->GetResolvedField(i); + ArtField* field = dex_cache->GetResolvedField(i); if (field != NULL && !IsImageClass(field->GetDeclaringClass())) { dex_cache->SetResolvedField(i, NULL); } @@ -487,8 +487,8 @@ void ImageWriter::FixupObject(const Object* orig, Object* copy) { FixupClass(orig->AsClass(), down_cast(copy)); } else if (orig->IsObjectArray()) { FixupObjectArray(orig->AsObjectArray(), down_cast*>(copy)); - } else if (orig->IsMethod()) { - FixupMethod(orig->AsMethod(), down_cast(copy)); + } else if (orig->IsArtMethod()) { + FixupMethod(orig->AsArtMethod(), down_cast(copy)); } else { FixupInstanceFields(orig, copy); } @@ -499,7 +499,7 @@ void ImageWriter::FixupClass(const Class* orig, Class* copy) { FixupStaticFields(orig, copy); } -void ImageWriter::FixupMethod(const AbstractMethod* orig, AbstractMethod* copy) { +void ImageWriter::FixupMethod(const ArtMethod* orig, ArtMethod* copy) { FixupInstanceFields(orig, copy); // OatWriter replaces the code_ with an offset value. Here we re-adjust to a pointer relative to @@ -614,9 +614,9 @@ void ImageWriter::FixupFields(const Object* orig, ? klass->NumReferenceStaticFields() : klass->NumReferenceInstanceFields()); for (size_t i = 0; i < num_reference_fields; ++i) { - Field* field = (is_static - ? klass->GetStaticField(i) - : klass->GetInstanceField(i)); + ArtField* field = (is_static + ? klass->GetStaticField(i) + : klass->GetInstanceField(i)); MemberOffset field_offset = field->GetOffset(); const Object* ref = orig->GetFieldObject(field_offset, false); // Use SetFieldPtr to avoid card marking since we are writing to the image. @@ -626,7 +626,7 @@ void ImageWriter::FixupFields(const Object* orig, } if (!is_static && orig->IsReferenceInstance()) { // Fix-up referent, that isn't marked as an object field, for References. - Field* field = orig->GetClass()->FindInstanceField("referent", "Ljava/lang/Object;"); + ArtField* field = orig->GetClass()->FindInstanceField("referent", "Ljava/lang/Object;"); MemberOffset field_offset = field->GetOffset(); const Object* ref = orig->GetFieldObject(field_offset, false); // Use SetFieldPtr to avoid card marking since we are writing to the image. @@ -634,16 +634,16 @@ void ImageWriter::FixupFields(const Object* orig, } } -static AbstractMethod* GetTargetMethod(const CompilerDriver::PatchInformation* patch) +static ArtMethod* GetTargetMethod(const CompilerDriver::PatchInformation* patch) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); DexCache* dex_cache = class_linker->FindDexCache(patch->GetDexFile()); - AbstractMethod* method = class_linker->ResolveMethod(patch->GetDexFile(), - patch->GetTargetMethodIdx(), - dex_cache, - NULL, - NULL, - patch->GetTargetInvokeType()); + ArtMethod* method = class_linker->ResolveMethod(patch->GetDexFile(), + patch->GetTargetMethodIdx(), + dex_cache, + NULL, + NULL, + patch->GetTargetInvokeType()); CHECK(method != NULL) << patch->GetDexFile().GetLocation() << " " << patch->GetTargetMethodIdx(); CHECK(!method->IsRuntimeMethod()) @@ -664,7 +664,7 @@ void ImageWriter::PatchOatCodeAndMethods() { const Patches& code_to_patch = compiler_driver_.GetCodeToPatch(); for (size_t i = 0; i < code_to_patch.size(); i++) { const CompilerDriver::PatchInformation* patch = code_to_patch[i]; - AbstractMethod* target = GetTargetMethod(patch); + ArtMethod* target = GetTargetMethod(patch); uint32_t code = reinterpret_cast(class_linker->GetOatCodeFor(target)); uint32_t code_base = reinterpret_cast(&oat_file_->GetOatHeader()); uint32_t code_offset = code - code_base; @@ -674,7 +674,7 @@ void ImageWriter::PatchOatCodeAndMethods() { const Patches& methods_to_patch = compiler_driver_.GetMethodsToPatch(); for (size_t i = 0; i < methods_to_patch.size(); i++) { const CompilerDriver::PatchInformation* patch = methods_to_patch[i]; - AbstractMethod* target = GetTargetMethod(patch); + ArtMethod* target = GetTargetMethod(patch); SetPatchLocation(patch, reinterpret_cast(GetImageAddress(target))); } diff --git a/compiler/image_writer.h b/compiler/image_writer.h index 545534fff7..750109d1d9 100644 --- a/compiler/image_writer.h +++ b/compiler/image_writer.h @@ -152,7 +152,7 @@ class ImageWriter { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void FixupClass(const mirror::Class* orig, mirror::Class* copy) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void FixupMethod(const mirror::AbstractMethod* orig, mirror::AbstractMethod* copy) + void FixupMethod(const mirror::ArtMethod* orig, mirror::ArtMethod* copy) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void FixupObject(const mirror::Object* orig, mirror::Object* copy) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc index 4b6967faa0..a653ab42a9 100644 --- a/compiler/jni/jni_compiler_test.cc +++ b/compiler/jni/jni_compiler_test.cc @@ -21,9 +21,9 @@ #include "indirect_reference_table.h" #include "jni_internal.h" #include "mem_map.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" #include "mirror/stack_trace_element.h" @@ -51,7 +51,7 @@ class JniCompilerTest : public CommonTest { // Compile the native method before starting the runtime mirror::Class* c = class_linker_->FindClass("LMyClassNatives;", soa.Decode(class_loader)); - mirror::AbstractMethod* method; + mirror::ArtMethod* method; if (direct) { method = c->FindDirectMethod(method_name, method_sig); } else { diff --git a/compiler/jni/portable/jni_compiler.cc b/compiler/jni/portable/jni_compiler.cc index e05f291a73..58ee1c1602 100644 --- a/compiler/jni/portable/jni_compiler.cc +++ b/compiler/jni/portable/jni_compiler.cc @@ -27,7 +27,7 @@ #include "llvm/llvm_compilation_unit.h" #include "llvm/runtime_support_llvm_func.h" #include "llvm/utils_llvm.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "runtime.h" #include "stack.h" #include "thread.h" @@ -91,7 +91,7 @@ CompiledMethod* JniCompiler::Compile() { // Load class object this_object_or_class_object = irb_.LoadFromObjectOffset(method_object_addr, - mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), + mirror::ArtMethod::DeclaringClassOffset().Int32Value(), irb_.getJObjectTy(), kTBAAConstJObject); } @@ -135,7 +135,7 @@ CompiledMethod* JniCompiler::Compile() { // Get callee code_addr ::llvm::Value* code_addr = irb_.LoadFromObjectOffset(method_object_addr, - mirror::AbstractMethod::NativeMethodOffset().Int32Value(), + mirror::ArtMethod::NativeMethodOffset().Int32Value(), GetFunctionType(dex_compilation_unit_->GetDexMethodIndex(), is_static, true)->getPointerTo(), kTBAARuntimeInfo); diff --git a/compiler/jni/portable/jni_compiler.h b/compiler/jni/portable/jni_compiler.h index 9bdf35ef10..49cc9f4abf 100644 --- a/compiler/jni/portable/jni_compiler.h +++ b/compiler/jni/portable/jni_compiler.h @@ -28,7 +28,7 @@ namespace art { class DexFile; class DexCompilationUnit; namespace mirror { - class AbstractMethod; + class ArtMethod; class ClassLoader; class DexCache; } // namespace mirror diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc index 9713fe9da9..069def60f9 100644 --- a/compiler/jni/quick/jni_compiler.cc +++ b/compiler/jni/quick/jni_compiler.cc @@ -119,7 +119,7 @@ CompiledMethod* ArtJniCompileMethodInternal(CompilerDriver& compiler, // Check sirt offset is within frame CHECK_LT(sirt_offset.Uint32Value(), frame_size); __ LoadRef(main_jni_conv->InterproceduralScratchRegister(), - mr_conv->MethodRegister(), mirror::AbstractMethod::DeclaringClassOffset()); + mr_conv->MethodRegister(), mirror::ArtMethod::DeclaringClassOffset()); __ VerifyObject(main_jni_conv->InterproceduralScratchRegister(), false); __ StoreRef(sirt_offset, main_jni_conv->InterproceduralScratchRegister()); main_jni_conv->Next(); // in SIRT so move to next argument @@ -270,7 +270,7 @@ CompiledMethod* ArtJniCompileMethodInternal(CompilerDriver& compiler, } // 9. Plant call to native code associated with method. - __ Call(main_jni_conv->MethodStackOffset(), mirror::AbstractMethod::NativeMethodOffset(), + __ Call(main_jni_conv->MethodStackOffset(), mirror::ArtMethod::NativeMethodOffset(), mr_conv->InterproceduralScratchRegister()); // 10. Fix differences in result widths. diff --git a/compiler/llvm/compiler_llvm.h b/compiler/llvm/compiler_llvm.h index 20934ab209..65bc16bcd8 100644 --- a/compiler/llvm/compiler_llvm.h +++ b/compiler/llvm/compiler_llvm.h @@ -34,7 +34,7 @@ namespace art { class CompilerDriver; class DexCompilationUnit; namespace mirror { - class AbstractMethod; + class ArtMethod; class ClassLoader; } // namespace mirror } // namespace art diff --git a/compiler/llvm/gbc_expander.cc b/compiler/llvm/gbc_expander.cc index a727d06cb2..4f6fa0a2df 100644 --- a/compiler/llvm/gbc_expander.cc +++ b/compiler/llvm/gbc_expander.cc @@ -20,7 +20,7 @@ #include "intrinsic_helper.h" #include "ir_builder.h" #include "method_reference.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/array.h" #include "mirror/string.h" #include "thread.h" @@ -722,7 +722,7 @@ llvm::Value* GBCExpanderPass::EmitLoadDexCacheAddr(art::MemberOffset offset) { llvm::Value* GBCExpanderPass::EmitLoadDexCacheStaticStorageFieldAddr(uint32_t type_idx) { llvm::Value* static_storage_dex_cache_addr = - EmitLoadDexCacheAddr(art::mirror::AbstractMethod::DexCacheInitializedStaticStorageOffset()); + EmitLoadDexCacheAddr(art::mirror::ArtMethod::DexCacheInitializedStaticStorageOffset()); llvm::Value* type_idx_value = irb_.getPtrEquivInt(type_idx); @@ -732,7 +732,7 @@ GBCExpanderPass::EmitLoadDexCacheStaticStorageFieldAddr(uint32_t type_idx) { llvm::Value* GBCExpanderPass::EmitLoadDexCacheResolvedTypeFieldAddr(uint32_t type_idx) { llvm::Value* resolved_type_dex_cache_addr = - EmitLoadDexCacheAddr(art::mirror::AbstractMethod::DexCacheResolvedTypesOffset()); + EmitLoadDexCacheAddr(art::mirror::ArtMethod::DexCacheResolvedTypesOffset()); llvm::Value* type_idx_value = irb_.getPtrEquivInt(type_idx); @@ -742,7 +742,7 @@ GBCExpanderPass::EmitLoadDexCacheResolvedTypeFieldAddr(uint32_t type_idx) { llvm::Value* GBCExpanderPass:: EmitLoadDexCacheResolvedMethodFieldAddr(uint32_t method_idx) { llvm::Value* resolved_method_dex_cache_addr = - EmitLoadDexCacheAddr(art::mirror::AbstractMethod::DexCacheResolvedMethodsOffset()); + EmitLoadDexCacheAddr(art::mirror::ArtMethod::DexCacheResolvedMethodsOffset()); llvm::Value* method_idx_value = irb_.getPtrEquivInt(method_idx); @@ -752,7 +752,7 @@ EmitLoadDexCacheResolvedMethodFieldAddr(uint32_t method_idx) { llvm::Value* GBCExpanderPass:: EmitLoadDexCacheStringFieldAddr(uint32_t string_idx) { llvm::Value* string_dex_cache_addr = - EmitLoadDexCacheAddr(art::mirror::AbstractMethod::DexCacheStringsOffset()); + EmitLoadDexCacheAddr(art::mirror::ArtMethod::DexCacheStringsOffset()); llvm::Value* string_idx_value = irb_.getPtrEquivInt(string_idx); @@ -911,7 +911,7 @@ llvm::Value* GBCExpanderPass::EmitInvoke(llvm::CallInst& call_inst) { } else { code_addr = irb_.LoadFromObjectOffset(callee_method_object_addr, - art::mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), + art::mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), func_type->getPointerTo(), kTBAARuntimeInfo); } @@ -1207,7 +1207,7 @@ void GBCExpanderPass::Expand_SPutFast(llvm::Value* static_storage_addr, llvm::Value* GBCExpanderPass::Expand_LoadDeclaringClassSSB(llvm::Value* method_object_addr) { return irb_.LoadFromObjectOffset(method_object_addr, - art::mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), + art::mirror::ArtMethod::DeclaringClassOffset().Int32Value(), irb_.getJObjectTy(), kTBAAConstJObject); } @@ -1259,7 +1259,7 @@ llvm::Value* GBCExpanderPass::Expand_Invoke(llvm::CallInst& call_inst) { llvm::Value* code_addr = irb_.LoadFromObjectOffset(callee_method_object_addr, - art::mirror::AbstractMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), + art::mirror::ArtMethod::GetEntryPointFromCompiledCodeOffset().Int32Value(), callee_method_type->getPointerTo(), kTBAARuntimeInfo); @@ -1938,7 +1938,7 @@ llvm::Value* GBCExpanderPass::Expand_HLSget(llvm::CallInst& call_inst, static_storage_addr = irb_.LoadFromObjectOffset(method_object_addr, - art::mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), + art::mirror::ArtMethod::DeclaringClassOffset().Int32Value(), irb_.getJObjectTy(), kTBAAConstJObject); } else { @@ -2023,7 +2023,7 @@ void GBCExpanderPass::Expand_HLSput(llvm::CallInst& call_inst, static_storage_addr = irb_.LoadFromObjectOffset(method_object_addr, - art::mirror::AbstractMethod::DeclaringClassOffset().Int32Value(), + art::mirror::ArtMethod::DeclaringClassOffset().Int32Value(), irb_.getJObjectTy(), kTBAAConstJObject); } else { diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index ce88cf6dd6..f813843bd3 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -23,7 +23,7 @@ #include "class_linker.h" #include "dex_file-inl.h" #include "gc/space/space.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/array.h" #include "mirror/class_loader.h" #include "mirror/object-inl.h" @@ -400,7 +400,7 @@ size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, mirror::DexCache* dex_cache = linker->FindDexCache(*dex_file); // Unchecked as we hold mutator_lock_ on entry. ScopedObjectAccessUnchecked soa(Thread::Current()); - mirror::AbstractMethod* method = linker->ResolveMethod(*dex_file, method_idx, dex_cache, + mirror::ArtMethod* method = linker->ResolveMethod(*dex_file, method_idx, dex_cache, NULL, NULL, invoke_type); CHECK(method != NULL); method->SetFrameSizeInBytes(frame_size_in_bytes); diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index b85378d9ec..c372d000df 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -37,7 +37,7 @@ #include "gc/space/space-inl.h" #include "image_writer.h" #include "leb128.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/object-inl.h" @@ -862,7 +862,7 @@ static int dex2oat(int argc, char** argv) { // give it away now and then switch to a more managable ScopedObjectAccess. Thread::Current()->TransitionFromRunnableToSuspended(kNative); // Whilst we're in native take the opportunity to initialize well known classes. - WellKnownClasses::InitClasses(Thread::Current()->GetJniEnv()); + WellKnownClasses::Init(Thread::Current()->GetJniEnv()); ScopedObjectAccess soa(Thread::Current()); // If --image-classes was specified, calculate the full list of classes to include in the image diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc index a6f295f46d..67398afd5f 100644 --- a/oatdump/oatdump.cc +++ b/oatdump/oatdump.cc @@ -36,10 +36,10 @@ #include "image.h" #include "indenter.h" #include "mapping_table.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/array-inl.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "oat.h" @@ -169,7 +169,7 @@ class OatDumper { return oat_file_.GetOatHeader().GetInstructionSet(); } - const void* GetOatCode(mirror::AbstractMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + const void* GetOatCode(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { MethodHelper mh(m); for (size_t i = 0; i < oat_dex_files_.size(); i++) { const OatFile::OatDexFile* oat_dex_file = oat_dex_files_[i]; @@ -804,18 +804,18 @@ class ImageDumper { } else if (type->IsClassClass()) { mirror::Class* klass = value->AsClass(); os << StringPrintf("%p Class: %s\n", klass, PrettyDescriptor(klass).c_str()); - } else if (type->IsFieldClass()) { - mirror::Field* field = value->AsField(); + } else if (type->IsArtFieldClass()) { + mirror::ArtField* field = value->AsArtField(); os << StringPrintf("%p Field: %s\n", field, PrettyField(field).c_str()); - } else if (type->IsMethodClass()) { - mirror::AbstractMethod* method = value->AsMethod(); + } else if (type->IsArtMethodClass()) { + mirror::ArtMethod* method = value->AsArtMethod(); os << StringPrintf("%p Method: %s\n", method, PrettyMethod(method).c_str()); } else { os << StringPrintf("%p %s\n", value, PrettyDescriptor(type).c_str()); } } - static void PrintField(std::ostream& os, mirror::Field* field, mirror::Object* obj) + static void PrintField(std::ostream& os, mirror::ArtField* field, mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FieldHelper fh(field); const char* descriptor = fh.GetTypeDescriptor(); @@ -856,10 +856,10 @@ class ImageDumper { if (super != NULL) { DumpFields(os, obj, super); } - mirror::ObjectArray* fields = klass->GetIFields(); + mirror::ObjectArray* fields = klass->GetIFields(); if (fields != NULL) { for (int32_t i = 0; i < fields->GetLength(); i++) { - mirror::Field* field = fields->Get(i); + mirror::ArtField* field = fields->Get(i); PrintField(os, field, obj); } } @@ -869,7 +869,7 @@ class ImageDumper { return image_space_.Contains(object); } - const void* GetOatCodeBegin(mirror::AbstractMethod* m) + const void* GetOatCodeBegin(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { const void* code = m->GetEntryPointFromCompiledCode(); if (code == GetResolutionTrampoline(Runtime::Current()->GetClassLinker())) { @@ -881,7 +881,7 @@ class ImageDumper { return code; } - uint32_t GetOatCodeSize(mirror::AbstractMethod* m) + uint32_t GetOatCodeSize(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { const uint32_t* oat_code_begin = reinterpret_cast(GetOatCodeBegin(m)); if (oat_code_begin == NULL) { @@ -890,7 +890,7 @@ class ImageDumper { return oat_code_begin[-1]; } - const void* GetOatCodeEnd(mirror::AbstractMethod* m) + const void* GetOatCodeEnd(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { const uint8_t* oat_code_begin = reinterpret_cast(GetOatCodeBegin(m)); if (oat_code_begin == NULL) { @@ -922,12 +922,12 @@ class ImageDumper { mirror::Class* klass = obj->AsClass(); os << StringPrintf("%p: java.lang.Class \"%s\" (", obj, PrettyDescriptor(klass).c_str()) << klass->GetStatus() << ")\n"; - } else if (obj->IsField()) { + } else if (obj->IsArtField()) { os << StringPrintf("%p: java.lang.reflect.Field %s\n", obj, - PrettyField(obj->AsField()).c_str()); - } else if (obj->IsMethod()) { + PrettyField(obj->AsArtField()).c_str()); + } else if (obj->IsArtMethod()) { os << StringPrintf("%p: java.lang.reflect.Method %s\n", obj, - PrettyMethod(obj->AsMethod()).c_str()); + PrettyMethod(obj->AsArtMethod()).c_str()); } else if (obj_class->IsStringClass()) { os << StringPrintf("%p: java.lang.String %s\n", obj, PrintableString(obj->AsString()->ToModifiedUtf8()).c_str()); @@ -960,18 +960,18 @@ class ImageDumper { PrettyObjectValue(indent_os, value_class, value); } } else if (obj->IsClass()) { - mirror::ObjectArray* sfields = obj->AsClass()->GetSFields(); + mirror::ObjectArray* sfields = obj->AsClass()->GetSFields(); if (sfields != NULL) { indent_os << "STATICS:\n"; Indenter indent2_filter(indent_os.rdbuf(), kIndentChar, kIndentBy1Count); std::ostream indent2_os(&indent2_filter); for (int32_t i = 0; i < sfields->GetLength(); i++) { - mirror::Field* field = sfields->Get(i); + mirror::ArtField* field = sfields->Get(i); PrintField(indent2_os, field, field->GetDeclaringClass()); } } - } else if (obj->IsMethod()) { - mirror::AbstractMethod* method = obj->AsMethod(); + } else if (obj->IsArtMethod()) { + mirror::ArtMethod* method = obj->AsArtMethod(); if (method->IsNative()) { DCHECK(method->GetNativeGcMap() == NULL) << PrettyMethod(method); DCHECK(method->GetMappingTable() == NULL) << PrettyMethod(method); @@ -1085,7 +1085,7 @@ class ImageDumper { size_t dex_instruction_bytes; - std::vector method_outlier; + std::vector method_outlier; std::vector method_outlier_size; std::vector method_outlier_expansion; std::vector > oat_dex_file_sizes; @@ -1138,7 +1138,7 @@ class ImageDumper { return (static_cast(size) / static_cast(object_bytes)) * 100; } - void ComputeOutliers(size_t total_size, double expansion, mirror::AbstractMethod* method) { + void ComputeOutliers(size_t total_size, double expansion, mirror::ArtMethod* method) { method_outlier_size.push_back(total_size); method_outlier_expansion.push_back(expansion); method_outlier.push_back(method); diff --git a/runtime/Android.mk b/runtime/Android.mk index 69e13e58f5..b34abe4282 100644 --- a/runtime/Android.mk +++ b/runtime/Android.mk @@ -78,11 +78,11 @@ LIBART_COMMON_SRC_FILES := \ locks.cc \ mem_map.cc \ memory_region.cc \ - mirror/abstract_method.cc \ + mirror/art_field.cc \ + mirror/art_method.cc \ mirror/array.cc \ mirror/class.cc \ mirror/dex_cache.cc \ - mirror/field.cc \ mirror/object.cc \ mirror/stack_trace_element.cc \ mirror/string.cc \ diff --git a/runtime/arch/arm/context_arm.cc b/runtime/arch/arm/context_arm.cc index 6b9538e801..102e1269b5 100644 --- a/runtime/arch/arm/context_arm.cc +++ b/runtime/arch/arm/context_arm.cc @@ -16,7 +16,7 @@ #include "context_arm.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/object-inl.h" #include "stack.h" #include "thread.h" @@ -41,7 +41,7 @@ void ArmContext::Reset() { } void ArmContext::FillCalleeSaves(const StackVisitor& fr) { - mirror::AbstractMethod* method = fr.GetMethod(); + mirror::ArtMethod* method = fr.GetMethod(); uint32_t core_spills = method->GetCoreSpillMask(); uint32_t fp_core_spills = method->GetFpSpillMask(); size_t spill_count = __builtin_popcount(core_spills); diff --git a/runtime/arch/arm/entrypoints_init_arm.cc b/runtime/arch/arm/entrypoints_init_arm.cc index 810a6832b6..9e6902de3f 100644 --- a/runtime/arch/arm/entrypoints_init_arm.cc +++ b/runtime/arch/arm/entrypoints_init_arm.cc @@ -31,8 +31,8 @@ extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& m ShadowFrame* shadow_frame, JValue* result); // Portable entrypoints. -extern "C" void art_portable_resolution_trampoline(mirror::AbstractMethod*); -extern "C" void art_portable_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_portable_resolution_trampoline(mirror::ArtMethod*); +extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*); // Alloc entrypoints. extern "C" void* art_quick_alloc_array(uint32_t, void*, int32_t); @@ -112,8 +112,8 @@ extern "C" int32_t art_quick_indexof(void*, uint32_t, uint32_t, uint32_t); extern "C" int32_t art_quick_string_compareto(void*, void*); // Invoke entrypoints. -extern "C" void art_quick_resolution_trampoline(mirror::AbstractMethod*); -extern "C" void art_quick_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_quick_resolution_trampoline(mirror::ArtMethod*); +extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*); extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*); extern "C" void art_quick_invoke_interface_trampoline(uint32_t, void*); extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*); diff --git a/runtime/arch/mips/context_mips.cc b/runtime/arch/mips/context_mips.cc index a78e5ee80d..b957708769 100644 --- a/runtime/arch/mips/context_mips.cc +++ b/runtime/arch/mips/context_mips.cc @@ -16,7 +16,7 @@ #include "context_mips.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/object-inl.h" #include "stack.h" @@ -40,7 +40,7 @@ void MipsContext::Reset() { } void MipsContext::FillCalleeSaves(const StackVisitor& fr) { - mirror::AbstractMethod* method = fr.GetMethod(); + mirror::ArtMethod* method = fr.GetMethod(); uint32_t core_spills = method->GetCoreSpillMask(); uint32_t fp_core_spills = method->GetFpSpillMask(); size_t spill_count = __builtin_popcount(core_spills); diff --git a/runtime/arch/mips/entrypoints_init_mips.cc b/runtime/arch/mips/entrypoints_init_mips.cc index a0d3995bce..40d7cd913c 100644 --- a/runtime/arch/mips/entrypoints_init_mips.cc +++ b/runtime/arch/mips/entrypoints_init_mips.cc @@ -30,8 +30,8 @@ extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& m ShadowFrame* shadow_frame, JValue* result); // Portable entrypoints. -extern "C" void art_portable_resolution_trampoline(mirror::AbstractMethod*); -extern "C" void art_portable_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_portable_resolution_trampoline(mirror::ArtMethod*); +extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*); // Alloc entrypoints. extern "C" void* art_quick_alloc_array(uint32_t, void*, int32_t); @@ -113,8 +113,8 @@ extern "C" int32_t art_quick_indexof(void*, uint32_t, uint32_t, uint32_t); extern "C" int32_t art_quick_string_compareto(void*, void*); // Invoke entrypoints. -extern "C" void art_quick_resolution_trampoline(mirror::AbstractMethod*); -extern "C" void art_quick_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_quick_resolution_trampoline(mirror::ArtMethod*); +extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*); extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*); extern "C" void art_quick_invoke_interface_trampoline(uint32_t, void*); extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*); diff --git a/runtime/arch/x86/context_x86.cc b/runtime/arch/x86/context_x86.cc index c728ae97ec..66a51f7492 100644 --- a/runtime/arch/x86/context_x86.cc +++ b/runtime/arch/x86/context_x86.cc @@ -16,7 +16,7 @@ #include "context_x86.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/object-inl.h" #include "stack.h" @@ -36,7 +36,7 @@ void X86Context::Reset() { } void X86Context::FillCalleeSaves(const StackVisitor& fr) { - mirror::AbstractMethod* method = fr.GetMethod(); + mirror::ArtMethod* method = fr.GetMethod(); uint32_t core_spills = method->GetCoreSpillMask(); size_t spill_count = __builtin_popcount(core_spills); DCHECK_EQ(method->GetFpSpillMask(), 0u); diff --git a/runtime/arch/x86/entrypoints_init_x86.cc b/runtime/arch/x86/entrypoints_init_x86.cc index 9b54d55bfc..abc2990cc0 100644 --- a/runtime/arch/x86/entrypoints_init_x86.cc +++ b/runtime/arch/x86/entrypoints_init_x86.cc @@ -29,8 +29,8 @@ extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& m ShadowFrame* shadow_frame, JValue* result); // Portable entrypoints. -extern "C" void art_portable_resolution_trampoline(mirror::AbstractMethod*); -extern "C" void art_portable_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_portable_resolution_trampoline(mirror::ArtMethod*); +extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*); // Alloc entrypoints. extern "C" void* art_quick_alloc_array(uint32_t, void*, int32_t); @@ -95,8 +95,8 @@ extern "C" int32_t art_quick_string_compareto(void*, void*); extern "C" void* art_quick_memcpy(void*, const void*, size_t); // Invoke entrypoints. -extern "C" void art_quick_resolution_trampoline(mirror::AbstractMethod*); -extern "C" void art_quick_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_quick_resolution_trampoline(mirror::ArtMethod*); +extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*); extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*); extern "C" void art_quick_invoke_interface_trampoline(uint32_t, void*); extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*); diff --git a/runtime/check_jni.cc b/runtime/check_jni.cc index 073d67b823..6a7ceeed0b 100644 --- a/runtime/check_jni.cc +++ b/runtime/check_jni.cc @@ -24,9 +24,9 @@ #include "class_linker-inl.h" #include "dex_file-inl.h" #include "gc/space/space.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/throwable.h" @@ -44,7 +44,7 @@ namespace art { static void JniAbort(const char* jni_function_name, const char* msg) { Thread* self = Thread::Current(); ScopedObjectAccess soa(self); - mirror::AbstractMethod* current_method = self->GetCurrentMethod(NULL); + mirror::ArtMethod* current_method = self->GetCurrentMethod(NULL); std::ostringstream os; os << "JNI DETECTED ERROR IN APPLICATION: " << msg; @@ -131,7 +131,7 @@ static const char* gBuiltInPrefixes[] = { NULL }; -static bool ShouldTrace(JavaVMExt* vm, const mirror::AbstractMethod* method) +static bool ShouldTrace(JavaVMExt* vm, const mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // If both "-Xcheck:jni" and "-Xjnitrace:" are enabled, we print trace messages // when a native method that matches the -Xjnitrace argument calls a JNI function @@ -204,7 +204,7 @@ class ScopedCheck { */ void CheckFieldType(jobject java_object, jfieldID fid, char prim, bool isStatic) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* f = CheckFieldID(fid); + mirror::ArtField* f = CheckFieldID(fid); if (f == NULL) { return; } @@ -259,7 +259,7 @@ class ScopedCheck { return; } - mirror::Field* f = CheckFieldID(fid); + mirror::ArtField* f = CheckFieldID(fid); if (f == NULL) { return; } @@ -286,7 +286,7 @@ class ScopedCheck { */ void CheckSig(jmethodID mid, const char* expectedType, bool isStatic) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = CheckMethodID(mid); + mirror::ArtMethod* m = CheckMethodID(mid); if (m == NULL) { return; } @@ -313,7 +313,7 @@ class ScopedCheck { void CheckStaticFieldID(jclass java_class, jfieldID fid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { mirror::Class* c = soa_.Decode(java_class); - const mirror::Field* f = CheckFieldID(fid); + const mirror::ArtField* f = CheckFieldID(fid); if (f == NULL) { return; } @@ -334,7 +334,7 @@ class ScopedCheck { */ void CheckStaticMethod(jclass java_class, jmethodID mid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - const mirror::AbstractMethod* m = CheckMethodID(mid); + const mirror::ArtMethod* m = CheckMethodID(mid); if (m == NULL) { return; } @@ -354,7 +354,7 @@ class ScopedCheck { */ void CheckVirtualMethod(jobject java_object, jmethodID mid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - const mirror::AbstractMethod* m = CheckMethodID(mid); + const mirror::ArtMethod* m = CheckMethodID(mid); if (m == NULL) { return; } @@ -404,7 +404,7 @@ class ScopedCheck { void Check(bool entry, const char* fmt0, ...) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { va_list ap; - const mirror::AbstractMethod* traceMethod = NULL; + const mirror::ArtMethod* traceMethod = NULL; if (has_method_ && (!soa_.Vm()->trace.empty() || VLOG_IS_ON(third_party_jni))) { // We need to guard some of the invocation interface's calls: a bad caller might // use DetachCurrentThread or GetEnv on a thread that's not yet attached. @@ -477,7 +477,7 @@ class ScopedCheck { } } else if (ch == 'f') { // jfieldID jfieldID fid = va_arg(ap, jfieldID); - mirror::Field* f = reinterpret_cast(fid); + mirror::ArtField* f = reinterpret_cast(fid); msg += PrettyField(f); if (!entry) { StringAppendF(&msg, " (%p)", fid); @@ -490,7 +490,7 @@ class ScopedCheck { StringAppendF(&msg, "%d", i); } else if (ch == 'm') { // jmethodID jmethodID mid = va_arg(ap, jmethodID); - mirror::AbstractMethod* m = reinterpret_cast(mid); + mirror::ArtMethod* m = reinterpret_cast(mid); msg += PrettyMethod(m); if (!entry) { StringAppendF(&msg, " (%p)", mid); @@ -700,13 +700,13 @@ class ScopedCheck { } } - mirror::Field* CheckFieldID(jfieldID fid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + mirror::ArtField* CheckFieldID(jfieldID fid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (fid == NULL) { JniAbortF(function_name_, "jfieldID was NULL"); return NULL; } - mirror::Field* f = soa_.DecodeField(fid); - if (!Runtime::Current()->GetHeap()->IsHeapAddress(f) || !f->IsField()) { + mirror::ArtField* f = soa_.DecodeField(fid); + if (!Runtime::Current()->GetHeap()->IsHeapAddress(f) || !f->IsArtField()) { Runtime::Current()->GetHeap()->DumpSpaces(); JniAbortF(function_name_, "invalid jfieldID: %p", fid); return NULL; @@ -714,13 +714,13 @@ class ScopedCheck { return f; } - mirror::AbstractMethod* CheckMethodID(jmethodID mid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + mirror::ArtMethod* CheckMethodID(jmethodID mid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (mid == NULL) { JniAbortF(function_name_, "jmethodID was NULL"); return NULL; } - mirror::AbstractMethod* m = soa_.DecodeMethod(mid); - if (!Runtime::Current()->GetHeap()->IsHeapAddress(m) || !m->IsMethod()) { + mirror::ArtMethod* m = soa_.DecodeMethod(mid); + if (!Runtime::Current()->GetHeap()->IsHeapAddress(m) || !m->IsArtMethod()) { Runtime::Current()->GetHeap()->DumpSpaces(); JniAbortF(function_name_, "invalid jmethodID: %p", mid); return NULL; diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index 4d01b66f0a..ad568b1cdb 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -19,15 +19,15 @@ #include "class_linker.h" +#include "mirror/art_field.h" #include "mirror/dex_cache.h" -#include "mirror/field.h" #include "mirror/iftable.h" #include "mirror/object_array.h" namespace art { inline mirror::String* ClassLinker::ResolveString(uint32_t string_idx, - const mirror::AbstractMethod* referrer) { + const mirror::ArtMethod* referrer) { mirror::String* resolved_string = referrer->GetDexCacheStrings()->Get(string_idx); if (UNLIKELY(resolved_string == NULL)) { mirror::Class* declaring_class = referrer->GetDeclaringClass(); @@ -39,7 +39,7 @@ inline mirror::String* ClassLinker::ResolveString(uint32_t string_idx, } inline mirror::Class* ClassLinker::ResolveType(uint16_t type_idx, - const mirror::AbstractMethod* referrer) { + const mirror::ArtMethod* referrer) { mirror::Class* resolved_type = referrer->GetDexCacheResolvedTypes()->Get(type_idx); if (UNLIKELY(resolved_type == NULL)) { mirror::Class* declaring_class = referrer->GetDeclaringClass(); @@ -51,7 +51,7 @@ inline mirror::Class* ClassLinker::ResolveType(uint16_t type_idx, return resolved_type; } -inline mirror::Class* ClassLinker::ResolveType(uint16_t type_idx, const mirror::Field* referrer) { +inline mirror::Class* ClassLinker::ResolveType(uint16_t type_idx, const mirror::ArtField* referrer) { mirror::Class* declaring_class = referrer->GetDeclaringClass(); mirror::DexCache* dex_cache = declaring_class->GetDexCache(); mirror::Class* resolved_type = dex_cache->GetResolvedType(type_idx); @@ -63,10 +63,10 @@ inline mirror::Class* ClassLinker::ResolveType(uint16_t type_idx, const mirror:: return resolved_type; } -inline mirror::AbstractMethod* ClassLinker::ResolveMethod(uint32_t method_idx, - const mirror::AbstractMethod* referrer, - InvokeType type) { - mirror::AbstractMethod* resolved_method = +inline mirror::ArtMethod* ClassLinker::ResolveMethod(uint32_t method_idx, + const mirror::ArtMethod* referrer, + InvokeType type) { + mirror::ArtMethod* resolved_method = referrer->GetDexCacheResolvedMethods()->Get(method_idx); if (UNLIKELY(resolved_method == NULL || resolved_method->IsRuntimeMethod())) { mirror::Class* declaring_class = referrer->GetDeclaringClass(); @@ -78,10 +78,10 @@ inline mirror::AbstractMethod* ClassLinker::ResolveMethod(uint32_t method_idx, return resolved_method; } -inline mirror::Field* ClassLinker::ResolveField(uint32_t field_idx, - const mirror::AbstractMethod* referrer, - bool is_static) { - mirror::Field* resolved_field = +inline mirror::ArtField* ClassLinker::ResolveField(uint32_t field_idx, + const mirror::ArtMethod* referrer, + bool is_static) { + mirror::ArtField* resolved_field = referrer->GetDeclaringClass()->GetDexCache()->GetResolvedField(field_idx); if (UNLIKELY(resolved_field == NULL)) { mirror::Class* declaring_class = referrer->GetDeclaringClass(); @@ -109,16 +109,10 @@ inline mirror::ObjectArray* ClassLinker::AllocStringArray(Thread length); } -inline mirror::ObjectArray* ClassLinker::AllocAbstractMethodArray(Thread* self, - size_t length) { - return mirror::ObjectArray::Alloc(self, - GetClassRoot(kJavaLangReflectAbstractMethodArrayClass), length); -} - -inline mirror::ObjectArray* ClassLinker::AllocMethodArray(Thread* self, - size_t length) { - return mirror::ObjectArray::Alloc(self, - GetClassRoot(kJavaLangReflectMethodArrayClass), length); +inline mirror::ObjectArray* ClassLinker::AllocArtMethodArray(Thread* self, + size_t length) { + return mirror::ObjectArray::Alloc(self, + GetClassRoot(kJavaLangReflectArtMethodArrayClass), length); } inline mirror::IfTable* ClassLinker::AllocIfTable(Thread* self, size_t ifcount) { @@ -126,11 +120,11 @@ inline mirror::IfTable* ClassLinker::AllocIfTable(Thread* self, size_t ifcount) mirror::IfTable::Alloc(self, GetClassRoot(kObjectArrayClass), ifcount * mirror::IfTable::kMax)); } -inline mirror::ObjectArray* ClassLinker::AllocFieldArray(Thread* self, - size_t length) { - return mirror::ObjectArray::Alloc(self, - GetClassRoot(kJavaLangReflectFieldArrayClass), - length); +inline mirror::ObjectArray* ClassLinker::AllocArtFieldArray(Thread* self, + size_t length) { + return mirror::ObjectArray::Alloc(self, + GetClassRoot(kJavaLangReflectArtFieldArrayClass), + length); } inline mirror::Class* ClassLinker::GetClassRoot(ClassRoot class_root) diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index c7a8f7e3d4..1e21736d66 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -43,14 +43,13 @@ #include "leb128.h" #include "oat.h" #include "oat_file.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/dex_cache-inl.h" -#include "mirror/field-inl.h" #include "mirror/iftable-inl.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/proxy.h" @@ -145,15 +144,12 @@ const char* ClassLinker::class_roots_descriptors_[] = { "Ljava/lang/String;", "Ljava/lang/DexCache;", "Ljava/lang/ref/Reference;", - "Ljava/lang/reflect/Constructor;", - "Ljava/lang/reflect/Field;", - "Ljava/lang/reflect/AbstractMethod;", - "Ljava/lang/reflect/Method;", + "Ljava/lang/reflect/ArtField;", + "Ljava/lang/reflect/ArtMethod;", "Ljava/lang/reflect/Proxy;", "[Ljava/lang/String;", - "[Ljava/lang/reflect/AbstractMethod;", - "[Ljava/lang/reflect/Field;", - "[Ljava/lang/reflect/Method;", + "[Ljava/lang/reflect/ArtField;", + "[Ljava/lang/reflect/ArtMethod;", "Ljava/lang/ClassLoader;", "Ljava/lang/Throwable;", "Ljava/lang/ClassNotFoundException;", @@ -292,56 +288,38 @@ void ClassLinker::InitFromCompiler(const std::vector& boot_class java_lang_DexCache->SetStatus(mirror::Class::kStatusResolved); // Constructor, Field, Method, and AbstractMethod are necessary so that FindClass can link members. - SirtRef java_lang_reflect_Field(self, AllocClass(self, java_lang_Class.get(), - sizeof(mirror::FieldClass))); - CHECK(java_lang_reflect_Field.get() != NULL); - java_lang_reflect_Field->SetObjectSize(sizeof(mirror::Field)); - SetClassRoot(kJavaLangReflectField, java_lang_reflect_Field.get()); - java_lang_reflect_Field->SetStatus(mirror::Class::kStatusResolved); - mirror::Field::SetClass(java_lang_reflect_Field.get()); - - SirtRef java_lang_reflect_AbstractMethod(self, AllocClass(self, java_lang_Class.get(), - sizeof(mirror::AbstractMethodClass))); - CHECK(java_lang_reflect_AbstractMethod.get() != NULL); - java_lang_reflect_AbstractMethod->SetObjectSize(sizeof(mirror::AbstractMethod)); - SetClassRoot(kJavaLangReflectAbstractMethod, java_lang_reflect_AbstractMethod.get()); - java_lang_reflect_AbstractMethod->SetStatus(mirror::Class::kStatusResolved); - - SirtRef java_lang_reflect_Constructor(self, AllocClass(self, java_lang_Class.get(), - sizeof(mirror::AbstractMethodClass))); - CHECK(java_lang_reflect_Constructor.get() != NULL); - java_lang_reflect_Constructor->SetObjectSize(sizeof(mirror::Constructor)); - java_lang_reflect_Constructor->SetSuperClass(java_lang_reflect_AbstractMethod.get()); - SetClassRoot(kJavaLangReflectConstructor, java_lang_reflect_Constructor.get()); - java_lang_reflect_Constructor->SetStatus(mirror::Class::kStatusResolved); - - SirtRef java_lang_reflect_Method(self, AllocClass(self, java_lang_Class.get(), - sizeof(mirror::AbstractMethodClass))); - CHECK(java_lang_reflect_Method.get() != NULL); - java_lang_reflect_Method->SetObjectSize(sizeof(mirror::Method)); - java_lang_reflect_Method->SetSuperClass(java_lang_reflect_AbstractMethod.get()); - SetClassRoot(kJavaLangReflectMethod, java_lang_reflect_Method.get()); - java_lang_reflect_Method->SetStatus(mirror::Class::kStatusResolved); - - mirror::AbstractMethod::SetClasses(java_lang_reflect_Constructor.get(), - java_lang_reflect_Method.get()); + SirtRef java_lang_reflect_ArtField(self, AllocClass(self, java_lang_Class.get(), + sizeof(mirror::ArtFieldClass))); + CHECK(java_lang_reflect_ArtField.get() != NULL); + java_lang_reflect_ArtField->SetObjectSize(sizeof(mirror::ArtField)); + SetClassRoot(kJavaLangReflectArtField, java_lang_reflect_ArtField.get()); + java_lang_reflect_ArtField->SetStatus(mirror::Class::kStatusResolved); + mirror::ArtField::SetClass(java_lang_reflect_ArtField.get()); + + SirtRef java_lang_reflect_ArtMethod(self, AllocClass(self, java_lang_Class.get(), + sizeof(mirror::ArtMethodClass))); + CHECK(java_lang_reflect_ArtMethod.get() != NULL); + java_lang_reflect_ArtMethod->SetObjectSize(sizeof(mirror::ArtMethod)); + SetClassRoot(kJavaLangReflectArtMethod, java_lang_reflect_ArtMethod.get()); + java_lang_reflect_ArtMethod->SetStatus(mirror::Class::kStatusResolved); + + mirror::ArtMethod::SetClass(java_lang_reflect_ArtMethod.get()); // Set up array classes for string, field, method - SirtRef object_array_string(self, AllocClass(self, java_lang_Class.get(), sizeof(mirror::Class))); + SirtRef object_array_string(self, AllocClass(self, java_lang_Class.get(), + sizeof(mirror::Class))); object_array_string->SetComponentType(java_lang_String.get()); SetClassRoot(kJavaLangStringArrayClass, object_array_string.get()); - SirtRef object_array_abstract_method(self, AllocClass(self, java_lang_Class.get(), sizeof(mirror::Class))); - object_array_abstract_method->SetComponentType(java_lang_reflect_AbstractMethod.get()); - SetClassRoot(kJavaLangReflectAbstractMethodArrayClass, object_array_abstract_method.get()); + SirtRef object_array_art_method(self, AllocClass(self, java_lang_Class.get(), + sizeof(mirror::Class))); + object_array_art_method->SetComponentType(java_lang_reflect_ArtMethod.get()); + SetClassRoot(kJavaLangReflectArtMethodArrayClass, object_array_art_method.get()); - SirtRef object_array_field(self, AllocClass(self, java_lang_Class.get(), sizeof(mirror::Class))); - object_array_field->SetComponentType(java_lang_reflect_Field.get()); - SetClassRoot(kJavaLangReflectFieldArrayClass, object_array_field.get()); - - SirtRef object_array_method(self, AllocClass(self, java_lang_Class.get(), sizeof(mirror::Class))); - object_array_method->SetComponentType(java_lang_reflect_Method.get()); - SetClassRoot(kJavaLangReflectMethodArrayClass, object_array_method.get()); + SirtRef object_array_art_field(self, AllocClass(self, java_lang_Class.get(), + sizeof(mirror::Class))); + object_array_art_field->SetComponentType(java_lang_reflect_ArtField.get()); + SetClassRoot(kJavaLangReflectArtFieldArrayClass, object_array_art_field.get()); // Setup boot_class_path_ and register class_path now that we can use AllocObjectArray to create // DexCache instances. Needs to be after String, Field, Method arrays since AllocDexCache uses @@ -422,42 +400,29 @@ void ClassLinker::InitFromCompiler(const std::vector& boot_class kh.ChangeClass(object_array_class.get()); CHECK_EQ(java_lang_Cloneable, kh.GetDirectInterface(0)); CHECK_EQ(java_io_Serializable, kh.GetDirectInterface(1)); - // Run Class, Constructor, Field, and Method through FindSystemClass. This initializes their + // Run Class, ArtField, and ArtMethod through FindSystemClass. This initializes their // dex_cache_ fields and register them in classes_. mirror::Class* Class_class = FindSystemClass("Ljava/lang/Class;"); CHECK_EQ(java_lang_Class.get(), Class_class); - java_lang_reflect_AbstractMethod->SetStatus(mirror::Class::kStatusNotReady); - mirror::Class* Abstract_method_class = FindSystemClass("Ljava/lang/reflect/AbstractMethod;"); - CHECK_EQ(java_lang_reflect_AbstractMethod.get(), Abstract_method_class); - - // Method extends AbstractMethod so must reset after. - java_lang_reflect_Method->SetStatus(mirror::Class::kStatusNotReady); - mirror::Class* Method_class = FindSystemClass("Ljava/lang/reflect/Method;"); - CHECK_EQ(java_lang_reflect_Method.get(), Method_class); + java_lang_reflect_ArtMethod->SetStatus(mirror::Class::kStatusNotReady); + mirror::Class* Art_method_class = FindSystemClass("Ljava/lang/reflect/ArtMethod;"); + CHECK_EQ(java_lang_reflect_ArtMethod.get(), Art_method_class); - // Constructor extends AbstractMethod so must reset after. - java_lang_reflect_Constructor->SetStatus(mirror::Class::kStatusNotReady); - mirror::Class* Constructor_class = FindSystemClass("Ljava/lang/reflect/Constructor;"); - CHECK_EQ(java_lang_reflect_Constructor.get(), Constructor_class); - - java_lang_reflect_Field->SetStatus(mirror::Class::kStatusNotReady); - mirror::Class* Field_class = FindSystemClass("Ljava/lang/reflect/Field;"); - CHECK_EQ(java_lang_reflect_Field.get(), Field_class); + java_lang_reflect_ArtField->SetStatus(mirror::Class::kStatusNotReady); + mirror::Class* Art_field_class = FindSystemClass("Ljava/lang/reflect/ArtField;"); + CHECK_EQ(java_lang_reflect_ArtField.get(), Art_field_class); mirror::Class* String_array_class = FindSystemClass(class_roots_descriptors_[kJavaLangStringArrayClass]); CHECK_EQ(object_array_string.get(), String_array_class); - mirror::Class* Abstract_method_array_class = - FindSystemClass(class_roots_descriptors_[kJavaLangReflectAbstractMethodArrayClass]); - CHECK_EQ(object_array_abstract_method.get(), Abstract_method_array_class); - - mirror::Class* Field_array_class = FindSystemClass(class_roots_descriptors_[kJavaLangReflectFieldArrayClass]); - CHECK_EQ(object_array_field.get(), Field_array_class); + mirror::Class* Art_method_array_class = + FindSystemClass(class_roots_descriptors_[kJavaLangReflectArtMethodArrayClass]); + CHECK_EQ(object_array_art_method.get(), Art_method_array_class); - mirror::Class* Method_array_class = - FindSystemClass(class_roots_descriptors_[kJavaLangReflectMethodArrayClass]); - CHECK_EQ(object_array_method.get(), Method_array_class); + mirror::Class* Art_field_array_class = + FindSystemClass(class_roots_descriptors_[kJavaLangReflectArtFieldArrayClass]); + CHECK_EQ(object_array_art_field.get(), Art_field_array_class); // End of special init trickery, subsequent classes may be loaded via FindSystemClass. @@ -516,31 +481,31 @@ void ClassLinker::FinishInit() { const DexFile& java_lang_dex = *java_lang_ref_Reference->GetDexCache()->GetDexFile(); - mirror::Field* pendingNext = java_lang_ref_Reference->GetInstanceField(0); + mirror::ArtField* pendingNext = java_lang_ref_Reference->GetInstanceField(0); FieldHelper fh(pendingNext, this); CHECK_STREQ(fh.GetName(), "pendingNext"); CHECK_EQ(java_lang_dex.GetFieldId(pendingNext->GetDexFieldIndex()).type_idx_, java_lang_ref_Reference->GetDexTypeIndex()); - mirror::Field* queue = java_lang_ref_Reference->GetInstanceField(1); + mirror::ArtField* queue = java_lang_ref_Reference->GetInstanceField(1); fh.ChangeField(queue); CHECK_STREQ(fh.GetName(), "queue"); CHECK_EQ(java_lang_dex.GetFieldId(queue->GetDexFieldIndex()).type_idx_, java_lang_ref_ReferenceQueue->GetDexTypeIndex()); - mirror::Field* queueNext = java_lang_ref_Reference->GetInstanceField(2); + mirror::ArtField* queueNext = java_lang_ref_Reference->GetInstanceField(2); fh.ChangeField(queueNext); CHECK_STREQ(fh.GetName(), "queueNext"); CHECK_EQ(java_lang_dex.GetFieldId(queueNext->GetDexFieldIndex()).type_idx_, java_lang_ref_Reference->GetDexTypeIndex()); - mirror::Field* referent = java_lang_ref_Reference->GetInstanceField(3); + mirror::ArtField* referent = java_lang_ref_Reference->GetInstanceField(3); fh.ChangeField(referent); CHECK_STREQ(fh.GetName(), "referent"); CHECK_EQ(java_lang_dex.GetFieldId(referent->GetDexFieldIndex()).type_idx_, GetClassRoot(kJavaLangObject)->GetDexTypeIndex()); - mirror::Field* zombie = java_lang_ref_FinalizerReference->GetInstanceField(2); + mirror::ArtField* zombie = java_lang_ref_FinalizerReference->GetInstanceField(2); fh.ChangeField(zombie); CHECK_STREQ(fh.GetName(), "zombie"); CHECK_EQ(java_lang_dex.GetFieldId(zombie->GetDexFieldIndex()).type_idx_, @@ -958,8 +923,8 @@ static void InitFromImageCallbackCommon(mirror::Object* obj, ClassLinker* class_ ClassHelper kh(klass, class_linker); mirror::Class* existing = class_linker->InsertClass(kh.GetDescriptor(), klass, true); DCHECK(existing == NULL) << kh.GetDescriptor(); - } else if (interpret_only_mode && obj->IsMethod()) { - mirror::AbstractMethod* method = obj->AsMethod(); + } else if (interpret_only_mode && obj->IsArtMethod()) { + mirror::ArtMethod* method = obj->AsArtMethod(); if (!method->IsNative()) { method->SetEntryPointFromInterpreter(interpreter::artInterpreterToInterpreterBridge); if (method != Runtime::Current()->GetResolutionMethod()) { @@ -1027,8 +992,7 @@ void ClassLinker::InitFromImage() { // Set classes on AbstractMethod early so that IsMethod tests can be performed during the live // bitmap walk. - mirror::AbstractMethod::SetClasses(GetClassRoot(kJavaLangReflectConstructor), - GetClassRoot(kJavaLangReflectMethod)); + mirror::ArtMethod::SetClass(GetClassRoot(kJavaLangReflectArtMethod)); // reinit clases_ table { @@ -1049,7 +1013,7 @@ void ClassLinker::InitFromImage() { array_iftable_ = GetClassRoot(kObjectArrayClass)->GetIfTable(); DCHECK(array_iftable_ == GetClassRoot(kBooleanArrayClass)->GetIfTable()); // String class root was set above - mirror::Field::SetClass(GetClassRoot(kJavaLangReflectField)); + mirror::ArtField::SetClass(GetClassRoot(kJavaLangReflectArtField)); mirror::BooleanArray::SetArrayClass(GetClassRoot(kBooleanArrayClass)); mirror::ByteArray::SetArrayClass(GetClassRoot(kByteArrayClass)); mirror::CharArray::SetArrayClass(GetClassRoot(kCharArrayClass)); @@ -1132,8 +1096,8 @@ void ClassLinker::VisitClassesWithoutClassesLock(ClassVisitor* visitor, void* ar ClassLinker::~ClassLinker() { mirror::Class::ResetClass(); mirror::String::ResetClass(); - mirror::Field::ResetClass(); - mirror::AbstractMethod::ResetClasses(); + mirror::ArtField::ResetClass(); + mirror::ArtMethod::ResetClass(); mirror::BooleanArray::ResetArrayClass(); mirror::ByteArray::ResetArrayClass(); mirror::CharArray::ResetArrayClass(); @@ -1172,13 +1136,13 @@ mirror::DexCache* ClassLinker::AllocDexCache(Thread* self, const DexFile& dex_fi if (types.get() == NULL) { return NULL; } - SirtRef > - methods(self, AllocAbstractMethodArray(self, dex_file.NumMethodIds())); + SirtRef > + methods(self, AllocArtMethodArray(self, dex_file.NumMethodIds())); if (methods.get() == NULL) { return NULL; } - SirtRef > - fields(self, AllocFieldArray(self, dex_file.NumFieldIds())); + SirtRef > + fields(self, AllocArtFieldArray(self, dex_file.NumFieldIds())); if (fields.get() == NULL) { return NULL; } @@ -1214,16 +1178,12 @@ mirror::Class* ClassLinker::AllocClass(Thread* self, size_t class_size) { return AllocClass(self, GetClassRoot(kJavaLangClass), class_size); } -mirror::Field* ClassLinker::AllocField(Thread* self) { - return down_cast(GetClassRoot(kJavaLangReflectField)->AllocObject(self)); +mirror::ArtField* ClassLinker::AllocArtField(Thread* self) { + return down_cast(GetClassRoot(kJavaLangReflectArtField)->AllocObject(self)); } -mirror::Method* ClassLinker::AllocMethod(Thread* self) { - return down_cast(GetClassRoot(kJavaLangReflectMethod)->AllocObject(self)); -} - -mirror::Constructor* ClassLinker::AllocConstructor(Thread* self) { - return down_cast(GetClassRoot(kJavaLangReflectConstructor)->AllocObject(self)); +mirror::ArtMethod* ClassLinker::AllocArtMethod(Thread* self) { + return down_cast(GetClassRoot(kJavaLangReflectArtMethod)->AllocObject(self)); } mirror::ObjectArray* ClassLinker::AllocStackTraceElementArray(Thread* self, @@ -1364,14 +1324,10 @@ mirror::Class* ClassLinker::DefineClass(const StringPiece& descriptor, klass.reset(GetClassRoot(kJavaLangString)); } else if (descriptor == "Ljava/lang/DexCache;") { klass.reset(GetClassRoot(kJavaLangDexCache)); - } else if (descriptor == "Ljava/lang/reflect/Field;") { - klass.reset(GetClassRoot(kJavaLangReflectField)); - } else if (descriptor == "Ljava/lang/reflect/AbstractMethod;") { - klass.reset(GetClassRoot(kJavaLangReflectAbstractMethod)); - } else if (descriptor == "Ljava/lang/reflect/Constructor;") { - klass.reset(GetClassRoot(kJavaLangReflectConstructor)); - } else if (descriptor == "Ljava/lang/reflect/Method;") { - klass.reset(GetClassRoot(kJavaLangReflectMethod)); + } else if (descriptor == "Ljava/lang/reflect/ArtField;") { + klass.reset(GetClassRoot(kJavaLangReflectArtField)); + } else if (descriptor == "Ljava/lang/reflect/ArtMethod;") { + klass.reset(GetClassRoot(kJavaLangReflectArtMethod)); } else { klass.reset(AllocClass(self, SizeOfClass(dex_file, dex_class_def))); } @@ -1519,7 +1475,7 @@ static uint32_t GetOatMethodIndexFromMethodIndex(const DexFile& dex_file, uint32 return 0; } -const OatFile::OatMethod ClassLinker::GetOatMethodFor(const mirror::AbstractMethod* method) { +const OatFile::OatMethod ClassLinker::GetOatMethodFor(const mirror::ArtMethod* method) { // Although we overwrite the trampoline of non-static methods, we may get here via the resolution // method for direct methods (or virtual methods made direct). mirror::Class* declaring_class = method->GetDeclaringClass(); @@ -1553,7 +1509,7 @@ const OatFile::OatMethod ClassLinker::GetOatMethodFor(const mirror::AbstractMeth } // Special case to get oat code without overwriting a trampoline. -const void* ClassLinker::GetOatCodeFor(const mirror::AbstractMethod* method) { +const void* ClassLinker::GetOatCodeFor(const mirror::ArtMethod* method) { CHECK(!method->IsAbstract()) << PrettyMethod(method); if (method->IsProxyMethod()) { #if !defined(ART_USE_PORTABLE_COMPILER) @@ -1580,7 +1536,7 @@ const void* ClassLinker::GetOatCodeFor(const DexFile& dex_file, uint32_t method_ } // Returns true if the method must run with interpreter, false otherwise. -static bool NeedsInterpreter(const mirror::AbstractMethod* method, const void* code) { +static bool NeedsInterpreter(const mirror::ArtMethod* method, const void* code) { if (code == NULL) { // No code: need interpreter. return true; @@ -1617,7 +1573,7 @@ void ClassLinker::FixupStaticTrampolines(mirror::Class* klass) { } // Link the code of methods skipped by LinkCode for (size_t method_index = 0; it.HasNextDirectMethod(); ++method_index, it.Next()) { - mirror::AbstractMethod* method = klass->GetDirectMethod(method_index); + mirror::ArtMethod* method = klass->GetDirectMethod(method_index); if (!method->IsStatic()) { // Only update static methods. continue; @@ -1633,7 +1589,7 @@ void ClassLinker::FixupStaticTrampolines(mirror::Class* klass) { // Ignore virtual methods on the iterator. } -static void LinkCode(SirtRef& method, const OatFile::OatClass* oat_class, +static void LinkCode(SirtRef& method, const OatFile::OatClass* oat_class, uint32_t method_index) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Method shouldn't have already been linked. @@ -1707,18 +1663,18 @@ void ClassLinker::LoadClass(const DexFile& dex_file, ClassDataItemIterator it(dex_file, class_data); Thread* self = Thread::Current(); if (it.NumStaticFields() != 0) { - klass->SetSFields(AllocFieldArray(self, it.NumStaticFields())); + klass->SetSFields(AllocArtFieldArray(self, it.NumStaticFields())); } if (it.NumInstanceFields() != 0) { - klass->SetIFields(AllocFieldArray(self, it.NumInstanceFields())); + klass->SetIFields(AllocArtFieldArray(self, it.NumInstanceFields())); } for (size_t i = 0; it.HasNextStaticField(); i++, it.Next()) { - SirtRef sfield(self, AllocField(self)); + SirtRef sfield(self, AllocArtField(self)); klass->SetStaticField(i, sfield.get()); LoadField(dex_file, it, klass, sfield); } for (size_t i = 0; it.HasNextInstanceField(); i++, it.Next()) { - SirtRef ifield(self, AllocField(self)); + SirtRef ifield(self, AllocArtField(self)); klass->SetInstanceField(i, ifield.get()); LoadField(dex_file, it, klass, ifield); } @@ -1731,15 +1687,15 @@ void ClassLinker::LoadClass(const DexFile& dex_file, // Load methods. if (it.NumDirectMethods() != 0) { // TODO: append direct methods to class object - klass->SetDirectMethods(AllocAbstractMethodArray(self, it.NumDirectMethods())); + klass->SetDirectMethods(AllocArtMethodArray(self, it.NumDirectMethods())); } if (it.NumVirtualMethods() != 0) { // TODO: append direct methods to class object - klass->SetVirtualMethods(AllocMethodArray(self, it.NumVirtualMethods())); + klass->SetVirtualMethods(AllocArtMethodArray(self, it.NumVirtualMethods())); } size_t class_def_method_index = 0; for (size_t i = 0; it.HasNextDirectMethod(); i++, it.Next()) { - SirtRef method(self, LoadMethod(self, dex_file, it, klass)); + SirtRef method(self, LoadMethod(self, dex_file, it, klass)); klass->SetDirectMethod(i, method.get()); if (oat_class.get() != NULL) { LinkCode(method, oat_class.get(), class_def_method_index); @@ -1748,7 +1704,7 @@ void ClassLinker::LoadClass(const DexFile& dex_file, class_def_method_index++; } for (size_t i = 0; it.HasNextVirtualMethod(); i++, it.Next()) { - SirtRef method(self, LoadMethod(self, dex_file, it, klass)); + SirtRef method(self, LoadMethod(self, dex_file, it, klass)); klass->SetVirtualMethod(i, method.get()); DCHECK_EQ(class_def_method_index, it.NumDirectMethods() + i); if (oat_class.get() != NULL) { @@ -1760,27 +1716,22 @@ void ClassLinker::LoadClass(const DexFile& dex_file, } void ClassLinker::LoadField(const DexFile& /*dex_file*/, const ClassDataItemIterator& it, - SirtRef& klass, SirtRef& dst) { + SirtRef& klass, SirtRef& dst) { uint32_t field_idx = it.GetMemberIndex(); dst->SetDexFieldIndex(field_idx); dst->SetDeclaringClass(klass.get()); dst->SetAccessFlags(it.GetMemberAccessFlags()); } -mirror::AbstractMethod* ClassLinker::LoadMethod(Thread* self, const DexFile& dex_file, +mirror::ArtMethod* ClassLinker::LoadMethod(Thread* self, const DexFile& dex_file, const ClassDataItemIterator& it, SirtRef& klass) { uint32_t dex_method_idx = it.GetMemberIndex(); const DexFile::MethodId& method_id = dex_file.GetMethodId(dex_method_idx); StringPiece method_name(dex_file.GetMethodName(method_id)); - mirror::AbstractMethod* dst = NULL; - if (method_name == "") { - dst = AllocConstructor(self); - } else { - dst = AllocMethod(self); - } - DCHECK(dst->IsMethod()) << PrettyDescriptor(dst->GetClass()); + mirror::ArtMethod* dst = AllocArtMethod(self); + DCHECK(dst->IsArtMethod()) << PrettyDescriptor(dst->GetClass()); const char* old_cause = self->StartAssertNoThreadSuspension("LoadMethod"); dst->SetDexMethodIndex(dex_method_idx); @@ -1824,7 +1775,7 @@ mirror::AbstractMethod* ClassLinker::LoadMethod(Thread* self, const DexFile& dex dst->SetDexCacheResolvedTypes(klass->GetDexCache()->GetResolvedTypes()); dst->SetDexCacheInitializedStaticStorage(klass->GetDexCache()->GetInitializedStaticStorage()); - CHECK(dst->IsMethod()); + CHECK(dst->IsArtMethod()); self->EndAssertNoThreadSuspension(old_cause); return dst; @@ -1918,7 +1869,7 @@ mirror::DexCache* ClassLinker::FindDexCache(const DexFile& dex_file) const { return NULL; } -void ClassLinker::FixupDexCaches(mirror::AbstractMethod* resolution_method) const { +void ClassLinker::FixupDexCaches(mirror::ArtMethod* resolution_method) const { ReaderMutexLock mu(Thread::Current(), dex_lock_); for (size_t i = 0; i != dex_caches_.size(); ++i) { dex_caches_[i]->Fixup(resolution_method); @@ -2007,12 +1958,10 @@ mirror::Class* ClassLinker::CreateArrayClass(const std::string& descriptor, new_class.reset(GetClassRoot(kObjectArrayClass)); } else if (descriptor == class_roots_descriptors_[kJavaLangStringArrayClass]) { new_class.reset(GetClassRoot(kJavaLangStringArrayClass)); - } else if (descriptor == class_roots_descriptors_[kJavaLangReflectAbstractMethodArrayClass]) { - new_class.reset(GetClassRoot(kJavaLangReflectAbstractMethodArrayClass)); - } else if (descriptor == class_roots_descriptors_[kJavaLangReflectFieldArrayClass]) { - new_class.reset(GetClassRoot(kJavaLangReflectFieldArrayClass)); - } else if (descriptor == class_roots_descriptors_[kJavaLangReflectMethodArrayClass]) { - new_class.reset(GetClassRoot(kJavaLangReflectMethodArrayClass)); + } else if (descriptor == class_roots_descriptors_[kJavaLangReflectArtMethodArrayClass]) { + new_class.reset(GetClassRoot(kJavaLangReflectArtMethodArrayClass)); + } else if (descriptor == class_roots_descriptors_[kJavaLangReflectArtFieldArrayClass]) { + new_class.reset(GetClassRoot(kJavaLangReflectArtFieldArrayClass)); } else if (descriptor == "[C") { new_class.reset(GetClassRoot(kCharArrayClass)); } else if (descriptor == "[I") { @@ -2428,7 +2377,7 @@ void ClassLinker::ResolveClassExceptionHandlerTypes(const DexFile& dex_file, mir } void ClassLinker::ResolveMethodExceptionHandlerTypes(const DexFile& dex_file, - mirror::AbstractMethod* method) { + mirror::ArtMethod* method) { // similar to DexVerifier::ScanTryCatchBlocks and dex2oat's ResolveExceptionsForMethod. const DexFile::CodeItem* code_item = dex_file.GetCodeItem(method->GetCodeItemOffset()); if (code_item == NULL) { @@ -2457,14 +2406,14 @@ void ClassLinker::ResolveMethodExceptionHandlerTypes(const DexFile& dex_file, } } -static void CheckProxyConstructor(mirror::AbstractMethod* constructor); -static void CheckProxyMethod(mirror::AbstractMethod* method, - SirtRef& prototype); +static void CheckProxyConstructor(mirror::ArtMethod* constructor); +static void CheckProxyMethod(mirror::ArtMethod* method, + SirtRef& prototype); mirror::Class* ClassLinker::CreateProxyClass(mirror::String* name, mirror::ObjectArray* interfaces, mirror::ClassLoader* loader, - mirror::ObjectArray* methods, + mirror::ObjectArray* methods, mirror::ObjectArray >* throws) { Thread* self = Thread::Current(); SirtRef klass(self, AllocClass(self, GetClassRoot(kJavaLangClass), @@ -2484,30 +2433,30 @@ mirror::Class* ClassLinker::CreateProxyClass(mirror::String* name, klass->SetDexTypeIndex(DexFile::kDexNoIndex16); // Instance fields are inherited, but we add a couple of static fields... - klass->SetSFields(AllocFieldArray(self, 2)); + klass->SetSFields(AllocArtFieldArray(self, 2)); // 1. Create a static field 'interfaces' that holds the _declared_ interfaces implemented by // our proxy, so Class.getInterfaces doesn't return the flattened set. - SirtRef interfaces_sfield(self, AllocField(self)); + SirtRef interfaces_sfield(self, AllocArtField(self)); klass->SetStaticField(0, interfaces_sfield.get()); interfaces_sfield->SetDexFieldIndex(0); interfaces_sfield->SetDeclaringClass(klass.get()); interfaces_sfield->SetAccessFlags(kAccStatic | kAccPublic | kAccFinal); // 2. Create a static field 'throws' that holds exceptions thrown by our methods. - SirtRef throws_sfield(self, AllocField(self)); + SirtRef throws_sfield(self, AllocArtField(self)); klass->SetStaticField(1, throws_sfield.get()); throws_sfield->SetDexFieldIndex(1); throws_sfield->SetDeclaringClass(klass.get()); throws_sfield->SetAccessFlags(kAccStatic | kAccPublic | kAccFinal); // Proxies have 1 direct method, the constructor - klass->SetDirectMethods(AllocAbstractMethodArray(self, 1)); + klass->SetDirectMethods(AllocArtMethodArray(self, 1)); klass->SetDirectMethod(0, CreateProxyConstructor(self, klass, proxy_class)); // Create virtual method using specified prototypes size_t num_virtual_methods = methods->GetLength(); - klass->SetVirtualMethods(AllocMethodArray(self, num_virtual_methods)); + klass->SetVirtualMethods(AllocArtMethodArray(self, num_virtual_methods)); for (size_t i = 0; i < num_virtual_methods; ++i) { - SirtRef prototype(self, methods->Get(i)); + SirtRef prototype(self, methods->Get(i)); klass->SetVirtualMethod(i, CreateProxyMethod(self, klass, prototype)); } @@ -2532,7 +2481,7 @@ mirror::Class* ClassLinker::CreateProxyClass(mirror::String* name, CHECK(klass->GetIFields() == NULL); CheckProxyConstructor(klass->GetDirectMethod(0)); for (size_t i = 0; i < num_virtual_methods; ++i) { - SirtRef prototype(self, methods->Get(i)); + SirtRef prototype(self, methods->Get(i)); CheckProxyMethod(klass->GetVirtualMethod(i), prototype); } @@ -2559,8 +2508,8 @@ std::string ClassLinker::GetDescriptorForProxy(const mirror::Class* proxy_class) return DotToDescriptor(name->ToModifiedUtf8().c_str()); } -mirror::AbstractMethod* ClassLinker::FindMethodForProxy(const mirror::Class* proxy_class, - const mirror::AbstractMethod* proxy_method) { +mirror::ArtMethod* ClassLinker::FindMethodForProxy(const mirror::Class* proxy_class, + const mirror::ArtMethod* proxy_method) { DCHECK(proxy_class->IsProxyClass()); DCHECK(proxy_method->IsProxyMethod()); // Locate the dex cache of the original interface/Object @@ -2577,31 +2526,31 @@ mirror::AbstractMethod* ClassLinker::FindMethodForProxy(const mirror::Class* pro } CHECK(dex_cache != NULL); uint32_t method_idx = proxy_method->GetDexMethodIndex(); - mirror::AbstractMethod* resolved_method = dex_cache->GetResolvedMethod(method_idx); + mirror::ArtMethod* resolved_method = dex_cache->GetResolvedMethod(method_idx); CHECK(resolved_method != NULL); return resolved_method; } -mirror::AbstractMethod* ClassLinker::CreateProxyConstructor(Thread* self, - SirtRef& klass, - mirror::Class* proxy_class) { +mirror::ArtMethod* ClassLinker::CreateProxyConstructor(Thread* self, + SirtRef& klass, + mirror::Class* proxy_class) { // Create constructor for Proxy that must initialize h - mirror::ObjectArray* proxy_direct_methods = + mirror::ObjectArray* proxy_direct_methods = proxy_class->GetDirectMethods(); - CHECK_EQ(proxy_direct_methods->GetLength(), 15); - mirror::AbstractMethod* proxy_constructor = proxy_direct_methods->Get(2); + CHECK_EQ(proxy_direct_methods->GetLength(), 16); + mirror::ArtMethod* proxy_constructor = proxy_direct_methods->Get(2); // Clone the existing constructor of Proxy (our constructor would just invoke it so steal its // code_ too) - mirror::AbstractMethod* constructor = - down_cast(proxy_constructor->Clone(self)); + mirror::ArtMethod* constructor = + down_cast(proxy_constructor->Clone(self)); // Make this constructor public and fix the class to be our Proxy version constructor->SetAccessFlags((constructor->GetAccessFlags() & ~kAccProtected) | kAccPublic); constructor->SetDeclaringClass(klass.get()); return constructor; } -static void CheckProxyConstructor(mirror::AbstractMethod* constructor) +static void CheckProxyConstructor(mirror::ArtMethod* constructor) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { CHECK(constructor->IsConstructor()); MethodHelper mh(constructor); @@ -2610,15 +2559,15 @@ static void CheckProxyConstructor(mirror::AbstractMethod* constructor) DCHECK(constructor->IsPublic()); } -mirror::AbstractMethod* ClassLinker::CreateProxyMethod(Thread* self, SirtRef& klass, - SirtRef& prototype) { +mirror::ArtMethod* ClassLinker::CreateProxyMethod(Thread* self, SirtRef& klass, + SirtRef& prototype) { // Ensure prototype is in dex cache so that we can use the dex cache to look up the overridden // prototype method prototype->GetDeclaringClass()->GetDexCache()->SetResolvedMethod(prototype->GetDexMethodIndex(), prototype.get()); // We steal everything from the prototype (such as DexCache, invoke stub, etc.) then specialize // as necessary - mirror::AbstractMethod* method = down_cast(prototype->Clone(self)); + mirror::ArtMethod* method = down_cast(prototype->Clone(self)); // Set class to be the concrete proxy class and clear the abstract flag, modify exceptions to // the intersection of throw exceptions as defined in Proxy @@ -2627,7 +2576,7 @@ mirror::AbstractMethod* ClassLinker::CreateProxyMethod(Thread* self, SirtRefGetCalleeSaveMethod(Runtime::kRefsAndArgs); method->SetCoreSpillMask(refs_and_args->GetCoreSpillMask()); method->SetFpSpillMask(refs_and_args->GetFpSpillMask()); @@ -2638,8 +2587,8 @@ mirror::AbstractMethod* ClassLinker::CreateProxyMethod(Thread* self, SirtRef& prototype) +static void CheckProxyMethod(mirror::ArtMethod* method, + SirtRef& prototype) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Basic sanity CHECK(!prototype->IsFinal()); @@ -2669,7 +2618,7 @@ bool ClassLinker::InitializeClass(mirror::Class* klass, bool can_run_clinit, boo Thread* self = Thread::Current(); - mirror::AbstractMethod* clinit = NULL; + mirror::ArtMethod* clinit = NULL; { // see JLS 3rd edition, 12.4.2 "Detailed Initialization Procedure" for the locking protocol ObjectLock lock(self, klass); @@ -2842,7 +2791,7 @@ bool ClassLinker::ValidateSuperClassDescriptors(const mirror::Class* klass) { klass->GetClassLoader() != klass->GetSuperClass()->GetClassLoader()) { const mirror::Class* super = klass->GetSuperClass(); for (int i = super->GetVTable()->GetLength() - 1; i >= 0; --i) { - const mirror::AbstractMethod* method = klass->GetVTable()->Get(i); + const mirror::ArtMethod* method = klass->GetVTable()->Get(i); if (method != super->GetVTable()->Get(i) && !IsSameMethodSignatureInDifferentClassContexts(method, super, klass)) { ThrowLinkageError(klass, "Class %s method %s resolves differently in superclass %s", @@ -2857,7 +2806,7 @@ bool ClassLinker::ValidateSuperClassDescriptors(const mirror::Class* klass) { mirror::Class* interface = iftable->GetInterface(i); if (klass->GetClassLoader() != interface->GetClassLoader()) { for (size_t j = 0; j < interface->NumVirtualMethods(); ++j) { - const mirror::AbstractMethod* method = iftable->GetMethodArray(i)->Get(j); + const mirror::ArtMethod* method = iftable->GetMethodArray(i)->Get(j); if (!IsSameMethodSignatureInDifferentClassContexts(method, interface, method->GetDeclaringClass())) { ThrowLinkageError(klass, "Class %s method %s resolves differently in interface %s", @@ -2874,7 +2823,7 @@ bool ClassLinker::ValidateSuperClassDescriptors(const mirror::Class* klass) { // Returns true if classes referenced by the signature of the method are the // same classes in klass1 as they are in klass2. -bool ClassLinker::IsSameMethodSignatureInDifferentClassContexts(const mirror::AbstractMethod* method, +bool ClassLinker::IsSameMethodSignatureInDifferentClassContexts(const mirror::ArtMethod* method, const mirror::Class* klass1, const mirror::Class* klass2) { if (klass1 == klass2) { @@ -2969,7 +2918,7 @@ bool ClassLinker::EnsureInitialized(mirror::Class* c, bool can_run_clinit, bool } void ClassLinker::ConstructFieldMap(const DexFile& dex_file, const DexFile::ClassDef& dex_class_def, - mirror::Class* c, SafeMap& field_map) { + mirror::Class* c, SafeMap& field_map) { mirror::ClassLoader* cl = c->GetClassLoader(); const byte* class_data = dex_file.GetClassData(dex_class_def); ClassDataItemIterator it(dex_file, class_data); @@ -2997,7 +2946,7 @@ bool ClassLinker::InitializeStaticFields(mirror::Class* klass) { if (it.HasNext()) { // We reordered the fields, so we need to be able to map the field indexes to the right fields. - SafeMap field_map; + SafeMap field_map; ConstructFieldMap(dex_file, *dex_class_def, klass, field_map); for (size_t i = 0; it.HasNext(); i++, it.Next()) { it.ReadValueToField(field_map.Get(i)); @@ -3161,17 +3110,17 @@ bool ClassLinker::LinkVirtualMethods(SirtRef& klass) { size_t actual_count = klass->GetSuperClass()->GetVTable()->GetLength(); CHECK_LE(actual_count, max_count); // TODO: do not assign to the vtable field until it is fully constructed. - SirtRef > + SirtRef > vtable(self, klass->GetSuperClass()->GetVTable()->CopyOf(self, max_count)); // See if any of our virtual methods override the superclass. MethodHelper local_mh(NULL, this); MethodHelper super_mh(NULL, this); for (size_t i = 0; i < klass->NumVirtualMethods(); ++i) { - mirror::AbstractMethod* local_method = klass->GetVirtualMethodDuringLinking(i); + mirror::ArtMethod* local_method = klass->GetVirtualMethodDuringLinking(i); local_mh.ChangeMethod(local_method); size_t j = 0; for (; j < actual_count; ++j) { - mirror::AbstractMethod* super_method = vtable->Get(j); + mirror::ArtMethod* super_method = vtable->Get(j); super_mh.ChangeMethod(super_method); if (local_mh.HasSameNameAndSignature(&super_mh)) { if (klass->CanAccessMember(super_method->GetDeclaringClass(), super_method->GetAccessFlags())) { @@ -3215,10 +3164,10 @@ bool ClassLinker::LinkVirtualMethods(SirtRef& klass) { ThrowClassFormatError(klass.get(), "Too many methods: %d", num_virtual_methods); return false; } - SirtRef > - vtable(self, AllocMethodArray(self, num_virtual_methods)); + SirtRef > + vtable(self, AllocArtMethodArray(self, num_virtual_methods)); for (size_t i = 0; i < num_virtual_methods; ++i) { - mirror::AbstractMethod* virtual_method = klass->GetVirtualMethodDuringLinking(i); + mirror::ArtMethod* virtual_method = klass->GetVirtualMethodDuringLinking(i); vtable->Set(i, virtual_method); virtual_method->SetMethodIndex(i & 0xFFFF); } @@ -3328,19 +3277,19 @@ bool ClassLinker::LinkInterfaceMethods(SirtRef& klass, if (klass->IsInterface()) { return true; } - std::vector miranda_list; + std::vector miranda_list; MethodHelper vtable_mh(NULL, this); MethodHelper interface_mh(NULL, this); for (size_t i = 0; i < ifcount; ++i) { mirror::Class* interface = iftable->GetInterface(i); size_t num_methods = interface->NumVirtualMethods(); if (num_methods > 0) { - mirror::ObjectArray* method_array = - AllocMethodArray(self, num_methods); + mirror::ObjectArray* method_array = + AllocArtMethodArray(self, num_methods); iftable->SetMethodArray(i, method_array); - mirror::ObjectArray* vtable = klass->GetVTableDuringLinking(); + mirror::ObjectArray* vtable = klass->GetVTableDuringLinking(); for (size_t j = 0; j < num_methods; ++j) { - mirror::AbstractMethod* interface_method = interface->GetVirtualMethod(j); + mirror::ArtMethod* interface_method = interface->GetVirtualMethod(j); interface_mh.ChangeMethod(interface_method); int32_t k; // For each method listed in the interface's method list, find the @@ -3352,7 +3301,7 @@ bool ClassLinker::LinkInterfaceMethods(SirtRef& klass, // those don't end up in the virtual method table, so it shouldn't // matter which direction we go. We walk it backward anyway.) for (k = vtable->GetLength() - 1; k >= 0; --k) { - mirror::AbstractMethod* vtable_method = vtable->Get(k); + mirror::ArtMethod* vtable_method = vtable->Get(k); vtable_mh.ChangeMethod(vtable_method); if (interface_mh.HasSameNameAndSignature(&vtable_mh)) { if (!vtable_method->IsAbstract() && !vtable_method->IsPublic()) { @@ -3367,9 +3316,9 @@ bool ClassLinker::LinkInterfaceMethods(SirtRef& klass, } } if (k < 0) { - SirtRef miranda_method(self, NULL); + SirtRef miranda_method(self, NULL); for (size_t mir = 0; mir < miranda_list.size(); mir++) { - mirror::AbstractMethod* mir_method = miranda_list[mir]; + mirror::ArtMethod* mir_method = miranda_list[mir]; vtable_mh.ChangeMethod(mir_method); if (interface_mh.HasSameNameAndSignature(&vtable_mh)) { miranda_method.reset(miranda_list[mir]); @@ -3378,7 +3327,7 @@ bool ClassLinker::LinkInterfaceMethods(SirtRef& klass, } if (miranda_method.get() == NULL) { // point the interface table at a phantom slot - miranda_method.reset(down_cast(interface_method->Clone(self))); + miranda_method.reset(down_cast(interface_method->Clone(self))); miranda_list.push_back(miranda_method.get()); } method_array->Set(j, miranda_method.get()); @@ -3390,17 +3339,17 @@ bool ClassLinker::LinkInterfaceMethods(SirtRef& klass, int old_method_count = klass->NumVirtualMethods(); int new_method_count = old_method_count + miranda_list.size(); klass->SetVirtualMethods((old_method_count == 0) - ? AllocMethodArray(self, new_method_count) + ? AllocArtMethodArray(self, new_method_count) : klass->GetVirtualMethods()->CopyOf(self, new_method_count)); - SirtRef > + SirtRef > vtable(self, klass->GetVTableDuringLinking()); CHECK(vtable.get() != NULL); int old_vtable_count = vtable->GetLength(); int new_vtable_count = old_vtable_count + miranda_list.size(); vtable.reset(vtable->CopyOf(self, new_vtable_count)); for (size_t i = 0; i < miranda_list.size(); ++i) { - mirror::AbstractMethod* method = miranda_list[i]; + mirror::ArtMethod* method = miranda_list[i]; // Leave the declaring class alone as type indices are relative to it method->SetAccessFlags(method->GetAccessFlags() | kAccMiranda); method->SetMethodIndex(0xFFFF & (old_vtable_count + i)); @@ -3411,7 +3360,7 @@ bool ClassLinker::LinkInterfaceMethods(SirtRef& klass, klass->SetVTable(vtable.get()); } - mirror::ObjectArray* vtable = klass->GetVTableDuringLinking(); + mirror::ObjectArray* vtable = klass->GetVTableDuringLinking(); for (int i = 0; i < vtable->GetLength(); ++i) { CHECK(vtable->Get(i) != NULL); } @@ -3439,7 +3388,7 @@ struct LinkFieldsComparator { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : fh_(fh) {} // No thread safety analysis as will be called from STL. Checked lock held in constructor. - bool operator()(const mirror::Field* field1, const mirror::Field* field2) + bool operator()(const mirror::ArtField* field1, const mirror::ArtField* field2) NO_THREAD_SAFETY_ANALYSIS { // First come reference fields, then 64-bit, and finally 32-bit fh_->ChangeField(field1); @@ -3471,7 +3420,7 @@ bool ClassLinker::LinkFields(SirtRef& klass, bool is_static) { size_t num_fields = is_static ? klass->NumStaticFields() : klass->NumInstanceFields(); - mirror::ObjectArray* fields = + mirror::ObjectArray* fields = is_static ? klass->GetSFields() : klass->GetIFields(); // Initialize size and field_offset @@ -3493,7 +3442,7 @@ bool ClassLinker::LinkFields(SirtRef& klass, bool is_static) { // we want a relatively stable order so that adding new fields // minimizes disruption of C++ version such as Class and Method. - std::deque grouped_and_sorted_fields; + std::deque grouped_and_sorted_fields; for (size_t i = 0; i < num_fields; i++) { grouped_and_sorted_fields.push_back(fields->Get(i)); } @@ -3506,7 +3455,7 @@ bool ClassLinker::LinkFields(SirtRef& klass, bool is_static) { size_t current_field = 0; size_t num_reference_fields = 0; for (; current_field < num_fields; current_field++) { - mirror::Field* field = grouped_and_sorted_fields.front(); + mirror::ArtField* field = grouped_and_sorted_fields.front(); fh.ChangeField(field); Primitive::Type type = fh.GetTypeAsPrimitiveType(); bool isPrimitive = type != Primitive::kPrimNot; @@ -3525,7 +3474,7 @@ bool ClassLinker::LinkFields(SirtRef& klass, bool is_static) { // into place. If we can't find one, we'll have to pad it. if (current_field != num_fields && !IsAligned<8>(field_offset.Uint32Value())) { for (size_t i = 0; i < grouped_and_sorted_fields.size(); i++) { - mirror::Field* field = grouped_and_sorted_fields[i]; + mirror::ArtField* field = grouped_and_sorted_fields[i]; fh.ChangeField(field); Primitive::Type type = fh.GetTypeAsPrimitiveType(); CHECK(type != Primitive::kPrimNot); // should only be working on primitive types @@ -3546,7 +3495,7 @@ bool ClassLinker::LinkFields(SirtRef& klass, bool is_static) { // finish assigning field offsets to all fields. DCHECK(current_field == num_fields || IsAligned<8>(field_offset.Uint32Value())); while (!grouped_and_sorted_fields.empty()) { - mirror::Field* field = grouped_and_sorted_fields.front(); + mirror::ArtField* field = grouped_and_sorted_fields.front(); grouped_and_sorted_fields.pop_front(); fh.ChangeField(field); Primitive::Type type = fh.GetTypeAsPrimitiveType(); @@ -3576,12 +3525,12 @@ bool ClassLinker::LinkFields(SirtRef& klass, bool is_static) { // non-reference fields, and all double-wide fields are aligned. bool seen_non_ref = false; for (size_t i = 0; i < num_fields; i++) { - mirror::Field* field = fields->Get(i); + mirror::ArtField* field = fields->Get(i); if (false) { // enable to debug field layout LOG(INFO) << "LinkFields: " << (is_static ? "static" : "instance") << " class=" << PrettyClass(klass.get()) << " field=" << PrettyField(field) - << " offset=" << field->GetField32(MemberOffset(mirror::Field::OffsetOffset()), + << " offset=" << field->GetField32(MemberOffset(mirror::ArtField::OffsetOffset()), false); } fh.ChangeField(field); @@ -3644,14 +3593,14 @@ void ClassLinker::CreateReferenceOffsets(SirtRef& klass, bool is_ size_t num_reference_fields = is_static ? klass->NumReferenceStaticFieldsDuringLinking() : klass->NumReferenceInstanceFieldsDuringLinking(); - const mirror::ObjectArray* fields = + const mirror::ObjectArray* fields = is_static ? klass->GetSFields() : klass->GetIFields(); // All of the fields that contain object references are guaranteed // to be at the beginning of the fields list. for (size_t i = 0; i < num_reference_fields; ++i) { // Note that byte_offset is the offset from the beginning of // object, not the offset into instance data - const mirror::Field* field = fields->Get(i); + const mirror::ArtField* field = fields->Get(i); MemberOffset byte_offset = field->GetOffsetDuringLinking(); CHECK_EQ(byte_offset.Uint32Value() & (CLASS_OFFSET_ALIGNMENT - 1), 0U); if (CLASS_CAN_ENCODE_OFFSET(byte_offset.Uint32Value())) { @@ -3716,15 +3665,15 @@ mirror::Class* ClassLinker::ResolveType(const DexFile& dex_file, return resolved; } -mirror::AbstractMethod* ClassLinker::ResolveMethod(const DexFile& dex_file, +mirror::ArtMethod* ClassLinker::ResolveMethod(const DexFile& dex_file, uint32_t method_idx, mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, - const mirror::AbstractMethod* referrer, + const mirror::ArtMethod* referrer, InvokeType type) { DCHECK(dex_cache != NULL); // Check for hit in the dex cache. - mirror::AbstractMethod* resolved = dex_cache->GetResolvedMethod(method_idx); + mirror::ArtMethod* resolved = dex_cache->GetResolvedMethod(method_idx); if (resolved != NULL) { return resolved; } @@ -3863,13 +3812,13 @@ mirror::AbstractMethod* ClassLinker::ResolveMethod(const DexFile& dex_file, } } -mirror::Field* ClassLinker::ResolveField(const DexFile& dex_file, +mirror::ArtField* ClassLinker::ResolveField(const DexFile& dex_file, uint32_t field_idx, mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, bool is_static) { DCHECK(dex_cache != NULL); - mirror::Field* resolved = dex_cache->GetResolvedField(field_idx); + mirror::ArtField* resolved = dex_cache->GetResolvedField(field_idx); if (resolved != NULL) { return resolved; } @@ -3903,12 +3852,12 @@ mirror::Field* ClassLinker::ResolveField(const DexFile& dex_file, return resolved; } -mirror::Field* ClassLinker::ResolveFieldJLS(const DexFile& dex_file, +mirror::ArtField* ClassLinker::ResolveFieldJLS(const DexFile& dex_file, uint32_t field_idx, mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader) { DCHECK(dex_cache != NULL); - mirror::Field* resolved = dex_cache->GetResolvedField(field_idx); + mirror::ArtField* resolved = dex_cache->GetResolvedField(field_idx); if (resolved != NULL) { return resolved; } @@ -3930,7 +3879,7 @@ mirror::Field* ClassLinker::ResolveFieldJLS(const DexFile& dex_file, return resolved; } -const char* ClassLinker::MethodShorty(uint32_t method_idx, mirror::AbstractMethod* referrer, +const char* ClassLinker::MethodShorty(uint32_t method_idx, mirror::ArtMethod* referrer, uint32_t* length) { mirror::Class* declaring_class = referrer->GetDeclaringClass(); mirror::DexCache* dex_cache = declaring_class->GetDexCache(); diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 67be2ff028..d0cc562ca5 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -106,7 +106,7 @@ class ClassLinker { // Resolve a String with the given index from the DexFile, storing the // result in the DexCache. The referrer is used to identify the // target DexCache and ClassLoader to use for resolution. - mirror::String* ResolveString(uint32_t string_idx, const mirror::AbstractMethod* referrer) + mirror::String* ResolveString(uint32_t string_idx, const mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Resolve a String with the given index from the DexFile, storing the @@ -130,10 +130,10 @@ class ClassLinker { // Resolve a Type with the given index from the DexFile, storing the // result in the DexCache. The referrer is used to identify the // target DexCache and ClassLoader to use for resolution. - mirror::Class* ResolveType(uint16_t type_idx, const mirror::AbstractMethod* referrer) + mirror::Class* ResolveType(uint16_t type_idx, const mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::Class* ResolveType(uint16_t type_idx, const mirror::Field* referrer) + mirror::Class* ResolveType(uint16_t type_idx, const mirror::ArtField* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Resolve a type with the given ID from the DexFile, storing the @@ -151,20 +151,20 @@ class ClassLinker { // in ResolveType. What is unique is the method type argument which // is used to determine if this method is a direct, static, or // virtual method. - mirror::AbstractMethod* ResolveMethod(const DexFile& dex_file, - uint32_t method_idx, - mirror::DexCache* dex_cache, - mirror::ClassLoader* class_loader, - const mirror::AbstractMethod* referrer, - InvokeType type) + mirror::ArtMethod* ResolveMethod(const DexFile& dex_file, + uint32_t method_idx, + mirror::DexCache* dex_cache, + mirror::ClassLoader* class_loader, + const mirror::ArtMethod* referrer, + InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* ResolveMethod(uint32_t method_idx, const mirror::AbstractMethod* referrer, - InvokeType type) + mirror::ArtMethod* ResolveMethod(uint32_t method_idx, const mirror::ArtMethod* referrer, + InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::Field* ResolveField(uint32_t field_idx, const mirror::AbstractMethod* referrer, - bool is_static) + mirror::ArtField* ResolveField(uint32_t field_idx, const mirror::ArtMethod* referrer, + bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Resolve a field with a given ID from the DexFile, storing the @@ -172,25 +172,25 @@ class ClassLinker { // in ResolveType. What is unique is the is_static argument which is // used to determine if we are resolving a static or non-static // field. - mirror::Field* ResolveField(const DexFile& dex_file, - uint32_t field_idx, - mirror::DexCache* dex_cache, - mirror::ClassLoader* class_loader, - bool is_static) + mirror::ArtField* ResolveField(const DexFile& dex_file, + uint32_t field_idx, + mirror::DexCache* dex_cache, + mirror::ClassLoader* class_loader, + bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Resolve a field with a given ID from the DexFile, storing the // result in DexCache. The ClassLinker and ClassLoader are used as // in ResolveType. No is_static argument is provided so that Java // field resolution semantics are followed. - mirror::Field* ResolveFieldJLS(const DexFile& dex_file, - uint32_t field_idx, - mirror::DexCache* dex_cache, - mirror::ClassLoader* class_loader) + mirror::ArtField* ResolveFieldJLS(const DexFile& dex_file, + uint32_t field_idx, + mirror::DexCache* dex_cache, + mirror::ClassLoader* class_loader) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Get shorty from method index without resolution. Used to do handlerization. - const char* MethodShorty(uint32_t method_idx, mirror::AbstractMethod* referrer, uint32_t* length) + const char* MethodShorty(uint32_t method_idx, mirror::ArtMethod* referrer, uint32_t* length) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns true on success, false if there's an exception pending. @@ -232,7 +232,7 @@ class ClassLinker { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool IsDexFileRegistered(const DexFile& dex_file) const LOCKS_EXCLUDED(dex_lock_); - void FixupDexCaches(mirror::AbstractMethod* resolution_method) const + void FixupDexCaches(mirror::ArtMethod* resolution_method) const LOCKS_EXCLUDED(dex_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -283,16 +283,13 @@ class ClassLinker { mirror::ObjectArray* AllocStringArray(Thread* self, size_t length) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::ObjectArray* AllocAbstractMethodArray(Thread* self, size_t length) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - mirror::ObjectArray* AllocMethodArray(Thread* self, size_t length) + mirror::ObjectArray* AllocArtMethodArray(Thread* self, size_t length) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); mirror::IfTable* AllocIfTable(Thread* self, size_t ifcount) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::ObjectArray* AllocFieldArray(Thread* self, size_t length) + mirror::ObjectArray* AllocArtFieldArray(Thread* self, size_t length) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); mirror::ObjectArray* AllocStackTraceElementArray(Thread* self, @@ -305,23 +302,23 @@ class ClassLinker { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void ResolveClassExceptionHandlerTypes(const DexFile& dex_file, mirror::Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void ResolveMethodExceptionHandlerTypes(const DexFile& dex_file, mirror::AbstractMethod* klass) + void ResolveMethodExceptionHandlerTypes(const DexFile& dex_file, mirror::ArtMethod* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); mirror::Class* CreateProxyClass(mirror::String* name, mirror::ObjectArray* interfaces, mirror::ClassLoader* loader, - mirror::ObjectArray* methods, + mirror::ObjectArray* methods, mirror::ObjectArray >* throws) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); std::string GetDescriptorForProxy(const mirror::Class* proxy_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* FindMethodForProxy(const mirror::Class* proxy_class, - const mirror::AbstractMethod* proxy_method) + mirror::ArtMethod* FindMethodForProxy(const mirror::Class* proxy_class, + const mirror::ArtMethod* proxy_method) LOCKS_EXCLUDED(dex_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Get the oat code for a method when its class isn't yet initialized - const void* GetOatCodeFor(const mirror::AbstractMethod* method) + const void* GetOatCodeFor(const mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Get the oat code for a method from a method index. @@ -361,7 +358,7 @@ class ClassLinker { private: explicit ClassLinker(InternTable*); - const OatFile::OatMethod GetOatMethodFor(const mirror::AbstractMethod* method) + const OatFile::OatMethod GetOatMethodFor(const mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Initialize class linker by bootstraping from dex files @@ -386,9 +383,8 @@ class ClassLinker { mirror::Class* AllocClass(Thread* self, size_t class_size) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); mirror::DexCache* AllocDexCache(Thread* self, const DexFile& dex_file) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::Field* AllocField(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::Method* AllocMethod(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::Constructor* AllocConstructor(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + mirror::ArtField* AllocArtField(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + mirror::ArtMethod* AllocArtMethod(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); mirror::Class* CreatePrimitiveClass(Thread* self, Primitive::Type type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -405,7 +401,7 @@ class ClassLinker { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void ConstructFieldMap(const DexFile& dex_file, const DexFile::ClassDef& dex_class_def, - mirror::Class* c, SafeMap& field_map) + mirror::Class* c, SafeMap& field_map) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); size_t SizeOfClass(const DexFile& dex_file, @@ -418,12 +414,12 @@ class ClassLinker { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void LoadField(const DexFile& dex_file, const ClassDataItemIterator& it, - SirtRef& klass, SirtRef& dst) + SirtRef& klass, SirtRef& dst) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* LoadMethod(Thread* self, const DexFile& dex_file, - const ClassDataItemIterator& dex_method, - SirtRef& klass) + mirror::ArtMethod* LoadMethod(Thread* self, const DexFile& dex_file, + const ClassDataItemIterator& dex_method, + SirtRef& klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void FixupStaticTrampolines(mirror::Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -455,7 +451,7 @@ class ClassLinker { const mirror::Class* klass2) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - bool IsSameMethodSignatureInDifferentClassContexts(const mirror::AbstractMethod* method, + bool IsSameMethodSignatureInDifferentClassContexts(const mirror::ArtMethod* method, const mirror::Class* klass1, const mirror::Class* klass2) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -519,11 +515,11 @@ class ClassLinker { EXCLUSIVE_LOCKS_REQUIRED(dex_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* CreateProxyConstructor(Thread* self, SirtRef& klass, - mirror::Class* proxy_class) + mirror::ArtMethod* CreateProxyConstructor(Thread* self, SirtRef& klass, + mirror::Class* proxy_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* CreateProxyMethod(Thread* self, SirtRef& klass, - SirtRef& prototype) + mirror::ArtMethod* CreateProxyMethod(Thread* self, SirtRef& klass, + SirtRef& prototype) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); std::vector boot_class_path_; @@ -554,15 +550,12 @@ class ClassLinker { kJavaLangString, kJavaLangDexCache, kJavaLangRefReference, - kJavaLangReflectConstructor, - kJavaLangReflectField, - kJavaLangReflectAbstractMethod, - kJavaLangReflectMethod, + kJavaLangReflectArtField, + kJavaLangReflectArtMethod, kJavaLangReflectProxy, kJavaLangStringArrayClass, - kJavaLangReflectAbstractMethodArrayClass, - kJavaLangReflectFieldArrayClass, - kJavaLangReflectMethodArrayClass, + kJavaLangReflectArtFieldArrayClass, + kJavaLangReflectArtMethodArrayClass, kJavaLangClassLoader, kJavaLangThrowable, kJavaLangClassNotFoundException, diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index 4659fd1982..6442f5ad63 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -24,42 +24,17 @@ #include "dex_file.h" #include "entrypoints/entrypoint_utils.h" #include "gc/heap.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/dex_cache.h" -#include "mirror/field-inl.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/proxy.h" #include "mirror/stack_trace_element.h" #include "sirt_ref.h" -using ::art::mirror::AbstractMethod; -using ::art::mirror::AbstractMethodClass; -using ::art::mirror::CharArray; -using ::art::mirror::Class; -using ::art::mirror::ClassClass; -using ::art::mirror::ClassLoader; -using ::art::mirror::Constructor; -using ::art::mirror::DexCache; -using ::art::mirror::DoubleArray; -using ::art::mirror::Field; -using ::art::mirror::FieldClass; -using ::art::mirror::IfTable; -using ::art::mirror::IntArray; -using ::art::mirror::LongArray; -using ::art::mirror::Method; -using ::art::mirror::Object; -using ::art::mirror::ObjectArray; -using ::art::mirror::Proxy; -using ::art::mirror::ShortArray; -using ::art::mirror::StackTraceElement; -using ::art::mirror::StaticStorageBase; -using ::art::mirror::String; -using ::art::mirror::StringClass; -using ::art::mirror::Throwable; - namespace art { class ClassLinkerTest : public CommonTest { @@ -69,9 +44,9 @@ class ClassLinkerTest : public CommonTest { EXPECT_TRUE(class_linker_->FindSystemClass(descriptor.c_str()) == NULL); Thread* self = Thread::Current(); EXPECT_TRUE(self->IsExceptionPending()); - Object* exception = self->GetException(NULL); + mirror::Object* exception = self->GetException(NULL); self->ClearException(); - Class* exception_class = class_linker_->FindSystemClass("Ljava/lang/NoClassDefFoundError;"); + mirror::Class* exception_class = class_linker_->FindSystemClass("Ljava/lang/NoClassDefFoundError;"); EXPECT_TRUE(exception->InstanceOf(exception_class)); } @@ -80,7 +55,7 @@ class ClassLinkerTest : public CommonTest { AssertPrimitiveClass(descriptor, class_linker_->FindSystemClass(descriptor.c_str())); } - void AssertPrimitiveClass(const std::string& descriptor, const Class* primitive) + void AssertPrimitiveClass(const std::string& descriptor, const mirror::Class* primitive) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ClassHelper primitive_ch(primitive); ASSERT_TRUE(primitive != NULL); @@ -91,7 +66,7 @@ class ClassLinkerTest : public CommonTest { EXPECT_TRUE(primitive->GetSuperClass() == NULL); EXPECT_FALSE(primitive->HasSuperClass()); EXPECT_TRUE(primitive->GetClassLoader() == NULL); - EXPECT_EQ(Class::kStatusInitialized, primitive->GetStatus()); + EXPECT_EQ(mirror::Class::kStatusInitialized, primitive->GetStatus()); EXPECT_FALSE(primitive->IsErroneous()); EXPECT_TRUE(primitive->IsLoaded()); EXPECT_TRUE(primitive->IsResolved()); @@ -118,9 +93,9 @@ class ClassLinkerTest : public CommonTest { void AssertArrayClass(const std::string& array_descriptor, const std::string& component_type, - ClassLoader* class_loader) + mirror::ClassLoader* class_loader) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - Class* array = class_linker_->FindClass(array_descriptor.c_str(), class_loader); + mirror::Class* array = class_linker_->FindClass(array_descriptor.c_str(), class_loader); ClassHelper array_component_ch(array->GetComponentType()); EXPECT_STREQ(component_type.c_str(), array_component_ch.GetDescriptor()); EXPECT_EQ(class_loader, array->GetClassLoader()); @@ -128,7 +103,7 @@ class ClassLinkerTest : public CommonTest { AssertArrayClass(array_descriptor, array); } - void AssertArrayClass(const std::string& array_descriptor, Class* array) + void AssertArrayClass(const std::string& array_descriptor, mirror::Class* array) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ClassHelper kh(array); ASSERT_TRUE(array != NULL); @@ -142,7 +117,7 @@ class ClassLinkerTest : public CommonTest { ASSERT_TRUE(array->GetComponentType() != NULL); kh.ChangeClass(array->GetComponentType()); ASSERT_TRUE(kh.GetDescriptor() != NULL); - EXPECT_EQ(Class::kStatusInitialized, array->GetStatus()); + EXPECT_EQ(mirror::Class::kStatusInitialized, array->GetStatus()); EXPECT_FALSE(array->IsErroneous()); EXPECT_TRUE(array->IsLoaded()); EXPECT_TRUE(array->IsResolved()); @@ -163,7 +138,7 @@ class ClassLinkerTest : public CommonTest { EXPECT_EQ(2U, kh.NumDirectInterfaces()); EXPECT_TRUE(array->GetVTable() != NULL); EXPECT_EQ(2, array->GetIfTableCount()); - IfTable* iftable = array->GetIfTable(); + mirror::IfTable* iftable = array->GetIfTable(); ASSERT_TRUE(iftable != NULL); kh.ChangeClass(kh.GetDirectInterface(0)); EXPECT_STREQ(kh.GetDescriptor(), "Ljava/lang/Cloneable;"); @@ -172,7 +147,7 @@ class ClassLinkerTest : public CommonTest { EXPECT_STREQ(kh.GetDescriptor(), "Ljava/io/Serializable;"); } - void AssertMethod(AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + void AssertMethod(mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { MethodHelper mh(method); EXPECT_TRUE(method != NULL); EXPECT_TRUE(method->GetClass() != NULL); @@ -193,7 +168,7 @@ class ClassLinkerTest : public CommonTest { method->GetDexCacheInitializedStaticStorage()); } - void AssertField(Class* klass, Field* field) + void AssertField(mirror::Class* klass, mirror::ArtField* field) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FieldHelper fh(field); EXPECT_TRUE(field != NULL); @@ -203,7 +178,7 @@ class ClassLinkerTest : public CommonTest { EXPECT_TRUE(fh.GetType() != NULL); } - void AssertClass(const std::string& descriptor, Class* klass) + void AssertClass(const std::string& descriptor, mirror::Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ClassHelper kh(klass); EXPECT_STREQ(descriptor.c_str(), kh.GetDescriptor()); @@ -222,7 +197,7 @@ class ClassLinkerTest : public CommonTest { EXPECT_FALSE(klass->IsArrayClass()); EXPECT_TRUE(klass->GetComponentType() == NULL); EXPECT_TRUE(klass->IsInSamePackage(klass)); - EXPECT_TRUE(Class::IsInSamePackage(kh.GetDescriptor(), kh.GetDescriptor())); + EXPECT_TRUE(mirror::Class::IsInSamePackage(kh.GetDescriptor(), kh.GetDescriptor())); if (klass->IsInterface()) { EXPECT_TRUE(klass->IsAbstract()); if (klass->NumDirectMethods() == 1) { @@ -238,9 +213,9 @@ class ClassLinkerTest : public CommonTest { } } EXPECT_EQ(klass->IsInterface(), klass->GetVTable() == NULL); - const IfTable* iftable = klass->GetIfTable(); + const mirror::IfTable* iftable = klass->GetIfTable(); for (int i = 0; i < klass->GetIfTableCount(); i++) { - Class* interface = iftable->GetInterface(i); + mirror::Class* interface = iftable->GetInterface(i); ASSERT_TRUE(interface != NULL); if (klass->IsInterface()) { EXPECT_EQ(0U, iftable->GetMethodArrayCount(i)); @@ -266,27 +241,27 @@ class ClassLinkerTest : public CommonTest { EXPECT_TRUE(klass->CanAccess(klass)); for (size_t i = 0; i < klass->NumDirectMethods(); i++) { - AbstractMethod* method = klass->GetDirectMethod(i); + mirror::ArtMethod* method = klass->GetDirectMethod(i); AssertMethod(method); EXPECT_TRUE(method->IsDirect()); EXPECT_EQ(klass, method->GetDeclaringClass()); } for (size_t i = 0; i < klass->NumVirtualMethods(); i++) { - AbstractMethod* method = klass->GetVirtualMethod(i); + mirror::ArtMethod* method = klass->GetVirtualMethod(i); AssertMethod(method); EXPECT_FALSE(method->IsDirect()); EXPECT_TRUE(method->GetDeclaringClass()->IsAssignableFrom(klass)); } for (size_t i = 0; i < klass->NumInstanceFields(); i++) { - Field* field = klass->GetInstanceField(i); + mirror::ArtField* field = klass->GetInstanceField(i); AssertField(klass, field); EXPECT_FALSE(field->IsStatic()); } for (size_t i = 0; i < klass->NumStaticFields(); i++) { - Field* field = klass->GetStaticField(i); + mirror::ArtField* field = klass->GetStaticField(i); AssertField(klass, field); EXPECT_TRUE(field->IsStatic()); } @@ -295,17 +270,17 @@ class ClassLinkerTest : public CommonTest { EXPECT_GE(klass->NumInstanceFields(), klass->NumReferenceInstanceFields()); FieldHelper fh; for (size_t i = 0; i < klass->NumReferenceInstanceFields(); i++) { - Field* field = klass->GetInstanceField(i); + mirror::ArtField* field = klass->GetInstanceField(i); fh.ChangeField(field); ASSERT_TRUE(!fh.IsPrimitiveType()); - Class* field_type = fh.GetType(); + mirror::Class* field_type = fh.GetType(); ASSERT_TRUE(field_type != NULL); ASSERT_TRUE(!field_type->IsPrimitive()); } for (size_t i = klass->NumReferenceInstanceFields(); i < klass->NumInstanceFields(); i++) { - Field* field = klass->GetInstanceField(i); + mirror::ArtField* field = klass->GetInstanceField(i); fh.ChangeField(field); - Class* field_type = fh.GetType(); + mirror::Class* field_type = fh.GetType(); ASSERT_TRUE(field_type != NULL); if (!fh.IsPrimitiveType() || !field_type->IsPrimitive()) { // While Reference.referent is not primitive, the ClassLinker @@ -315,7 +290,7 @@ class ClassLinkerTest : public CommonTest { } size_t total_num_reference_instance_fields = 0; - Class* k = klass; + mirror::Class* k = klass; while (k != NULL) { total_num_reference_instance_fields += k->NumReferenceInstanceFields(); k = k->GetSuperClass(); @@ -324,10 +299,10 @@ class ClassLinkerTest : public CommonTest { total_num_reference_instance_fields == 0); } - void AssertDexFileClass(ClassLoader* class_loader, const std::string& descriptor) + void AssertDexFileClass(mirror::ClassLoader* class_loader, const std::string& descriptor) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ASSERT_TRUE(descriptor != NULL); - Class* klass = class_linker_->FindSystemClass(descriptor.c_str()); + mirror::Class* klass = class_linker_->FindSystemClass(descriptor.c_str()); ASSERT_TRUE(klass != NULL); EXPECT_STREQ(descriptor.c_str(), ClassHelper(klass).GetDescriptor()); EXPECT_EQ(class_loader, klass->GetClassLoader()); @@ -340,7 +315,7 @@ class ClassLinkerTest : public CommonTest { } } - void AssertDexFile(const DexFile* dex, ClassLoader* class_loader) + void AssertDexFile(const DexFile* dex, mirror::ClassLoader* class_loader) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ASSERT_TRUE(dex != NULL); @@ -358,14 +333,14 @@ class ClassLinkerTest : public CommonTest { } class_linker_->VisitRoots(TestRootVisitor, NULL, false); // Verify the dex cache has resolution methods in all resolved method slots - DexCache* dex_cache = class_linker_->FindDexCache(*dex); - ObjectArray* resolved_methods = dex_cache->GetResolvedMethods(); + mirror::DexCache* dex_cache = class_linker_->FindDexCache(*dex); + mirror::ObjectArray* resolved_methods = dex_cache->GetResolvedMethods(); for (size_t i = 0; i < static_cast(resolved_methods->GetLength()); i++) { EXPECT_TRUE(resolved_methods->Get(i) != NULL); } } - static void TestRootVisitor(const Object* root, void*) { + static void TestRootVisitor(const mirror::Object* root, void*) { EXPECT_TRUE(root != NULL); } }; @@ -385,7 +360,7 @@ struct CheckOffsets { std::vector offsets; bool Check() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - Class* klass = Runtime::Current()->GetClassLinker()->FindSystemClass(class_descriptor.c_str()); + mirror::Class* klass = Runtime::Current()->GetClassLinker()->FindSystemClass(class_descriptor.c_str()); CHECK(klass != NULL) << class_descriptor; bool error = false; @@ -412,7 +387,7 @@ struct CheckOffsets { FieldHelper fh; for (size_t i = 0; i < offsets.size(); i++) { - Field* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); + mirror::ArtField* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); fh.ChangeField(field); StringPiece field_name(fh.GetName()); if (field_name != offsets[i].java_name) { @@ -422,7 +397,7 @@ struct CheckOffsets { if (error) { for (size_t i = 0; i < offsets.size(); i++) { CheckOffset& offset = offsets[i]; - Field* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); + mirror::ArtField* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); fh.ChangeField(field); StringPiece field_name(fh.GetName()); if (field_name != offsets[i].java_name) { @@ -437,7 +412,7 @@ struct CheckOffsets { for (size_t i = 0; i < offsets.size(); i++) { CheckOffset& offset = offsets[i]; - Field* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); + mirror::ArtField* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); if (field->GetOffset().Uint32Value() != offset.cpp_offset) { error = true; } @@ -445,7 +420,7 @@ struct CheckOffsets { if (error) { for (size_t i = 0; i < offsets.size(); i++) { CheckOffset& offset = offsets[i]; - Field* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); + mirror::ArtField* field = is_static ? klass->GetStaticField(i) : klass->GetInstanceField(i); if (field->GetOffset().Uint32Value() != offset.cpp_offset) { LOG(ERROR) << "OFFSET MISMATCH NEXT LINE:"; } @@ -464,195 +439,179 @@ struct CheckOffsets { // Note that ClassLinkerTest.ValidateFieldOrderOfJavaCppUnionClasses // is first since if it is failing, others are unlikely to succeed. -struct ObjectOffsets : public CheckOffsets { - ObjectOffsets() : CheckOffsets(false, "Ljava/lang/Object;") { +struct ObjectOffsets : public CheckOffsets { + ObjectOffsets() : CheckOffsets(false, "Ljava/lang/Object;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Object, klass_), "shadow$_klass_")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Object, klass_), "shadow$_klass_")); // alphabetical 32-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Object, monitor_), "shadow$_monitor_")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Object, monitor_), "shadow$_monitor_")); }; }; -struct FieldOffsets : public CheckOffsets { - FieldOffsets() : CheckOffsets(false, "Ljava/lang/reflect/Field;") { +struct ArtFieldOffsets : public CheckOffsets { + ArtFieldOffsets() : CheckOffsets(false, "Ljava/lang/reflect/ArtField;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Field, declaring_class_), "declaringClass")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtField, declaring_class_), "declaringClass")); // alphabetical 32-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Field, access_flags_), "accessFlags")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Field, field_dex_idx_), "fieldDexIndex")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Field, offset_), "offset")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtField, access_flags_), "accessFlags")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtField, field_dex_idx_), "fieldDexIndex")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtField, offset_), "offset")); }; }; -struct AbstractMethodOffsets : public CheckOffsets { - AbstractMethodOffsets() : CheckOffsets(false, "Ljava/lang/reflect/AbstractMethod;") { +struct ArtMethodOffsets : public CheckOffsets { + ArtMethodOffsets() : CheckOffsets(false, "Ljava/lang/reflect/ArtMethod;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, declaring_class_), "declaringClass")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, dex_cache_initialized_static_storage_), "dexCacheInitializedStaticStorage")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, dex_cache_resolved_methods_), "dexCacheResolvedMethods")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, dex_cache_resolved_types_), "dexCacheResolvedTypes")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, dex_cache_strings_), "dexCacheStrings")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, declaring_class_), "declaringClass")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, dex_cache_initialized_static_storage_), "dexCacheInitializedStaticStorage")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, dex_cache_resolved_methods_), "dexCacheResolvedMethods")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, dex_cache_resolved_types_), "dexCacheResolvedTypes")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, dex_cache_strings_), "dexCacheStrings")); // alphabetical 32-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, access_flags_), "accessFlags")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, code_item_offset_), "codeItemOffset")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, core_spill_mask_), "coreSpillMask")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_compiled_code_), "entryPointFromCompiledCode")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_interpreter_), "entryPointFromInterpreter")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, fp_spill_mask_), "fpSpillMask")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, frame_size_in_bytes_), "frameSizeInBytes")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, gc_map_), "gcMap")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, mapping_table_), "mappingTable")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, method_dex_index_), "methodDexIndex")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, method_index_), "methodIndex")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, native_method_), "nativeMethod")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethod, vmap_table_), "vmapTable")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, access_flags_), "accessFlags")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, code_item_offset_), "codeItemOffset")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, core_spill_mask_), "coreSpillMask")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, entry_point_from_compiled_code_), "entryPointFromCompiledCode")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, entry_point_from_interpreter_), "entryPointFromInterpreter")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, fp_spill_mask_), "fpSpillMask")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, frame_size_in_bytes_), "frameSizeInBytes")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, gc_map_), "gcMap")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, mapping_table_), "mappingTable")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, method_dex_index_), "methodDexIndex")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, method_index_), "methodIndex")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, native_method_), "nativeMethod")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ArtMethod, vmap_table_), "vmapTable")); }; }; -struct ConstructorOffsets : public CheckOffsets { - // java.lang.reflect.Constructor is a subclass of java.lang.reflect.AbstractMethod - ConstructorOffsets() : CheckOffsets(false, "Ljava/lang/reflect/Constructor;") { - } -}; - -struct MethodOffsets : public CheckOffsets { - // java.lang.reflect.Method is a subclass of java.lang.reflect.AbstractMethod - MethodOffsets() : CheckOffsets(false, "Ljava/lang/reflect/Method;") { - } -}; - -struct ClassOffsets : public CheckOffsets { - ClassOffsets() : CheckOffsets(false, "Ljava/lang/Class;") { +struct ClassOffsets : public CheckOffsets { + ClassOffsets() : CheckOffsets(false, "Ljava/lang/Class;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, class_loader_), "classLoader")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, component_type_), "componentType")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, dex_cache_), "dexCache")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, direct_methods_), "directMethods")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, ifields_), "iFields")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, iftable_), "ifTable")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, name_), "name")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, sfields_), "sFields")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, super_class_), "superClass")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, verify_error_class_), "verifyErrorClass")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, virtual_methods_), "virtualMethods")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, vtable_), "vtable")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, class_loader_), "classLoader")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, component_type_), "componentType")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, dex_cache_), "dexCache")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, direct_methods_), "directMethods")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, ifields_), "iFields")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, iftable_), "ifTable")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, name_), "name")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, sfields_), "sFields")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, super_class_), "superClass")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, verify_error_class_), "verifyErrorClass")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, virtual_methods_), "virtualMethods")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, vtable_), "vtable")); // alphabetical 32-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, access_flags_), "accessFlags")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, class_size_), "classSize")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, clinit_thread_id_), "clinitThreadId")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, dex_type_idx_), "dexTypeIndex")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, num_reference_instance_fields_), "numReferenceInstanceFields")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, num_reference_static_fields_), "numReferenceStaticFields")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, object_size_), "objectSize")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, primitive_type_), "primitiveType")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, reference_instance_offsets_), "referenceInstanceOffsets")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, reference_static_offsets_), "referenceStaticOffsets")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Class, status_), "status")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, access_flags_), "accessFlags")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, class_size_), "classSize")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, clinit_thread_id_), "clinitThreadId")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, dex_type_idx_), "dexTypeIndex")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, num_reference_instance_fields_), "numReferenceInstanceFields")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, num_reference_static_fields_), "numReferenceStaticFields")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, object_size_), "objectSize")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, primitive_type_), "primitiveType")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, reference_instance_offsets_), "referenceInstanceOffsets")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, reference_static_offsets_), "referenceStaticOffsets")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Class, status_), "status")); }; }; -struct StringOffsets : public CheckOffsets { - StringOffsets() : CheckOffsets(false, "Ljava/lang/String;") { +struct StringOffsets : public CheckOffsets { + StringOffsets() : CheckOffsets(false, "Ljava/lang/String;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(String, array_), "value")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::String, array_), "value")); // alphabetical 32-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(String, count_), "count")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(String, hash_code_), "hashCode")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(String, offset_), "offset")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::String, count_), "count")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::String, hash_code_), "hashCode")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::String, offset_), "offset")); }; }; -struct ThrowableOffsets : public CheckOffsets { - ThrowableOffsets() : CheckOffsets(false, "Ljava/lang/Throwable;") { +struct ThrowableOffsets : public CheckOffsets { + ThrowableOffsets() : CheckOffsets(false, "Ljava/lang/Throwable;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Throwable, cause_), "cause")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Throwable, detail_message_), "detailMessage")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Throwable, stack_state_), "stackState")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Throwable, stack_trace_), "stackTrace")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Throwable, suppressed_exceptions_), "suppressedExceptions")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Throwable, cause_), "cause")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Throwable, detail_message_), "detailMessage")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Throwable, stack_state_), "stackState")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Throwable, stack_trace_), "stackTrace")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Throwable, suppressed_exceptions_), "suppressedExceptions")); }; }; -struct StackTraceElementOffsets : public CheckOffsets { - StackTraceElementOffsets() : CheckOffsets(false, "Ljava/lang/StackTraceElement;") { +struct StackTraceElementOffsets : public CheckOffsets { + StackTraceElementOffsets() : CheckOffsets(false, "Ljava/lang/StackTraceElement;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StackTraceElement, declaring_class_), "declaringClass")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StackTraceElement, file_name_), "fileName")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StackTraceElement, method_name_), "methodName")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StackTraceElement, line_number_), "lineNumber")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StackTraceElement, declaring_class_), "declaringClass")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StackTraceElement, file_name_), "fileName")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StackTraceElement, method_name_), "methodName")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StackTraceElement, line_number_), "lineNumber")); }; }; -struct ClassLoaderOffsets : public CheckOffsets { - ClassLoaderOffsets() : CheckOffsets(false, "Ljava/lang/ClassLoader;") { +struct ClassLoaderOffsets : public CheckOffsets { + ClassLoaderOffsets() : CheckOffsets(false, "Ljava/lang/ClassLoader;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(ClassLoader, packages_), "packages")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(ClassLoader, parent_), "parent")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(ClassLoader, proxyCache_), "proxyCache")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ClassLoader, packages_), "packages")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ClassLoader, parent_), "parent")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ClassLoader, proxyCache_), "proxyCache")); }; }; -struct ProxyOffsets : public CheckOffsets { - ProxyOffsets() : CheckOffsets(false, "Ljava/lang/reflect/Proxy;") { +struct ProxyOffsets : public CheckOffsets { + ProxyOffsets() : CheckOffsets(false, "Ljava/lang/reflect/Proxy;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(Proxy, h_), "h")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::Proxy, h_), "h")); }; }; -struct ClassClassOffsets : public CheckOffsets { - ClassClassOffsets() : CheckOffsets(true, "Ljava/lang/Class;") { +struct ClassClassOffsets : public CheckOffsets { + ClassClassOffsets() : CheckOffsets(true, "Ljava/lang/Class;") { // padding 32-bit - CHECK_EQ(OFFSETOF_MEMBER(ClassClass, padding_) + 4, - OFFSETOF_MEMBER(ClassClass, serialVersionUID_)); + CHECK_EQ(OFFSETOF_MEMBER(mirror::ClassClass, padding_) + 4, + OFFSETOF_MEMBER(mirror::ClassClass, serialVersionUID_)); // alphabetical 64-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(ClassClass, serialVersionUID_), "serialVersionUID")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::ClassClass, serialVersionUID_), "serialVersionUID")); }; }; -struct StringClassOffsets : public CheckOffsets { - StringClassOffsets() : CheckOffsets(true, "Ljava/lang/String;") { +struct StringClassOffsets : public CheckOffsets { + StringClassOffsets() : CheckOffsets(true, "Ljava/lang/String;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StringClass, ASCII_), "ASCII")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StringClass, CASE_INSENSITIVE_ORDER_), "CASE_INSENSITIVE_ORDER")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StringClass, ASCII_), "ASCII")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StringClass, CASE_INSENSITIVE_ORDER_), "CASE_INSENSITIVE_ORDER")); // padding 32-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StringClass, REPLACEMENT_CHAR_), "REPLACEMENT_CHAR")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StringClass, REPLACEMENT_CHAR_), "REPLACEMENT_CHAR")); // alphabetical 64-bit - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(StringClass, serialVersionUID_), "serialVersionUID")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::StringClass, serialVersionUID_), "serialVersionUID")); }; }; -struct FieldClassOffsets : public CheckOffsets { - FieldClassOffsets() : CheckOffsets(true, "Ljava/lang/reflect/Field;") { - // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(FieldClass, ORDER_BY_NAME_AND_DECLARING_CLASS_), "ORDER_BY_NAME_AND_DECLARING_CLASS")); +struct ArtFieldClassOffsets : public CheckOffsets { + ArtFieldClassOffsets() : CheckOffsets(true, "Ljava/lang/reflect/ArtField;") { }; }; -struct MethodClassOffsets : public CheckOffsets { - MethodClassOffsets() : CheckOffsets(true, "Ljava/lang/reflect/Method;") { - // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(AbstractMethodClass, ORDER_BY_SIGNATURE_), "ORDER_BY_SIGNATURE")); +struct ArtMethodClassOffsets : public CheckOffsets { + ArtMethodClassOffsets() : CheckOffsets(true, "Ljava/lang/reflect/ArtMethod;") { }; }; -struct DexCacheOffsets : public CheckOffsets { - DexCacheOffsets() : CheckOffsets(false, "Ljava/lang/DexCache;") { +struct DexCacheOffsets : public CheckOffsets { + DexCacheOffsets() : CheckOffsets(false, "Ljava/lang/DexCache;") { // alphabetical references - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(DexCache, initialized_static_storage_), "initializedStaticStorage")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(DexCache, location_), "location")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(DexCache, resolved_fields_), "resolvedFields")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(DexCache, resolved_methods_), "resolvedMethods")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(DexCache, resolved_types_), "resolvedTypes")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(DexCache, strings_), "strings")); - offsets.push_back(CheckOffset(OFFSETOF_MEMBER(DexCache, dex_file_), "dexFile")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::DexCache, initialized_static_storage_), "initializedStaticStorage")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::DexCache, location_), "location")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::DexCache, resolved_fields_), "resolvedFields")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::DexCache, resolved_methods_), "resolvedMethods")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::DexCache, resolved_types_), "resolvedTypes")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::DexCache, strings_), "strings")); + offsets.push_back(CheckOffset(OFFSETOF_MEMBER(mirror::DexCache, dex_file_), "dexFile")); }; }; @@ -662,10 +621,8 @@ struct DexCacheOffsets : public CheckOffsets { TEST_F(ClassLinkerTest, ValidateFieldOrderOfJavaCppUnionClasses) { ScopedObjectAccess soa(Thread::Current()); EXPECT_TRUE(ObjectOffsets().Check()); - EXPECT_TRUE(ConstructorOffsets().Check()); - EXPECT_TRUE(MethodOffsets().Check()); - EXPECT_TRUE(FieldOffsets().Check()); - EXPECT_TRUE(AbstractMethodOffsets().Check()); + EXPECT_TRUE(ArtFieldOffsets().Check()); + EXPECT_TRUE(ArtMethodOffsets().Check()); EXPECT_TRUE(ClassOffsets().Check()); EXPECT_TRUE(StringOffsets().Check()); EXPECT_TRUE(ThrowableOffsets().Check()); @@ -676,8 +633,8 @@ TEST_F(ClassLinkerTest, ValidateFieldOrderOfJavaCppUnionClasses) { EXPECT_TRUE(ClassClassOffsets().Check()); EXPECT_TRUE(StringClassOffsets().Check()); - EXPECT_TRUE(FieldClassOffsets().Check()); - EXPECT_TRUE(MethodClassOffsets().Check()); + EXPECT_TRUE(ArtFieldClassOffsets().Check()); + EXPECT_TRUE(ArtMethodClassOffsets().Check()); } TEST_F(ClassLinkerTest, FindClassNonexistent) { @@ -688,14 +645,14 @@ TEST_F(ClassLinkerTest, FindClassNonexistent) { TEST_F(ClassLinkerTest, FindClassNested) { ScopedObjectAccess soa(Thread::Current()); - SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("Nested"))); + SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("Nested"))); - Class* outer = class_linker_->FindClass("LNested;", class_loader.get()); + mirror::Class* outer = class_linker_->FindClass("LNested;", class_loader.get()); ASSERT_TRUE(outer != NULL); EXPECT_EQ(0U, outer->NumVirtualMethods()); EXPECT_EQ(1U, outer->NumDirectMethods()); - Class* inner = class_linker_->FindClass("LNested$Inner;", class_loader.get()); + mirror::Class* inner = class_linker_->FindClass("LNested$Inner;", class_loader.get()); ASSERT_TRUE(inner != NULL); EXPECT_EQ(0U, inner->NumVirtualMethods()); EXPECT_EQ(1U, inner->NumDirectMethods()); @@ -717,7 +674,7 @@ TEST_F(ClassLinkerTest, FindClass_Primitives) { TEST_F(ClassLinkerTest, FindClass) { ScopedObjectAccess soa(Thread::Current()); - Class* JavaLangObject = class_linker_->FindSystemClass("Ljava/lang/Object;"); + mirror::Class* JavaLangObject = class_linker_->FindSystemClass("Ljava/lang/Object;"); ClassHelper kh(JavaLangObject); ASSERT_TRUE(JavaLangObject != NULL); ASSERT_TRUE(JavaLangObject->GetClass() != NULL); @@ -727,12 +684,12 @@ TEST_F(ClassLinkerTest, FindClass) { EXPECT_TRUE(JavaLangObject->GetSuperClass() == NULL); EXPECT_FALSE(JavaLangObject->HasSuperClass()); EXPECT_TRUE(JavaLangObject->GetClassLoader() == NULL); - EXPECT_EQ(Class::kStatusResolved, JavaLangObject->GetStatus()); + EXPECT_EQ(mirror::Class::kStatusInitialized, JavaLangObject->GetStatus()); EXPECT_FALSE(JavaLangObject->IsErroneous()); EXPECT_TRUE(JavaLangObject->IsLoaded()); EXPECT_TRUE(JavaLangObject->IsResolved()); - EXPECT_FALSE(JavaLangObject->IsVerified()); - EXPECT_FALSE(JavaLangObject->IsInitialized()); + EXPECT_TRUE(JavaLangObject->IsVerified()); + EXPECT_TRUE(JavaLangObject->IsInitialized()); EXPECT_FALSE(JavaLangObject->IsArrayInstance()); EXPECT_FALSE(JavaLangObject->IsArrayClass()); EXPECT_TRUE(JavaLangObject->GetComponentType() == NULL); @@ -752,9 +709,9 @@ TEST_F(ClassLinkerTest, FindClass) { EXPECT_EQ(0U, JavaLangObject->NumStaticFields()); EXPECT_EQ(0U, kh.NumDirectInterfaces()); - SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("MyClass"))); + SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("MyClass"))); AssertNonExistentClass("LMyClass;"); - Class* MyClass = class_linker_->FindClass("LMyClass;", class_loader.get()); + mirror::Class* MyClass = class_linker_->FindClass("LMyClass;", class_loader.get()); kh.ChangeClass(MyClass); ASSERT_TRUE(MyClass != NULL); ASSERT_TRUE(MyClass->GetClass() != NULL); @@ -764,7 +721,7 @@ TEST_F(ClassLinkerTest, FindClass) { EXPECT_TRUE(MyClass->GetSuperClass() == JavaLangObject); EXPECT_TRUE(MyClass->HasSuperClass()); EXPECT_EQ(class_loader.get(), MyClass->GetClassLoader()); - EXPECT_EQ(Class::kStatusResolved, MyClass->GetStatus()); + EXPECT_EQ(mirror::Class::kStatusResolved, MyClass->GetStatus()); EXPECT_FALSE(MyClass->IsErroneous()); EXPECT_TRUE(MyClass->IsLoaded()); EXPECT_TRUE(MyClass->IsResolved()); @@ -805,12 +762,13 @@ TEST_F(ClassLinkerTest, LibCore) { // start of the object TEST_F(ClassLinkerTest, ValidateObjectArrayElementsOffset) { ScopedObjectAccess soa(Thread::Current()); - Class* array_class = class_linker_->FindSystemClass("[Ljava/lang/String;"); - ObjectArray* array = ObjectArray::Alloc(soa.Self(), array_class, 0); + mirror::Class* array_class = class_linker_->FindSystemClass("[Ljava/lang/String;"); + mirror::ObjectArray* array = + mirror::ObjectArray::Alloc(soa.Self(), array_class, 0); uint32_t array_offset = reinterpret_cast(array); uint32_t data_offset = - array_offset + ObjectArray::DataOffset(sizeof(String*)).Uint32Value(); - if (sizeof(String*) == sizeof(int32_t)) { + array_offset + mirror::ObjectArray::DataOffset(sizeof(mirror::String*)).Uint32Value(); + if (sizeof(mirror::String*) == sizeof(int32_t)) { EXPECT_TRUE(IsAligned<4>(data_offset)); // Check 4 byte alignment. } else { EXPECT_TRUE(IsAligned<8>(data_offset)); // Check 8 byte alignment. @@ -819,27 +777,27 @@ TEST_F(ClassLinkerTest, ValidateObjectArrayElementsOffset) { TEST_F(ClassLinkerTest, ValidatePrimitiveArrayElementsOffset) { ScopedObjectAccess soa(Thread::Current()); - SirtRef long_array(soa.Self(), LongArray::Alloc(soa.Self(), 0)); + SirtRef long_array(soa.Self(), mirror::LongArray::Alloc(soa.Self(), 0)); EXPECT_EQ(class_linker_->FindSystemClass("[J"), long_array->GetClass()); uintptr_t data_offset = reinterpret_cast(long_array->GetData()); EXPECT_TRUE(IsAligned<8>(data_offset)); // Longs require 8 byte alignment - SirtRef double_array(soa.Self(), DoubleArray::Alloc(soa.Self(), 0)); + SirtRef double_array(soa.Self(), mirror::DoubleArray::Alloc(soa.Self(), 0)); EXPECT_EQ(class_linker_->FindSystemClass("[D"), double_array->GetClass()); data_offset = reinterpret_cast(double_array->GetData()); EXPECT_TRUE(IsAligned<8>(data_offset)); // Doubles require 8 byte alignment - SirtRef int_array(soa.Self(), IntArray::Alloc(soa.Self(), 0)); + SirtRef int_array(soa.Self(), mirror::IntArray::Alloc(soa.Self(), 0)); EXPECT_EQ(class_linker_->FindSystemClass("[I"), int_array->GetClass()); data_offset = reinterpret_cast(int_array->GetData()); EXPECT_TRUE(IsAligned<4>(data_offset)); // Ints require 4 byte alignment - SirtRef char_array(soa.Self(), CharArray::Alloc(soa.Self(), 0)); + SirtRef char_array(soa.Self(), mirror::CharArray::Alloc(soa.Self(), 0)); EXPECT_EQ(class_linker_->FindSystemClass("[C"), char_array->GetClass()); data_offset = reinterpret_cast(char_array->GetData()); EXPECT_TRUE(IsAligned<2>(data_offset)); // Chars require 2 byte alignment - SirtRef short_array(soa.Self(), ShortArray::Alloc(soa.Self(), 0)); + SirtRef short_array(soa.Self(), mirror::ShortArray::Alloc(soa.Self(), 0)); EXPECT_EQ(class_linker_->FindSystemClass("[S"), short_array->GetClass()); data_offset = reinterpret_cast(short_array->GetData()); EXPECT_TRUE(IsAligned<2>(data_offset)); // Shorts require 2 byte alignment @@ -851,7 +809,7 @@ TEST_F(ClassLinkerTest, ValidateBoxedTypes) { // Validate that the "value" field is always the 0th field in each of java.lang's box classes. // This lets UnboxPrimitive avoid searching for the field by name at runtime. ScopedObjectAccess soa(Thread::Current()); - Class* c; + mirror::Class* c; c = class_linker_->FindClass("Ljava/lang/Boolean;", NULL); FieldHelper fh(c->GetIFields()->Get(0)); EXPECT_STREQ("value", fh.GetName()); @@ -880,10 +838,10 @@ TEST_F(ClassLinkerTest, ValidateBoxedTypes) { TEST_F(ClassLinkerTest, TwoClassLoadersOneClass) { ScopedObjectAccess soa(Thread::Current()); - SirtRef class_loader_1(soa.Self(), soa.Decode(LoadDex("MyClass"))); - SirtRef class_loader_2(soa.Self(), soa.Decode(LoadDex("MyClass"))); - Class* MyClass_1 = class_linker_->FindClass("LMyClass;", class_loader_1.get()); - Class* MyClass_2 = class_linker_->FindClass("LMyClass;", class_loader_2.get()); + SirtRef class_loader_1(soa.Self(), soa.Decode(LoadDex("MyClass"))); + SirtRef class_loader_2(soa.Self(), soa.Decode(LoadDex("MyClass"))); + mirror::Class* MyClass_1 = class_linker_->FindClass("LMyClass;", class_loader_1.get()); + mirror::Class* MyClass_2 = class_linker_->FindClass("LMyClass;", class_loader_2.get()); EXPECT_TRUE(MyClass_1 != NULL); EXPECT_TRUE(MyClass_2 != NULL); EXPECT_NE(MyClass_1, MyClass_2); @@ -891,72 +849,72 @@ TEST_F(ClassLinkerTest, TwoClassLoadersOneClass) { TEST_F(ClassLinkerTest, StaticFields) { ScopedObjectAccess soa(Thread::Current()); - SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("Statics"))); - Class* statics = class_linker_->FindClass("LStatics;", class_loader.get()); + SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("Statics"))); + mirror::Class* statics = class_linker_->FindClass("LStatics;", class_loader.get()); class_linker_->EnsureInitialized(statics, true, true); // Static final primitives that are initialized by a compile-time constant // expression resolve to a copy of a constant value from the constant pool. // So should be null. - AbstractMethod* clinit = statics->FindDirectMethod("", "()V"); + mirror::ArtMethod* clinit = statics->FindDirectMethod("", "()V"); EXPECT_TRUE(clinit == NULL); EXPECT_EQ(9U, statics->NumStaticFields()); - Field* s0 = statics->FindStaticField("s0", "Z"); + mirror::ArtField* s0 = statics->FindStaticField("s0", "Z"); FieldHelper fh(s0); - EXPECT_STREQ(ClassHelper(s0->GetClass()).GetDescriptor(), "Ljava/lang/reflect/Field;"); + EXPECT_STREQ(ClassHelper(s0->GetClass()).GetDescriptor(), "Ljava/lang/reflect/ArtField;"); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimBoolean); EXPECT_EQ(true, s0->GetBoolean(statics)); s0->SetBoolean(statics, false); - Field* s1 = statics->FindStaticField("s1", "B"); + mirror::ArtField* s1 = statics->FindStaticField("s1", "B"); fh.ChangeField(s1); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimByte); EXPECT_EQ(5, s1->GetByte(statics)); s1->SetByte(statics, 6); - Field* s2 = statics->FindStaticField("s2", "C"); + mirror::ArtField* s2 = statics->FindStaticField("s2", "C"); fh.ChangeField(s2); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimChar); EXPECT_EQ('a', s2->GetChar(statics)); s2->SetChar(statics, 'b'); - Field* s3 = statics->FindStaticField("s3", "S"); + mirror::ArtField* s3 = statics->FindStaticField("s3", "S"); fh.ChangeField(s3); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimShort); EXPECT_EQ(-536, s3->GetShort(statics)); s3->SetShort(statics, -535); - Field* s4 = statics->FindStaticField("s4", "I"); + mirror::ArtField* s4 = statics->FindStaticField("s4", "I"); fh.ChangeField(s4); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimInt); EXPECT_EQ(2000000000, s4->GetInt(statics)); s4->SetInt(statics, 2000000001); - Field* s5 = statics->FindStaticField("s5", "J"); + mirror::ArtField* s5 = statics->FindStaticField("s5", "J"); fh.ChangeField(s5); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimLong); EXPECT_EQ(0x1234567890abcdefLL, s5->GetLong(statics)); s5->SetLong(statics, 0x34567890abcdef12LL); - Field* s6 = statics->FindStaticField("s6", "F"); + mirror::ArtField* s6 = statics->FindStaticField("s6", "F"); fh.ChangeField(s6); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimFloat); EXPECT_EQ(0.5, s6->GetFloat(statics)); s6->SetFloat(statics, 0.75); - Field* s7 = statics->FindStaticField("s7", "D"); + mirror::ArtField* s7 = statics->FindStaticField("s7", "D"); fh.ChangeField(s7); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimDouble); EXPECT_EQ(16777217, s7->GetDouble(statics)); s7->SetDouble(statics, 16777219); - Field* s8 = statics->FindStaticField("s8", "Ljava/lang/String;"); + mirror::ArtField* s8 = statics->FindStaticField("s8", "Ljava/lang/String;"); fh.ChangeField(s8); EXPECT_TRUE(fh.GetTypeAsPrimitiveType() == Primitive::kPrimNot); EXPECT_TRUE(s8->GetObject(statics)->AsString()->Equals("android")); - s8->SetObject(s8->GetDeclaringClass(), String::AllocFromModifiedUtf8(soa.Self(), "robot")); + s8->SetObject(s8->GetDeclaringClass(), mirror::String::AllocFromModifiedUtf8(soa.Self(), "robot")); // TODO: Remove EXPECT_FALSE when GCC can handle EXPECT_EQ // http://code.google.com/p/googletest/issues/detail?id=322 @@ -973,27 +931,27 @@ TEST_F(ClassLinkerTest, StaticFields) { TEST_F(ClassLinkerTest, Interfaces) { ScopedObjectAccess soa(Thread::Current()); - SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("Interfaces"))); - Class* I = class_linker_->FindClass("LInterfaces$I;", class_loader.get()); - Class* J = class_linker_->FindClass("LInterfaces$J;", class_loader.get()); - Class* K = class_linker_->FindClass("LInterfaces$K;", class_loader.get()); - Class* A = class_linker_->FindClass("LInterfaces$A;", class_loader.get()); - Class* B = class_linker_->FindClass("LInterfaces$B;", class_loader.get()); + SirtRef class_loader(soa.Self(), soa.Decode(LoadDex("Interfaces"))); + mirror::Class* I = class_linker_->FindClass("LInterfaces$I;", class_loader.get()); + mirror::Class* J = class_linker_->FindClass("LInterfaces$J;", class_loader.get()); + mirror::Class* K = class_linker_->FindClass("LInterfaces$K;", class_loader.get()); + mirror::Class* A = class_linker_->FindClass("LInterfaces$A;", class_loader.get()); + mirror::Class* B = class_linker_->FindClass("LInterfaces$B;", class_loader.get()); EXPECT_TRUE(I->IsAssignableFrom(A)); EXPECT_TRUE(J->IsAssignableFrom(A)); EXPECT_TRUE(J->IsAssignableFrom(K)); EXPECT_TRUE(K->IsAssignableFrom(B)); EXPECT_TRUE(J->IsAssignableFrom(B)); - AbstractMethod* Ii = I->FindVirtualMethod("i", "()V"); - AbstractMethod* Jj1 = J->FindVirtualMethod("j1", "()V"); - AbstractMethod* Jj2 = J->FindVirtualMethod("j2", "()V"); - AbstractMethod* Kj1 = K->FindInterfaceMethod("j1", "()V"); - AbstractMethod* Kj2 = K->FindInterfaceMethod("j2", "()V"); - AbstractMethod* Kk = K->FindInterfaceMethod("k", "()V"); - AbstractMethod* Ai = A->FindVirtualMethod("i", "()V"); - AbstractMethod* Aj1 = A->FindVirtualMethod("j1", "()V"); - AbstractMethod* Aj2 = A->FindVirtualMethod("j2", "()V"); + mirror::ArtMethod* Ii = I->FindVirtualMethod("i", "()V"); + mirror::ArtMethod* Jj1 = J->FindVirtualMethod("j1", "()V"); + mirror::ArtMethod* Jj2 = J->FindVirtualMethod("j2", "()V"); + mirror::ArtMethod* Kj1 = K->FindInterfaceMethod("j1", "()V"); + mirror::ArtMethod* Kj2 = K->FindInterfaceMethod("j2", "()V"); + mirror::ArtMethod* Kk = K->FindInterfaceMethod("k", "()V"); + mirror::ArtMethod* Ai = A->FindVirtualMethod("i", "()V"); + mirror::ArtMethod* Aj1 = A->FindVirtualMethod("j1", "()V"); + mirror::ArtMethod* Aj2 = A->FindVirtualMethod("j2", "()V"); ASSERT_TRUE(Ii != NULL); ASSERT_TRUE(Jj1 != NULL); ASSERT_TRUE(Jj2 != NULL); @@ -1015,10 +973,10 @@ TEST_F(ClassLinkerTest, Interfaces) { EXPECT_EQ(Aj1, A->FindVirtualMethodForVirtualOrInterface(Jj1)); EXPECT_EQ(Aj2, A->FindVirtualMethodForVirtualOrInterface(Jj2)); - Field* Afoo = A->FindStaticField("foo", "Ljava/lang/String;"); - Field* Bfoo = B->FindStaticField("foo", "Ljava/lang/String;"); - Field* Jfoo = J->FindStaticField("foo", "Ljava/lang/String;"); - Field* Kfoo = K->FindStaticField("foo", "Ljava/lang/String;"); + mirror::ArtField* Afoo = A->FindStaticField("foo", "Ljava/lang/String;"); + mirror::ArtField* Bfoo = B->FindStaticField("foo", "Ljava/lang/String;"); + mirror::ArtField* Jfoo = J->FindStaticField("foo", "Ljava/lang/String;"); + mirror::ArtField* Kfoo = K->FindStaticField("foo", "Ljava/lang/String;"); ASSERT_TRUE(Afoo != NULL); EXPECT_EQ(Afoo, Bfoo); EXPECT_EQ(Afoo, Jfoo); @@ -1033,30 +991,30 @@ TEST_F(ClassLinkerTest, ResolveVerifyAndClinit) { ScopedObjectAccess soa(Thread::Current()); jobject jclass_loader = LoadDex("StaticsFromCode"); - SirtRef class_loader(soa.Self(), soa.Decode(jclass_loader)); + SirtRef class_loader(soa.Self(), soa.Decode(jclass_loader)); const DexFile* dex_file = Runtime::Current()->GetCompileTimeClassPath(jclass_loader)[0]; CHECK(dex_file != NULL); - Class* klass = class_linker_->FindClass("LStaticsFromCode;", class_loader.get()); - AbstractMethod* clinit = klass->FindDirectMethod("", "()V"); - AbstractMethod* getS0 = klass->FindDirectMethod("getS0", "()Ljava/lang/Object;"); + mirror::Class* klass = class_linker_->FindClass("LStaticsFromCode;", class_loader.get()); + mirror::ArtMethod* clinit = klass->FindDirectMethod("", "()V"); + mirror::ArtMethod* getS0 = klass->FindDirectMethod("getS0", "()Ljava/lang/Object;"); const DexFile::StringId* string_id = dex_file->FindStringId("LStaticsFromCode;"); ASSERT_TRUE(string_id != NULL); const DexFile::TypeId* type_id = dex_file->FindTypeId(dex_file->GetIndexForStringId(*string_id)); ASSERT_TRUE(type_id != NULL); uint32_t type_idx = dex_file->GetIndexForTypeId(*type_id); EXPECT_TRUE(clinit->GetDexCacheInitializedStaticStorage()->Get(type_idx) == NULL); - StaticStorageBase* uninit = ResolveVerifyAndClinit(type_idx, clinit, Thread::Current(), true, false); + mirror::StaticStorageBase* uninit = ResolveVerifyAndClinit(type_idx, clinit, Thread::Current(), true, false); EXPECT_TRUE(uninit != NULL); EXPECT_TRUE(clinit->GetDexCacheInitializedStaticStorage()->Get(type_idx) == NULL); - StaticStorageBase* init = ResolveVerifyAndClinit(type_idx, getS0, Thread::Current(), true, false); + mirror::StaticStorageBase* init = ResolveVerifyAndClinit(type_idx, getS0, Thread::Current(), true, false); EXPECT_TRUE(init != NULL); EXPECT_EQ(init, clinit->GetDexCacheInitializedStaticStorage()->Get(type_idx)); } TEST_F(ClassLinkerTest, FinalizableBit) { ScopedObjectAccess soa(Thread::Current()); - Class* c; + mirror::Class* c; // Object has a finalize method, but we know it's empty. c = class_linker_->FindSystemClass("Ljava/lang/Object;"); @@ -1092,7 +1050,7 @@ TEST_F(ClassLinkerTest, ClassRootDescriptors) { ScopedObjectAccess soa(Thread::Current()); ClassHelper kh; for (int i = 0; i < ClassLinker::kClassRootsMax; i++) { - Class* klass = class_linker_->GetClassRoot(ClassLinker::ClassRoot(i)); + mirror::Class* klass = class_linker_->GetClassRoot(ClassLinker::ClassRoot(i)); kh.ChangeClass(klass); EXPECT_TRUE(kh.GetDescriptor() != NULL); EXPECT_STREQ(kh.GetDescriptor(), diff --git a/runtime/common_test.h b/runtime/common_test.h index 7110e117f3..ced2af9670 100644 --- a/runtime/common_test.h +++ b/runtime/common_test.h @@ -181,7 +181,7 @@ class CommonTest : public testing::Test { reinterpret_cast(gc_map)); } - void MakeExecutable(mirror::AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + void MakeExecutable(mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { CHECK(method != NULL); LOG(INFO) << "MakeExecutable " << PrettyMethod(method); @@ -348,7 +348,7 @@ class CommonTest : public testing::Test { compiler_driver_->SetSupportBootImageFixup(false); // We're back in native, take the opportunity to initialize well known classes. - WellKnownClasses::InitClasses(Thread::Current()->GetJniEnv()); + WellKnownClasses::Init(Thread::Current()->GetJniEnv()); // Create the heap thread pool so that the GC runs in parallel for tests. Normally, the thread // pool is created by the runtime. runtime_->GetHeap()->CreateThreadPool(); @@ -464,7 +464,7 @@ class CommonTest : public testing::Test { } } - void CompileMethod(mirror::AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + void CompileMethod(mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { CHECK(method != NULL); base::TimingLogger timings("CommonTest::CompileMethod", false, false); timings.StartSplit("CompileOne"); @@ -480,7 +480,7 @@ class CommonTest : public testing::Test { std::string class_descriptor(DotToDescriptor(class_name)); mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), class_loader); CHECK(klass != NULL) << "Class not found " << class_name; - mirror::AbstractMethod* method = klass->FindDirectMethod(method_name, signature); + mirror::ArtMethod* method = klass->FindDirectMethod(method_name, signature); CHECK(method != NULL) << "Direct method not found: " << class_name << "." << method_name << signature; CompileMethod(method); @@ -494,7 +494,7 @@ class CommonTest : public testing::Test { std::string class_descriptor(DotToDescriptor(class_name)); mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), class_loader); CHECK(klass != NULL) << "Class not found " << class_name; - mirror::AbstractMethod* method = klass->FindVirtualMethod(method_name, signature); + mirror::ArtMethod* method = klass->FindVirtualMethod(method_name, signature); CHECK(method != NULL) << "Virtual method not found: " << class_name << "." << method_name << signature; CompileMethod(method); diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc index 2a55e3138b..26ce5be1ec 100644 --- a/runtime/common_throws.cc +++ b/runtime/common_throws.cc @@ -21,7 +21,7 @@ #include "dex_file-inl.h" #include "dex_instruction-inl.h" #include "invoke_type.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" @@ -68,7 +68,7 @@ static void ThrowException(const ThrowLocation* throw_location, const char* exce // AbstractMethodError -void ThrowAbstractMethodError(const mirror::AbstractMethod* method) { +void ThrowAbstractMethodError(const mirror::ArtMethod* method) { ThrowException(NULL, "Ljava/lang/AbstractMethodError;", NULL, StringPrintf("abstract method \"%s\"", PrettyMethod(method).c_str()).c_str()); @@ -136,8 +136,8 @@ void ThrowIllegalAccessErrorClass(mirror::Class* referrer, mirror::Class* access } void ThrowIllegalAccessErrorClassForMethodDispatch(mirror::Class* referrer, mirror::Class* accessed, - const mirror::AbstractMethod* caller, - const mirror::AbstractMethod* called, + const mirror::ArtMethod* caller, + const mirror::ArtMethod* called, InvokeType type) { std::ostringstream msg; msg << "Illegal class access ('" << PrettyDescriptor(referrer) << "' attempting to access '" @@ -146,26 +146,27 @@ void ThrowIllegalAccessErrorClassForMethodDispatch(mirror::Class* referrer, mirr ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str()); } -void ThrowIllegalAccessErrorMethod(mirror::Class* referrer, mirror::AbstractMethod* accessed) { +void ThrowIllegalAccessErrorMethod(mirror::Class* referrer, mirror::ArtMethod* accessed) { std::ostringstream msg; msg << "Method '" << PrettyMethod(accessed) << "' is inaccessible to class '" << PrettyDescriptor(referrer) << "'"; ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str()); } -void ThrowIllegalAccessErrorField(mirror::Class* referrer, mirror::Field* accessed) { +void ThrowIllegalAccessErrorField(mirror::Class* referrer, mirror::ArtField* accessed) { std::ostringstream msg; msg << "Field '" << PrettyField(accessed, false) << "' is inaccessible to class '" << PrettyDescriptor(referrer) << "'"; ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer, msg.str().c_str()); } -void ThrowIllegalAccessErrorFinalField(const mirror::AbstractMethod* referrer, - mirror::Field* accessed) { +void ThrowIllegalAccessErrorFinalField(const mirror::ArtMethod* referrer, + mirror::ArtField* accessed) { std::ostringstream msg; msg << "Final field '" << PrettyField(accessed, false) << "' cannot be written to by method '" << PrettyMethod(referrer) << "'"; - ThrowException(NULL, "Ljava/lang/IllegalAccessError;", referrer != NULL ? referrer->GetClass() : NULL, + ThrowException(NULL, "Ljava/lang/IllegalAccessError;", + referrer != NULL ? referrer->GetClass() : NULL, msg.str().c_str()); } @@ -186,8 +187,8 @@ void ThrowIllegalArgumentException(const ThrowLocation* throw_location, const ch // IncompatibleClassChangeError void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type, - mirror::AbstractMethod* method, - const mirror::AbstractMethod* referrer) { + mirror::ArtMethod* method, + const mirror::ArtMethod* referrer) { std::ostringstream msg; msg << "The method '" << PrettyMethod(method) << "' was expected to be of type " << expected_type << " but instead was found to be of type " << found_type; @@ -196,9 +197,9 @@ void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType foun msg.str().c_str()); } -void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const mirror::AbstractMethod* interface_method, +void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const mirror::ArtMethod* interface_method, mirror::Object* this_object, - const mirror::AbstractMethod* referrer) { + const mirror::ArtMethod* referrer) { // Referrer is calling interface_method on this_object, however, the interface_method isn't // implemented by this_object. CHECK(this_object != NULL); @@ -212,8 +213,8 @@ void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const mirror::Ab msg.str().c_str()); } -void ThrowIncompatibleClassChangeErrorField(const mirror::Field* resolved_field, bool is_static, - const mirror::AbstractMethod* referrer) { +void ThrowIncompatibleClassChangeErrorField(const mirror::ArtField* resolved_field, bool is_static, + const mirror::ArtMethod* referrer) { std::ostringstream msg; msg << "Expected '" << PrettyField(resolved_field) << "' to be a " << (is_static ? "static" : "instance") << " field" << " rather than a " @@ -241,7 +242,8 @@ void ThrowLinkageError(const mirror::Class* referrer, const char* fmt, ...) { // NegativeArraySizeException void ThrowNegativeArraySizeException(int size) { - ThrowException(NULL, "Ljava/lang/NegativeArraySizeException;", NULL, StringPrintf("%d", size).c_str()); + ThrowException(NULL, "Ljava/lang/NegativeArraySizeException;", NULL, + StringPrintf("%d", size).c_str()); } void ThrowNegativeArraySizeException(const char* msg) { @@ -285,7 +287,7 @@ void ThrowNoSuchMethodError(uint32_t method_idx) { // NullPointerException void ThrowNullPointerExceptionForFieldAccess(const ThrowLocation& throw_location, - mirror::Field* field, bool is_read) { + mirror::ArtField* field, bool is_read) { std::ostringstream msg; msg << "Attempt to " << (is_read ? "read from" : "write to") << " field '" << PrettyField(field, true) << "' on a null object reference"; @@ -303,7 +305,8 @@ static void ThrowNullPointerExceptionForMethodAccessImpl(const ThrowLocation& th ThrowException(&throw_location, "Ljava/lang/NullPointerException;", NULL, msg.str().c_str()); } -void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location, uint32_t method_idx, +void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location, + uint32_t method_idx, InvokeType type) { mirror::DexCache* dex_cache = throw_location.GetMethod()->GetDeclaringClass()->GetDexCache(); const DexFile& dex_file = *dex_cache->GetDexFile(); @@ -312,7 +315,7 @@ void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_locatio } void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, InvokeType type) { mirror::DexCache* dex_cache = method->GetDeclaringClass()->GetDexCache(); const DexFile& dex_file = *dex_cache->GetDexFile(); @@ -348,7 +351,7 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) { case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: { // Since we replaced the method index, we ask the verifier to tell us which // method is invoked at this location. - mirror::AbstractMethod* method = + mirror::ArtMethod* method = verifier::MethodVerifier::FindInvokedMethodAtDexPc(throw_location.GetMethod(), throw_location.GetDexPc()); if (method != NULL) { @@ -368,7 +371,7 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) { case Instruction::IGET_BYTE: case Instruction::IGET_CHAR: case Instruction::IGET_SHORT: { - mirror::Field* field = + mirror::ArtField* field = Runtime::Current()->GetClassLinker()->ResolveField(instr->VRegC_22c(), throw_location.GetMethod(), false); ThrowNullPointerExceptionForFieldAccess(throw_location, field, true /* read */); @@ -379,7 +382,7 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) { case Instruction::IGET_OBJECT_QUICK: { // Since we replaced the field index, we ask the verifier to tell us which // field is accessed at this location. - mirror::Field* field = + mirror::ArtField* field = verifier::MethodVerifier::FindAccessedFieldAtDexPc(throw_location.GetMethod(), throw_location.GetDexPc()); if (field != NULL) { @@ -399,7 +402,7 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) { case Instruction::IPUT_BYTE: case Instruction::IPUT_CHAR: case Instruction::IPUT_SHORT: { - mirror::Field* field = + mirror::ArtField* field = Runtime::Current()->GetClassLinker()->ResolveField(instr->VRegC_22c(), throw_location.GetMethod(), false); ThrowNullPointerExceptionForFieldAccess(throw_location, field, false /* write */); @@ -410,7 +413,7 @@ void ThrowNullPointerExceptionFromDexPC(const ThrowLocation& throw_location) { case Instruction::IPUT_OBJECT_QUICK: { // Since we replaced the field index, we ask the verifier to tell us which // field is accessed at this location. - mirror::Field* field = + mirror::ArtField* field = verifier::MethodVerifier::FindAccessedFieldAtDexPc(throw_location.GetMethod(), throw_location.GetDexPc()); if (field != NULL) { diff --git a/runtime/common_throws.h b/runtime/common_throws.h index b7f2754df1..99c6343cdd 100644 --- a/runtime/common_throws.h +++ b/runtime/common_throws.h @@ -22,9 +22,9 @@ namespace art { namespace mirror { -class AbstractMethod; +class ArtField; +class ArtMethod; class Class; -class Field; class Object; } // namespace mirror class StringPiece; @@ -32,7 +32,7 @@ class ThrowLocation; // AbstractMethodError -void ThrowAbstractMethodError(const mirror::AbstractMethod* method) +void ThrowAbstractMethodError(const mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // ArithmeticException @@ -74,19 +74,19 @@ void ThrowIllegalAccessErrorClass(mirror::Class* referrer, mirror::Class* access SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void ThrowIllegalAccessErrorClassForMethodDispatch(mirror::Class* referrer, mirror::Class* accessed, - const mirror::AbstractMethod* caller, - const mirror::AbstractMethod* called, + const mirror::ArtMethod* caller, + const mirror::ArtMethod* called, InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -void ThrowIllegalAccessErrorMethod(mirror::Class* referrer, mirror::AbstractMethod* accessed) +void ThrowIllegalAccessErrorMethod(mirror::Class* referrer, mirror::ArtMethod* accessed) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -void ThrowIllegalAccessErrorField(mirror::Class* referrer, mirror::Field* accessed) +void ThrowIllegalAccessErrorField(mirror::Class* referrer, mirror::ArtField* accessed) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -void ThrowIllegalAccessErrorFinalField(const mirror::AbstractMethod* referrer, - mirror::Field* accessed) +void ThrowIllegalAccessErrorFinalField(const mirror::ArtMethod* referrer, + mirror::ArtField* accessed) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void ThrowIllegalAccessError(mirror::Class* referrer, const char* fmt, ...) @@ -101,17 +101,17 @@ void ThrowIllegalArgumentException(const ThrowLocation* throw_location, const ch // IncompatibleClassChangeError void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type, - mirror::AbstractMethod* method, - const mirror::AbstractMethod* referrer) + mirror::ArtMethod* method, + const mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const mirror::AbstractMethod* interface_method, +void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const mirror::ArtMethod* interface_method, mirror::Object* this_object, - const mirror::AbstractMethod* referrer) + const mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -void ThrowIncompatibleClassChangeErrorField(const mirror::Field* resolved_field, bool is_static, - const mirror::AbstractMethod* referrer) +void ThrowIncompatibleClassChangeErrorField(const mirror::ArtField* resolved_field, bool is_static, + const mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void ThrowIncompatibleClassChangeError(const mirror::Class* referrer, const char* fmt, ...) @@ -149,7 +149,7 @@ void ThrowNoSuchMethodError(uint32_t method_idx) // NullPointerException void ThrowNullPointerExceptionForFieldAccess(const ThrowLocation& throw_location, - mirror::Field* field, + mirror::ArtField* field, bool is_read) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -159,7 +159,7 @@ void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_locatio SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void ThrowNullPointerExceptionForMethodAccess(const ThrowLocation& throw_location, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 3591a5097b..569a370b3f 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -30,11 +30,11 @@ #include "gc/space/space-inl.h" #include "invoke_arg_array_builder.h" #include "jdwp/object_registry.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/throwable.h" @@ -60,7 +60,7 @@ static const size_t kMaxAllocRecordStackDepth = 16; // Max 255. static const size_t kDefaultNumAllocRecords = 64*1024; // Must be a power of 2. struct AllocRecordStackTraceElement { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; uint32_t dex_pc; int32_t LineNumber() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -84,9 +84,9 @@ struct AllocRecord { }; struct Breakpoint { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; uint32_t dex_pc; - Breakpoint(mirror::AbstractMethod* method, uint32_t dex_pc) : method(method), dex_pc(dex_pc) {} + Breakpoint(mirror::ArtMethod* method, uint32_t dex_pc) : method(method), dex_pc(dex_pc) {} }; static std::ostream& operator<<(std::ostream& os, const Breakpoint& rhs) @@ -103,7 +103,7 @@ struct SingleStepControl { JDWP::JdwpStepSize step_size; JDWP::JdwpStepDepth step_depth; - const mirror::AbstractMethod* method; + const mirror::ArtMethod* method; int32_t line_number; // Or -1 for native methods. std::set dex_pcs; int stack_depth; @@ -115,7 +115,7 @@ class DebugInstrumentationListener : public instrumentation::InstrumentationList virtual ~DebugInstrumentationListener() {} virtual void MethodEntered(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) + const mirror::ArtMethod* method, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (method->IsNative()) { // TODO: post location events is a suspension point and native method entry stubs aren't. @@ -125,7 +125,7 @@ class DebugInstrumentationListener : public instrumentation::InstrumentationList } virtual void MethodExited(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, + const mirror::ArtMethod* method, uint32_t dex_pc, const JValue& return_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { UNUSED(return_value); @@ -136,7 +136,7 @@ class DebugInstrumentationListener : public instrumentation::InstrumentationList Dbg::PostLocationEvent(method, dex_pc, this_object, Dbg::kMethodExit); } - virtual void MethodUnwind(Thread* thread, const mirror::AbstractMethod* method, + virtual void MethodUnwind(Thread* thread, const mirror::ArtMethod* method, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // We're not recorded to listen to this kind of event, so complain. LOG(ERROR) << "Unexpected method unwind event in debugger " << PrettyMethod(method) @@ -144,13 +144,13 @@ class DebugInstrumentationListener : public instrumentation::InstrumentationList } virtual void DexPcMoved(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t new_dex_pc) + const mirror::ArtMethod* method, uint32_t new_dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { Dbg::UpdateDebugger(thread, this_object, method, new_dex_pc); } virtual void ExceptionCaught(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, uint32_t catch_dex_pc, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception_object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { Dbg::PostException(thread, throw_location, catch_method, catch_dex_pc, exception_object); @@ -194,7 +194,7 @@ static size_t gAllocRecordCount GUARDED_BY(gAllocTrackerLock) = 0; static std::vector gBreakpoints GUARDED_BY(Locks::breakpoint_lock_); static SingleStepControl gSingleStepControl GUARDED_BY(Locks::breakpoint_lock_); -static bool IsBreakpoint(const mirror::AbstractMethod* m, uint32_t dex_pc) +static bool IsBreakpoint(const mirror::ArtMethod* m, uint32_t dex_pc) LOCKS_EXCLUDED(Locks::breakpoint_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { MutexLock mu(Thread::Current(), *Locks::breakpoint_lock_); @@ -1131,7 +1131,7 @@ bool Dbg::MatchType(JDWP::RefTypeId instance_class_id, JDWP::RefTypeId class_id) return c1->IsAssignableFrom(c2); } -static JDWP::FieldId ToFieldId(const mirror::Field* f) +static JDWP::FieldId ToFieldId(const mirror::ArtField* f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { #ifdef MOVING_GARBAGE_COLLECTOR UNIMPLEMENTED(FATAL); @@ -1140,7 +1140,7 @@ static JDWP::FieldId ToFieldId(const mirror::Field* f) #endif } -static JDWP::MethodId ToMethodId(const mirror::AbstractMethod* m) +static JDWP::MethodId ToMethodId(const mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { #ifdef MOVING_GARBAGE_COLLECTOR UNIMPLEMENTED(FATAL); @@ -1149,25 +1149,25 @@ static JDWP::MethodId ToMethodId(const mirror::AbstractMethod* m) #endif } -static mirror::Field* FromFieldId(JDWP::FieldId fid) +static mirror::ArtField* FromFieldId(JDWP::FieldId fid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { #ifdef MOVING_GARBAGE_COLLECTOR UNIMPLEMENTED(FATAL); #else - return reinterpret_cast(static_cast(fid)); + return reinterpret_cast(static_cast(fid)); #endif } -static mirror::AbstractMethod* FromMethodId(JDWP::MethodId mid) +static mirror::ArtMethod* FromMethodId(JDWP::MethodId mid) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { #ifdef MOVING_GARBAGE_COLLECTOR UNIMPLEMENTED(FATAL); #else - return reinterpret_cast(static_cast(mid)); + return reinterpret_cast(static_cast(mid)); #endif } -static void SetLocation(JDWP::JdwpLocation& location, mirror::AbstractMethod* m, uint32_t dex_pc) +static void SetLocation(JDWP::JdwpLocation& location, mirror::ArtMethod* m, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (m == NULL) { memset(&location, 0, sizeof(location)); @@ -1182,13 +1182,13 @@ static void SetLocation(JDWP::JdwpLocation& location, mirror::AbstractMethod* m, std::string Dbg::GetMethodName(JDWP::MethodId method_id) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = FromMethodId(method_id); + mirror::ArtMethod* m = FromMethodId(method_id); return MethodHelper(m).GetName(); } std::string Dbg::GetFieldName(JDWP::FieldId field_id) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* f = FromFieldId(field_id); + mirror::ArtField* f = FromFieldId(field_id); return FieldHelper(f).GetName(); } @@ -1230,7 +1230,7 @@ static uint16_t MangleSlot(uint16_t slot, const char* name) { return newSlot; } -static uint16_t DemangleSlot(uint16_t slot, mirror::AbstractMethod* m) +static uint16_t DemangleSlot(uint16_t slot, mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (slot == kEclipseWorkaroundSlot) { return 0; @@ -1255,7 +1255,7 @@ JDWP::JdwpError Dbg::OutputDeclaredFields(JDWP::RefTypeId class_id, bool with_ge expandBufAdd4BE(pReply, instance_field_count + static_field_count); for (size_t i = 0; i < instance_field_count + static_field_count; ++i) { - mirror::Field* f = (i < instance_field_count) ? c->GetInstanceField(i) : c->GetStaticField(i - instance_field_count); + mirror::ArtField* f = (i < instance_field_count) ? c->GetInstanceField(i) : c->GetStaticField(i - instance_field_count); FieldHelper fh(f); expandBufAddFieldId(pReply, ToFieldId(f)); expandBufAddUtf8String(pReply, fh.GetName()); @@ -1283,7 +1283,7 @@ JDWP::JdwpError Dbg::OutputDeclaredMethods(JDWP::RefTypeId class_id, bool with_g expandBufAdd4BE(pReply, direct_method_count + virtual_method_count); for (size_t i = 0; i < direct_method_count + virtual_method_count; ++i) { - mirror::AbstractMethod* m = (i < direct_method_count) ? c->GetDirectMethod(i) : c->GetVirtualMethod(i - direct_method_count); + mirror::ArtMethod* m = (i < direct_method_count) ? c->GetDirectMethod(i) : c->GetVirtualMethod(i - direct_method_count); MethodHelper mh(m); expandBufAddMethodId(pReply, ToMethodId(m)); expandBufAddUtf8String(pReply, mh.GetName()); @@ -1327,7 +1327,7 @@ void Dbg::OutputLineTable(JDWP::RefTypeId, JDWP::MethodId method_id, JDWP::Expan return true; } }; - mirror::AbstractMethod* m = FromMethodId(method_id); + mirror::ArtMethod* m = FromMethodId(method_id); MethodHelper mh(m); uint64_t start, end; if (m->IsNative()) { @@ -1381,14 +1381,14 @@ void Dbg::OutputVariableTable(JDWP::RefTypeId, JDWP::MethodId method_id, bool wi ++pContext->variable_count; } }; - mirror::AbstractMethod* m = FromMethodId(method_id); + mirror::ArtMethod* m = FromMethodId(method_id); MethodHelper mh(m); const DexFile::CodeItem* code_item = mh.GetCodeItem(); // arg_count considers doubles and longs to take 2 units. // variable_count considers everything to take 1 unit. std::string shorty(mh.GetShorty()); - expandBufAdd4BE(pReply, mirror::AbstractMethod::NumArgRegisters(shorty)); + expandBufAdd4BE(pReply, mirror::ArtMethod::NumArgRegisters(shorty)); // We don't know the total number of variables yet, so leave a blank and update it later. size_t variable_count_offset = expandBufGetLength(pReply); @@ -1408,7 +1408,7 @@ void Dbg::OutputVariableTable(JDWP::RefTypeId, JDWP::MethodId method_id, bool wi JDWP::JdwpError Dbg::GetBytecodes(JDWP::RefTypeId, JDWP::MethodId method_id, std::vector& bytecodes) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = FromMethodId(method_id); + mirror::ArtMethod* m = FromMethodId(method_id); if (m == NULL) { return JDWP::ERR_INVALID_METHODID; } @@ -1445,7 +1445,7 @@ static JDWP::JdwpError GetFieldValueImpl(JDWP::RefTypeId ref_type_id, JDWP::Obje if ((!is_static && o == NULL) || o == ObjectRegistry::kInvalidObject) { return JDWP::ERR_INVALID_OBJECT; } - mirror::Field* f = FromFieldId(field_id); + mirror::ArtField* f = FromFieldId(field_id); mirror::Class* receiver_class = c; if (receiver_class == NULL && o != NULL) { @@ -1511,7 +1511,7 @@ static JDWP::JdwpError SetFieldValueImpl(JDWP::ObjectId object_id, JDWP::FieldId if ((!is_static && o == NULL) || o == ObjectRegistry::kInvalidObject) { return JDWP::ERR_INVALID_OBJECT; } - mirror::Field* f = FromFieldId(field_id); + mirror::ArtField* f = FromFieldId(field_id); // The RI only enforces the static/non-static mismatch in one direction. // TODO: should we change the tests and check both? @@ -1580,7 +1580,7 @@ JDWP::JdwpError Dbg::GetThreadName(JDWP::ObjectId thread_id, std::string& name) // We still need to report the zombie threads' names, so we can't just call Thread::GetThreadName. mirror::Object* thread_object = gRegistry->Get(thread_id); - mirror::Field* java_lang_Thread_name_field = + mirror::ArtField* java_lang_Thread_name_field = soa.DecodeField(WellKnownClasses::java_lang_Thread_name); mirror::String* s = reinterpret_cast(java_lang_Thread_name_field->GetObject(thread_object)); @@ -1612,7 +1612,7 @@ JDWP::JdwpError Dbg::GetThreadGroup(JDWP::ObjectId thread_id, JDWP::ExpandBuf* p mirror::Class* c = Runtime::Current()->GetClassLinker()->FindSystemClass("Ljava/lang/Thread;"); CHECK(c != NULL); - mirror::Field* f = c->FindInstanceField("group", "Ljava/lang/ThreadGroup;"); + mirror::ArtField* f = c->FindInstanceField("group", "Ljava/lang/ThreadGroup;"); CHECK(f != NULL); mirror::Object* group = f->GetObject(thread_object); CHECK(group != NULL); @@ -1629,7 +1629,7 @@ std::string Dbg::GetThreadGroupName(JDWP::ObjectId thread_group_id) { mirror::Class* c = Runtime::Current()->GetClassLinker()->FindSystemClass("Ljava/lang/ThreadGroup;"); CHECK(c != NULL); - mirror::Field* f = c->FindInstanceField("name", "Ljava/lang/String;"); + mirror::ArtField* f = c->FindInstanceField("name", "Ljava/lang/String;"); CHECK(f != NULL); mirror::String* s = reinterpret_cast(f->GetObject(thread_group)); return s->ToModifiedUtf8(); @@ -1641,7 +1641,7 @@ JDWP::ObjectId Dbg::GetThreadGroupParent(JDWP::ObjectId thread_group_id) { mirror::Class* c = Runtime::Current()->GetClassLinker()->FindSystemClass("Ljava/lang/ThreadGroup;"); CHECK(c != NULL); - mirror::Field* f = c->FindInstanceField("parent", "Ljava/lang/ThreadGroup;"); + mirror::ArtField* f = c->FindInstanceField("parent", "Ljava/lang/ThreadGroup;"); CHECK(f != NULL); mirror::Object* parent = f->GetObject(thread_group); return gRegistry->Add(parent); @@ -1649,14 +1649,14 @@ JDWP::ObjectId Dbg::GetThreadGroupParent(JDWP::ObjectId thread_group_id) { JDWP::ObjectId Dbg::GetSystemThreadGroupId() { ScopedObjectAccessUnchecked soa(Thread::Current()); - mirror::Field* f = soa.DecodeField(WellKnownClasses::java_lang_ThreadGroup_systemThreadGroup); + mirror::ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_ThreadGroup_systemThreadGroup); mirror::Object* group = f->GetObject(f->GetDeclaringClass()); return gRegistry->Add(group); } JDWP::ObjectId Dbg::GetMainThreadGroupId() { ScopedObjectAccess soa(Thread::Current()); - mirror::Field* f = soa.DecodeField(WellKnownClasses::java_lang_ThreadGroup_mainThreadGroup); + mirror::ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_ThreadGroup_mainThreadGroup); mirror::Object* group = f->GetObject(f->GetDeclaringClass()); return gRegistry->Add(group); } @@ -1793,12 +1793,12 @@ void Dbg::GetChildThreadGroups(JDWP::ObjectId thread_group_id, std::vectorGet(thread_group_id); // Get the ArrayList "groups" out of this thread group... - mirror::Field* groups_field = thread_group->GetClass()->FindInstanceField("groups", "Ljava/util/List;"); + mirror::ArtField* groups_field = thread_group->GetClass()->FindInstanceField("groups", "Ljava/util/List;"); mirror::Object* groups_array_list = groups_field->GetObject(thread_group); // Get the array and size out of the ArrayList... - mirror::Field* array_field = groups_array_list->GetClass()->FindInstanceField("array", "[Ljava/lang/Object;"); - mirror::Field* size_field = groups_array_list->GetClass()->FindInstanceField("size", "I"); + mirror::ArtField* array_field = groups_array_list->GetClass()->FindInstanceField("array", "[Ljava/lang/Object;"); + mirror::ArtField* size_field = groups_array_list->GetClass()->FindInstanceField("size", "I"); mirror::ObjectArray* groups_array = array_field->GetObject(groups_array_list)->AsObjectArray(); const int32_t size = size_field->GetInt(groups_array_list); @@ -2017,7 +2017,7 @@ void Dbg::GetLocalValue(JDWP::ObjectId thread_id, JDWP::FrameId frame_id, int sl return true; // Not our frame, carry on. } // TODO: check that the tag is compatible with the actual type of the slot! - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); uint16_t reg = DemangleSlot(slot_, m); switch (tag_) { @@ -2156,7 +2156,7 @@ void Dbg::SetLocalValue(JDWP::ObjectId thread_id, JDWP::FrameId frame_id, int sl return true; // Not our frame, carry on. } // TODO: check that the tag is compatible with the actual type of the slot! - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); uint16_t reg = DemangleSlot(slot_, m); switch (tag_) { @@ -2226,7 +2226,7 @@ void Dbg::SetLocalValue(JDWP::ObjectId thread_id, JDWP::FrameId frame_id, int sl visitor.WalkStack(); } -void Dbg::PostLocationEvent(const mirror::AbstractMethod* m, int dex_pc, +void Dbg::PostLocationEvent(const mirror::ArtMethod* m, int dex_pc, mirror::Object* this_object, int event_flags) { mirror::Class* c = m->GetDeclaringClass(); @@ -2246,7 +2246,7 @@ void Dbg::PostLocationEvent(const mirror::AbstractMethod* m, int dex_pc, } void Dbg::PostException(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception_object) { if (!IsDebuggerActive()) { return; @@ -2280,7 +2280,7 @@ void Dbg::PostClassPrepare(mirror::Class* c) { } void Dbg::UpdateDebugger(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* m, uint32_t dex_pc) { + const mirror::ArtMethod* m, uint32_t dex_pc) { if (!IsDebuggerActive() || dex_pc == static_cast(-2) /* fake method exit */) { return; } @@ -2361,14 +2361,14 @@ void Dbg::UpdateDebugger(Thread* thread, mirror::Object* this_object, void Dbg::WatchLocation(const JDWP::JdwpLocation* location) { MutexLock mu(Thread::Current(), *Locks::breakpoint_lock_); - mirror::AbstractMethod* m = FromMethodId(location->method_id); + mirror::ArtMethod* m = FromMethodId(location->method_id); gBreakpoints.push_back(Breakpoint(m, location->dex_pc)); VLOG(jdwp) << "Set breakpoint #" << (gBreakpoints.size() - 1) << ": " << gBreakpoints[gBreakpoints.size() - 1]; } void Dbg::UnwatchLocation(const JDWP::JdwpLocation* location) { MutexLock mu(Thread::Current(), *Locks::breakpoint_lock_); - mirror::AbstractMethod* m = FromMethodId(location->method_id); + mirror::ArtMethod* m = FromMethodId(location->method_id); for (size_t i = 0; i < gBreakpoints.size(); ++i) { if (gBreakpoints[i].method == m && gBreakpoints[i].dex_pc == location->dex_pc) { VLOG(jdwp) << "Removed breakpoint #" << i << ": " << gBreakpoints[i]; @@ -2468,7 +2468,7 @@ JDWP::JdwpError Dbg::ConfigureStep(JDWP::ObjectId thread_id, JDWP::JdwpStepSize // annotalysis. bool VisitFrame() NO_THREAD_SAFETY_ANALYSIS { Locks::breakpoint_lock_->AssertHeld(Thread::Current()); - const mirror::AbstractMethod* m = GetMethod(); + const mirror::ArtMethod* m = GetMethod(); if (!m->IsRuntimeMethod()) { ++gSingleStepControl.stack_depth; if (gSingleStepControl.method == NULL) { @@ -2538,7 +2538,7 @@ JDWP::JdwpError Dbg::ConfigureStep(JDWP::ObjectId thread_id, JDWP::JdwpStepSize uint32_t last_pc; }; gSingleStepControl.dex_pcs.clear(); - const mirror::AbstractMethod* m = gSingleStepControl.method; + const mirror::ArtMethod* m = gSingleStepControl.method; if (m->IsNative()) { gSingleStepControl.line_number = -1; } else { @@ -2675,7 +2675,7 @@ JDWP::JdwpError Dbg::InvokeMethod(JDWP::ObjectId thread_id, JDWP::ObjectId objec return status; } - mirror::AbstractMethod* m = FromMethodId(method_id); + mirror::ArtMethod* m = FromMethodId(method_id); if (m->IsStatic() != (receiver == NULL)) { return JDWP::ERR_INVALID_METHODID; } @@ -2798,7 +2798,7 @@ void Dbg::ExecuteMethod(DebugInvokeReq* pReq) { // We can be called while an exception is pending. We need // to preserve that across the method invocation. SirtRef old_throw_this_object(soa.Self(), NULL); - SirtRef old_throw_method(soa.Self(), NULL); + SirtRef old_throw_method(soa.Self(), NULL); SirtRef old_exception(soa.Self(), NULL); uint32_t old_throw_dex_pc; { @@ -2812,9 +2812,9 @@ void Dbg::ExecuteMethod(DebugInvokeReq* pReq) { } // Translate the method through the vtable, unless the debugger wants to suppress it. - mirror::AbstractMethod* m = pReq->method_; + mirror::ArtMethod* m = pReq->method_; if ((pReq->options_ & JDWP::INVOKE_NONVIRTUAL) == 0 && pReq->receiver_ != NULL) { - mirror::AbstractMethod* actual_method = pReq->class_->FindVirtualMethodForVirtualOrInterface(pReq->method_); + mirror::ArtMethod* actual_method = pReq->class_->FindVirtualMethodForVirtualOrInterface(pReq->method_); if (actual_method != m) { VLOG(jdwp) << "ExecuteMethod translated " << PrettyMethod(m) << " to " << PrettyMethod(actual_method); m = actual_method; @@ -3491,7 +3491,7 @@ struct AllocRecordStackVisitor : public StackVisitor { if (depth >= kMaxAllocRecordStackDepth) { return false; } - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (!m->IsRuntimeMethod()) { record->stack[depth].method = m; record->stack[depth].dex_pc = GetDexPc(); @@ -3574,7 +3574,7 @@ void Dbg::DumpRecentAllocations() { << PrettyClass(record->type); for (size_t stack_frame = 0; stack_frame < kMaxAllocRecordStackDepth; ++stack_frame) { - const mirror::AbstractMethod* m = record->stack[stack_frame].method; + const mirror::ArtMethod* m = record->stack[stack_frame].method; if (m == NULL) { break; } @@ -3695,7 +3695,7 @@ jbyteArray Dbg::GetRecentAllocations() { MethodHelper mh; for (size_t i = 0; i < kMaxAllocRecordStackDepth; i++) { - mirror::AbstractMethod* m = record->stack[i].method; + mirror::ArtMethod* m = record->stack[i].method; if (m != NULL) { mh.ChangeMethod(m); class_names.Add(mh.GetDeclaringClassDescriptor()); diff --git a/runtime/debugger.h b/runtime/debugger.h index 6b7e2ba6e8..2282305ac2 100644 --- a/runtime/debugger.h +++ b/runtime/debugger.h @@ -32,7 +32,7 @@ namespace art { namespace mirror { -class AbstractMethod; +class ArtMethod; class Class; class Object; class Throwable; @@ -64,7 +64,7 @@ struct DebugInvokeReq { mirror::Object* receiver_; /* not used for ClassType.InvokeMethod */ mirror::Object* thread_; mirror::Class* class_; - mirror::AbstractMethod* method_; + mirror::ArtMethod* method_; uint32_t arg_count_; uint64_t* arg_values_; /* will be NULL if arg_count_ == 0 */ uint32_t options_; @@ -324,11 +324,11 @@ class Dbg { kMethodEntry = 0x04, kMethodExit = 0x08, }; - static void PostLocationEvent(const mirror::AbstractMethod* method, int pcOffset, + static void PostLocationEvent(const mirror::ArtMethod* method, int pcOffset, mirror::Object* thisPtr, int eventFlags) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void PostException(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void PostThreadStart(Thread* t) @@ -339,7 +339,7 @@ class Dbg { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void UpdateDebugger(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t new_dex_pc) + const mirror::ArtMethod* method, uint32_t new_dex_pc) LOCKS_EXCLUDED(Locks::breakpoint_lock_) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index aaff0fc6da..45b34270f9 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -31,9 +31,8 @@ #include "dex_file_verifier.h" #include "globals.h" #include "leb128.h" -#include "mirror/abstract_method-inl.h" -#include "mirror/field.h" -#include "mirror/field-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/string.h" #include "os.h" #include "safe_map.h" @@ -624,7 +623,7 @@ std::string DexFile::CreateMethodSignature(uint32_t proto_idx, int32_t* unicode_ return descriptor; } -int32_t DexFile::GetLineNumFromPC(const mirror::AbstractMethod* method, uint32_t rel_pc) const { +int32_t DexFile::GetLineNumFromPC(const mirror::ArtMethod* method, uint32_t rel_pc) const { // For native method, lineno should be -2 to indicate it is native. Note that // "line number == -2" is how libcore tells from StackTraceElement. if (method->GetCodeItemOffset() == 0) { @@ -1024,7 +1023,7 @@ void EncodedStaticFieldValueIterator::Next() { ptr_ += width; } -void EncodedStaticFieldValueIterator::ReadValueToField(mirror::Field* field) const { +void EncodedStaticFieldValueIterator::ReadValueToField(mirror::ArtField* field) const { switch (type_) { case kBoolean: field->SetBoolean(field->GetDeclaringClass(), jval_.z); break; case kByte: field->SetByte(field->GetDeclaringClass(), jval_.b); break; diff --git a/runtime/dex_file.h b/runtime/dex_file.h index a60a1398d8..006b692c85 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -34,10 +34,10 @@ namespace art { namespace mirror { -class AbstractMethod; -class ClassLoader; -class DexCache; -class Field; + class ArtField; + class ArtMethod; + class ClassLoader; + class DexCache; } // namespace mirror class ClassLinker; class ZipArchive; @@ -786,7 +786,7 @@ class DexFile { // Returns -2 for native methods (as expected in exception traces). // // This is used by runtime; therefore use art::Method not art::DexFile::Method. - int32_t GetLineNumFromPC(const mirror::AbstractMethod* method, uint32_t rel_pc) const + int32_t GetLineNumFromPC(const mirror::ArtMethod* method, uint32_t rel_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void DecodeDebugInfo(const CodeItem* code_item, bool is_static, uint32_t method_idx, @@ -1135,7 +1135,7 @@ class EncodedStaticFieldValueIterator { ClassLinker* linker, const DexFile::ClassDef& class_def) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void ReadValueToField(mirror::Field* field) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void ReadValueToField(mirror::ArtField* field) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool HasNext() { return pos_ < array_size_; } diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc index c29784151c..6b8c41ed41 100644 --- a/runtime/entrypoints/entrypoint_utils.cc +++ b/runtime/entrypoints/entrypoint_utils.cc @@ -19,9 +19,9 @@ #include "class_linker-inl.h" #include "dex_file-inl.h" #include "gc/accounting/card_table-inl.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/proxy.h" @@ -33,7 +33,7 @@ namespace art { // Helper function to allocate array for FILLED_NEW_ARRAY. -mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::AbstractMethod* referrer, +mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* referrer, int32_t component_count, Thread* self, bool access_check) { if (UNLIKELY(component_count < 0)) { @@ -73,7 +73,7 @@ mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::AbstractMet } } -mirror::Field* FindFieldFromCode(uint32_t field_idx, const mirror::AbstractMethod* referrer, +mirror::ArtField* FindFieldFromCode(uint32_t field_idx, const mirror::ArtMethod* referrer, Thread* self, FindFieldType type, size_t expected_size, bool access_check) { bool is_primitive; @@ -91,7 +91,7 @@ mirror::Field* FindFieldFromCode(uint32_t field_idx, const mirror::AbstractMetho default: is_primitive = true; is_set = true; is_static = true; break; } ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); - mirror::Field* resolved_field = class_linker->ResolveField(field_idx, referrer, is_static); + mirror::ArtField* resolved_field = class_linker->ResolveField(field_idx, referrer, is_static); if (UNLIKELY(resolved_field == NULL)) { DCHECK(self->IsExceptionPending()); // Throw exception and unwind. return NULL; // Failure. @@ -158,12 +158,12 @@ mirror::Field* FindFieldFromCode(uint32_t field_idx, const mirror::AbstractMetho } // Slow path method resolution -mirror::AbstractMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, +mirror::ArtMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* this_object, + mirror::ArtMethod* referrer, Thread* self, bool access_check, InvokeType type) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); bool is_direct = type == kStatic || type == kDirect; - mirror::AbstractMethod* resolved_method = class_linker->ResolveMethod(method_idx, referrer, type); + mirror::ArtMethod* resolved_method = class_linker->ResolveMethod(method_idx, referrer, type); if (UNLIKELY(resolved_method == NULL)) { DCHECK(self->IsExceptionPending()); // Throw exception and unwind. return NULL; // Failure. @@ -179,7 +179,7 @@ mirror::AbstractMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* if (is_direct) { return resolved_method; } else if (type == kInterface) { - mirror::AbstractMethod* interface_method = + mirror::ArtMethod* interface_method = this_object->GetClass()->FindVirtualMethodForInterface(resolved_method); if (UNLIKELY(interface_method == NULL)) { ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(resolved_method, this_object, @@ -189,7 +189,7 @@ mirror::AbstractMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* return interface_method; } } else { - mirror::ObjectArray* vtable; + mirror::ObjectArray* vtable; uint16_t vtable_index = resolved_method->GetMethodIndex(); if (type == kSuper) { vtable = referrer->GetDeclaringClass()->GetSuperClass()->GetVTable(); @@ -231,7 +231,7 @@ mirror::AbstractMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* if (is_direct) { return resolved_method; } else if (type == kInterface) { - mirror::AbstractMethod* interface_method = + mirror::ArtMethod* interface_method = this_object->GetClass()->FindVirtualMethodForInterface(resolved_method); if (UNLIKELY(interface_method == NULL)) { ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(resolved_method, this_object, @@ -241,7 +241,7 @@ mirror::AbstractMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* return interface_method; } } else { - mirror::ObjectArray* vtable; + mirror::ObjectArray* vtable; uint16_t vtable_index = resolved_method->GetMethodIndex(); if (type == kSuper) { mirror::Class* super_class = referring_class->GetSuperClass(); @@ -326,17 +326,15 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessUnchecked& soa, const char } } - // Call InvocationHandler.invoke(Object proxy, Method method, Object[] args). - jobject inv_hand = soa.Env()->GetObjectField(rcvr_jobj, - WellKnownClasses::java_lang_reflect_Proxy_h); + // Call Proxy.invoke(Proxy proxy, ArtMethod method, Object[] args). jvalue invocation_args[3]; invocation_args[0].l = rcvr_jobj; invocation_args[1].l = interface_method_jobj; invocation_args[2].l = args_jobj; jobject result = - soa.Env()->CallObjectMethodA(inv_hand, - WellKnownClasses::java_lang_reflect_InvocationHandler_invoke, - invocation_args); + soa.Env()->CallStaticObjectMethodA(WellKnownClasses::java_lang_reflect_Proxy, + WellKnownClasses::java_lang_reflect_Proxy_invoke, + invocation_args); // Unbox result and handle error conditions. if (LIKELY(!soa.Self()->IsExceptionPending())) { @@ -346,10 +344,10 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessUnchecked& soa, const char } else { mirror::Object* result_ref = soa.Decode(result); mirror::Object* rcvr = soa.Decode(rcvr_jobj); - mirror::AbstractMethod* interface_method = - soa.Decode(interface_method_jobj); + mirror::ArtMethod* interface_method = + soa.Decode(interface_method_jobj); mirror::Class* result_type = MethodHelper(interface_method).GetReturnType(); - mirror::AbstractMethod* proxy_method; + mirror::ArtMethod* proxy_method; if (interface_method->GetDeclaringClass()->IsInterface()) { proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(interface_method); } else { @@ -373,9 +371,9 @@ JValue InvokeProxyInvocationHandler(ScopedObjectAccessUnchecked& soa, const char mirror::Object* rcvr = soa.Decode(rcvr_jobj); mirror::SynthesizedProxyClass* proxy_class = down_cast(rcvr->GetClass()); - mirror::AbstractMethod* interface_method = - soa.Decode(interface_method_jobj); - mirror::AbstractMethod* proxy_method = + mirror::ArtMethod* interface_method = + soa.Decode(interface_method_jobj); + mirror::ArtMethod* proxy_method = rcvr->GetClass()->FindVirtualMethodForInterface(interface_method); int throws_index = -1; size_t num_virt_methods = proxy_class->NumVirtualMethods(); diff --git a/runtime/entrypoints/entrypoint_utils.h b/runtime/entrypoints/entrypoint_utils.h index b6781c02b9..2b73af437e 100644 --- a/runtime/entrypoints/entrypoint_utils.h +++ b/runtime/entrypoints/entrypoint_utils.h @@ -23,7 +23,7 @@ #include "indirect_reference_table.h" #include "invoke_type.h" #include "jni_internal.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/array.h" #include "mirror/class-inl.h" #include "mirror/throwable.h" @@ -34,7 +34,7 @@ namespace art { namespace mirror { class Class; - class Field; + class ArtField; class Object; } // namespace mirror @@ -42,7 +42,7 @@ namespace mirror { // cannot be resolved, throw an error. If it can, use it to create an instance. // When verification/compiler hasn't been able to verify access, optionally perform an access // check. -static inline mirror::Object* AllocObjectFromCode(uint32_t type_idx, mirror::AbstractMethod* method, +static inline mirror::Object* AllocObjectFromCode(uint32_t type_idx, mirror::ArtMethod* method, Thread* self, bool access_check) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -80,7 +80,7 @@ static inline mirror::Object* AllocObjectFromCode(uint32_t type_idx, mirror::Abs // it cannot be resolved, throw an error. If it can, use it to create an array. // When verification/compiler hasn't been able to verify access, optionally perform an access // check. -static inline mirror::Array* AllocArrayFromCode(uint32_t type_idx, mirror::AbstractMethod* method, +static inline mirror::Array* AllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, bool access_check) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -107,7 +107,7 @@ static inline mirror::Array* AllocArrayFromCode(uint32_t type_idx, mirror::Abstr return mirror::Array::Alloc(self, klass, component_count); } -extern mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::AbstractMethod* method, +extern mirror::Array* CheckAndAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, bool access_check) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -125,17 +125,17 @@ enum FindFieldType { }; // Slow field find that can initialize classes and may throw exceptions. -extern mirror::Field* FindFieldFromCode(uint32_t field_idx, const mirror::AbstractMethod* referrer, - Thread* self, FindFieldType type, size_t expected_size, - bool access_check) +extern mirror::ArtField* FindFieldFromCode(uint32_t field_idx, const mirror::ArtMethod* referrer, + Thread* self, FindFieldType type, size_t expected_size, + bool access_check) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Fast path field resolution that can't initialize classes or throw exceptions. -static inline mirror::Field* FindFieldFast(uint32_t field_idx, - const mirror::AbstractMethod* referrer, - FindFieldType type, size_t expected_size) +static inline mirror::ArtField* FindFieldFast(uint32_t field_idx, + const mirror::ArtMethod* referrer, + FindFieldType type, size_t expected_size) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* resolved_field = + mirror::ArtField* resolved_field = referrer->GetDeclaringClass()->GetDexCache()->GetResolvedField(field_idx); if (UNLIKELY(resolved_field == NULL)) { return NULL; @@ -186,16 +186,16 @@ static inline mirror::Field* FindFieldFast(uint32_t field_idx, } // Fast path method resolution that can't throw exceptions. -static inline mirror::AbstractMethod* FindMethodFast(uint32_t method_idx, - mirror::Object* this_object, - const mirror::AbstractMethod* referrer, - bool access_check, InvokeType type) +static inline mirror::ArtMethod* FindMethodFast(uint32_t method_idx, + mirror::Object* this_object, + const mirror::ArtMethod* referrer, + bool access_check, InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { bool is_direct = type == kStatic || type == kDirect; if (UNLIKELY(this_object == NULL && !is_direct)) { return NULL; } - mirror::AbstractMethod* resolved_method = + mirror::ArtMethod* resolved_method = referrer->GetDeclaringClass()->GetDexCache()->GetResolvedMethod(method_idx); if (UNLIKELY(resolved_method == NULL)) { return NULL; @@ -228,13 +228,13 @@ static inline mirror::AbstractMethod* FindMethodFast(uint32_t method_idx, } } -extern mirror::AbstractMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, - Thread* self, bool access_check, InvokeType type) +extern mirror::ArtMethod* FindMethodFromCode(uint32_t method_idx, mirror::Object* this_object, + mirror::ArtMethod* referrer, + Thread* self, bool access_check, InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static inline mirror::Class* ResolveVerifyAndClinit(uint32_t type_idx, - const mirror::AbstractMethod* referrer, + const mirror::ArtMethod* referrer, Thread* self, bool can_run_clinit, bool verify_access) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -271,7 +271,7 @@ static inline mirror::Class* ResolveVerifyAndClinit(uint32_t type_idx, extern void ThrowStackOverflowError(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -static inline mirror::String* ResolveStringFromCode(const mirror::AbstractMethod* referrer, +static inline mirror::String* ResolveStringFromCode(const mirror::ArtMethod* referrer, uint32_t string_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); @@ -307,7 +307,7 @@ static inline void CheckReferenceResult(mirror::Object* o, Thread* self) if (o == NULL) { return; } - mirror::AbstractMethod* m = self->GetCurrentMethod(NULL); + mirror::ArtMethod* m = self->GetCurrentMethod(NULL); if (o == kInvalidIndirectRefObject) { JniAbortF(NULL, "invalid reference returned from %s", PrettyMethod(m).c_str()); } @@ -334,7 +334,7 @@ static inline void CheckSuspend(Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mut } JValue InvokeProxyInvocationHandler(ScopedObjectAccessUnchecked& soa, const char* shorty, - jobject rcvr_jobj, jobject interface_method_jobj, + jobject rcvr_jobj, jobject interface_art_method_jobj, std::vector& args) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -356,12 +356,12 @@ static inline uintptr_t GetQuickInstrumentationExitPc() { return reinterpret_cast(art_quick_instrumentation_exit); } -extern "C" void art_portable_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*); static inline const void* GetPortableToInterpreterBridge() { return reinterpret_cast(art_portable_to_interpreter_bridge); } -extern "C" void art_quick_to_interpreter_bridge(mirror::AbstractMethod*); +extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*); static inline const void* GetQuickToInterpreterBridge() { return reinterpret_cast(art_quick_to_interpreter_bridge); } diff --git a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc index 67f6d98493..f319a0084b 100644 --- a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc +++ b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc @@ -17,7 +17,7 @@ #include "class_linker.h" #include "interpreter/interpreter.h" #include "invoke_arg_array_builder.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" #include "object_utils.h" #include "runtime.h" @@ -29,7 +29,7 @@ extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& m const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method = shadow_frame->GetMethod(); + mirror::ArtMethod* method = shadow_frame->GetMethod(); // Ensure static methods are initialized. if (method->IsStatic()) { Runtime::Current()->GetClassLinker()->EnsureInitialized(method->GetDeclaringClass(), true, true); diff --git a/runtime/entrypoints/jni/jni_entrypoints.cc b/runtime/entrypoints/jni/jni_entrypoints.cc index 88b4936255..83d3a584c5 100644 --- a/runtime/entrypoints/jni/jni_entrypoints.cc +++ b/runtime/entrypoints/jni/jni_entrypoints.cc @@ -16,7 +16,7 @@ #include "base/logging.h" #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" #include "object_utils.h" #include "scoped_thread_state_change.h" @@ -30,7 +30,7 @@ extern "C" void* artFindNativeMethod() { Locks::mutator_lock_->AssertNotHeld(self); // We come here as Native. ScopedObjectAccess soa(self); - mirror::AbstractMethod* method = self->GetCurrentMethod(NULL); + mirror::ArtMethod* method = self->GetCurrentMethod(NULL); DCHECK(method != NULL); // Lookup symbol address for method, on failure we'll return NULL with an exception set, @@ -69,7 +69,7 @@ extern "C" const void* artWorkAroundAppJniBugs(Thread* self, intptr_t* sp) // | unused | // | unused | // | unused | <- sp - mirror::AbstractMethod* jni_method = self->GetCurrentMethod(NULL); + mirror::ArtMethod* jni_method = self->GetCurrentMethod(NULL); DCHECK(jni_method->IsNative()) << PrettyMethod(jni_method); intptr_t* arg_ptr = sp + 4; // pointer to r1 on stack // Fix up this/jclass argument diff --git a/runtime/entrypoints/portable/portable_alloc_entrypoints.cc b/runtime/entrypoints/portable/portable_alloc_entrypoints.cc index 286926909c..91b7353bab 100644 --- a/runtime/entrypoints/portable/portable_alloc_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_alloc_entrypoints.cc @@ -15,27 +15,27 @@ */ #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" namespace art { extern "C" mirror::Object* art_portable_alloc_object_from_code(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return AllocObjectFromCode(type_idx, referrer, thread, false); } extern "C" mirror::Object* art_portable_alloc_object_from_code_with_access_check(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return AllocObjectFromCode(type_idx, referrer, thread, true); } extern "C" mirror::Object* art_portable_alloc_array_from_code(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, uint32_t length, Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -43,7 +43,7 @@ extern "C" mirror::Object* art_portable_alloc_array_from_code(uint32_t type_idx, } extern "C" mirror::Object* art_portable_alloc_array_from_code_with_access_check(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, uint32_t length, Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -51,7 +51,7 @@ extern "C" mirror::Object* art_portable_alloc_array_from_code_with_access_check( } extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, uint32_t length, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -59,7 +59,7 @@ extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code(uint32_t } extern "C" mirror::Object* art_portable_check_and_alloc_array_from_code_with_access_check(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, uint32_t length, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { diff --git a/runtime/entrypoints/portable/portable_dexcache_entrypoints.cc b/runtime/entrypoints/portable/portable_dexcache_entrypoints.cc index bdab587797..b37ebcf785 100644 --- a/runtime/entrypoints/portable/portable_dexcache_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_dexcache_entrypoints.cc @@ -16,27 +16,27 @@ #include "entrypoints/entrypoint_utils.h" #include "gc/accounting/card_table-inl.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" namespace art { extern "C" mirror::Object* art_portable_initialize_static_storage_from_code(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return ResolveVerifyAndClinit(type_idx, referrer, thread, true, false); } extern "C" mirror::Object* art_portable_initialize_type_from_code(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return ResolveVerifyAndClinit(type_idx, referrer, thread, false, false); } extern "C" mirror::Object* art_portable_initialize_type_and_verify_access_from_code(uint32_t type_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Called when caller isn't guaranteed to have access to a type and the dex cache may be @@ -44,7 +44,7 @@ extern "C" mirror::Object* art_portable_initialize_type_and_verify_access_from_c return ResolveVerifyAndClinit(type_idx, referrer, thread, false, true); } -extern "C" mirror::Object* art_portable_resolve_string_from_code(mirror::AbstractMethod* referrer, +extern "C" mirror::Object* art_portable_resolve_string_from_code(mirror::ArtMethod* referrer, uint32_t string_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return ResolveStringFromCode(referrer, string_idx); diff --git a/runtime/entrypoints/portable/portable_entrypoints.h b/runtime/entrypoints/portable/portable_entrypoints.h index ec9e4f8a7d..d4564471ac 100644 --- a/runtime/entrypoints/portable/portable_entrypoints.h +++ b/runtime/entrypoints/portable/portable_entrypoints.h @@ -22,7 +22,7 @@ namespace art { namespace mirror { - class AbstractMethod; + class ArtMethod; class Object; } // namespace mirror class Thread; @@ -35,8 +35,8 @@ class Thread; // compiler ABI. struct PACKED(4) PortableEntryPoints { // Invocation - void (*pPortableResolutionTrampoline)(mirror::AbstractMethod*); - void (*pPortableToInterpreterBridge)(mirror::AbstractMethod*); + void (*pPortableResolutionTrampoline)(mirror::ArtMethod*); + void (*pPortableToInterpreterBridge)(mirror::ArtMethod*); }; } // namespace art diff --git a/runtime/entrypoints/portable/portable_field_entrypoints.cc b/runtime/entrypoints/portable/portable_field_entrypoints.cc index aa0f03ce8b..bd6f79584b 100644 --- a/runtime/entrypoints/portable/portable_field_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_field_entrypoints.cc @@ -15,17 +15,17 @@ */ #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" -#include "mirror/field-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" namespace art { extern "C" int32_t art_portable_set32_static_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, int32_t new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(uint32_t)); @@ -47,10 +47,10 @@ extern "C" int32_t art_portable_set32_static_from_code(uint32_t field_idx, } extern "C" int32_t art_portable_set64_static_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, int64_t new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(uint64_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(uint64_t)); if (LIKELY(field != NULL)) { field->Set64(field->GetDeclaringClass(), new_value); return 0; @@ -69,11 +69,11 @@ extern "C" int32_t art_portable_set64_static_from_code(uint32_t field_idx, } extern "C" int32_t art_portable_set_obj_static_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, mirror::Object* new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticObjectWrite, - sizeof(mirror::Object*)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticObjectWrite, + sizeof(mirror::Object*)); if (LIKELY(field != NULL)) { field->SetObj(field->GetDeclaringClass(), new_value); return 0; @@ -88,9 +88,9 @@ extern "C" int32_t art_portable_set_obj_static_from_code(uint32_t field_idx, } extern "C" int32_t art_portable_get32_static_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer) + mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint32_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint32_t)); if (LIKELY(field != NULL)) { return field->Get32(field->GetDeclaringClass()); } @@ -103,9 +103,9 @@ extern "C" int32_t art_portable_get32_static_from_code(uint32_t field_idx, } extern "C" int64_t art_portable_get64_static_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer) + mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint64_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(uint64_t)); if (LIKELY(field != NULL)) { return field->Get64(field->GetDeclaringClass()); } @@ -118,10 +118,10 @@ extern "C" int64_t art_portable_get64_static_from_code(uint32_t field_idx, } extern "C" mirror::Object* art_portable_get_obj_static_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer) + mirror::ArtMethod* referrer) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticObjectRead, - sizeof(mirror::Object*)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticObjectRead, + sizeof(mirror::Object*)); if (LIKELY(field != NULL)) { return field->GetObj(field->GetDeclaringClass()); } @@ -134,10 +134,10 @@ extern "C" mirror::Object* art_portable_get_obj_static_from_code(uint32_t field_ } extern "C" int32_t art_portable_set32_instance_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, mirror::Object* obj, uint32_t new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint32_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint32_t)); if (LIKELY(field != NULL)) { field->Set32(obj, new_value); return 0; @@ -152,10 +152,10 @@ extern "C" int32_t art_portable_set32_instance_from_code(uint32_t field_idx, } extern "C" int32_t art_portable_set64_instance_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, mirror::Object* obj, int64_t new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint64_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(uint64_t)); if (LIKELY(field != NULL)) { field->Set64(obj, new_value); return 0; @@ -170,12 +170,12 @@ extern "C" int32_t art_portable_set64_instance_from_code(uint32_t field_idx, } extern "C" int32_t art_portable_set_obj_instance_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, mirror::Object* obj, mirror::Object* new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstanceObjectWrite, - sizeof(mirror::Object*)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstanceObjectWrite, + sizeof(mirror::Object*)); if (LIKELY(field != NULL)) { field->SetObj(obj, new_value); return 0; @@ -190,10 +190,10 @@ extern "C" int32_t art_portable_set_obj_instance_from_code(uint32_t field_idx, } extern "C" int32_t art_portable_get32_instance_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint32_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint32_t)); if (LIKELY(field != NULL)) { return field->Get32(obj); } @@ -206,10 +206,10 @@ extern "C" int32_t art_portable_get32_instance_from_code(uint32_t field_idx, } extern "C" int64_t art_portable_get64_instance_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint64_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(uint64_t)); if (LIKELY(field != NULL)) { return field->Get64(obj); } @@ -222,11 +222,11 @@ extern "C" int64_t art_portable_get64_instance_from_code(uint32_t field_idx, } extern "C" mirror::Object* art_portable_get_obj_instance_from_code(uint32_t field_idx, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, mirror::Object* obj) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstanceObjectRead, - sizeof(mirror::Object*)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstanceObjectRead, + sizeof(mirror::Object*)); if (LIKELY(field != NULL)) { return field->GetObj(obj); } diff --git a/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc b/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc index 771608b604..8cf4eed88f 100644 --- a/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_fillarray_entrypoints.cc @@ -16,12 +16,12 @@ #include "dex_instruction.h" #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" namespace art { -extern "C" void art_portable_fill_array_data_from_code(mirror::AbstractMethod* method, +extern "C" void art_portable_fill_array_data_from_code(mirror::ArtMethod* method, uint32_t dex_pc, mirror::Array* array, uint32_t payload_offset) diff --git a/runtime/entrypoints/portable/portable_invoke_entrypoints.cc b/runtime/entrypoints/portable/portable_invoke_entrypoints.cc index 5911ba3d8b..14cbd84186 100644 --- a/runtime/entrypoints/portable/portable_invoke_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_invoke_entrypoints.cc @@ -15,20 +15,20 @@ */ #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/dex_cache-inl.h" #include "mirror/object-inl.h" namespace art { -static mirror::AbstractMethod* FindMethodHelper(uint32_t method_idx, +static mirror::ArtMethod* FindMethodHelper(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, + mirror::ArtMethod* caller_method, bool access_check, InvokeType type, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method = FindMethodFast(method_idx, + mirror::ArtMethod* method = FindMethodFast(method_idx, this_object, caller_method, access_check, @@ -55,7 +55,7 @@ static mirror::AbstractMethod* FindMethodHelper(uint32_t method_idx, extern "C" mirror::Object* art_portable_find_static_method_from_code_with_access_check(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return FindMethodHelper(method_idx, this_object, referrer, true, kStatic, thread); @@ -63,7 +63,7 @@ extern "C" mirror::Object* art_portable_find_static_method_from_code_with_access extern "C" mirror::Object* art_portable_find_direct_method_from_code_with_access_check(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return FindMethodHelper(method_idx, this_object, referrer, true, kDirect, thread); @@ -71,7 +71,7 @@ extern "C" mirror::Object* art_portable_find_direct_method_from_code_with_access extern "C" mirror::Object* art_portable_find_virtual_method_from_code_with_access_check(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return FindMethodHelper(method_idx, this_object, referrer, true, kVirtual, thread); @@ -79,7 +79,7 @@ extern "C" mirror::Object* art_portable_find_virtual_method_from_code_with_acces extern "C" mirror::Object* art_portable_find_super_method_from_code_with_access_check(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return FindMethodHelper(method_idx, this_object, referrer, true, kSuper, thread); @@ -87,7 +87,7 @@ extern "C" mirror::Object* art_portable_find_super_method_from_code_with_access_ extern "C" mirror::Object* art_portable_find_interface_method_from_code_with_access_check(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return FindMethodHelper(method_idx, this_object, referrer, true, kInterface, thread); @@ -95,7 +95,7 @@ extern "C" mirror::Object* art_portable_find_interface_method_from_code_with_acc extern "C" mirror::Object* art_portable_find_interface_method_from_code(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* referrer, + mirror::ArtMethod* referrer, Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return FindMethodHelper(method_idx, this_object, referrer, false, kInterface, thread); diff --git a/runtime/entrypoints/portable/portable_jni_entrypoints.cc b/runtime/entrypoints/portable/portable_jni_entrypoints.cc index 8df16ae931..de1e32ef17 100644 --- a/runtime/entrypoints/portable/portable_jni_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_jni_entrypoints.cc @@ -15,7 +15,7 @@ */ #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" #include "thread-inl.h" diff --git a/runtime/entrypoints/portable/portable_thread_entrypoints.cc b/runtime/entrypoints/portable/portable_thread_entrypoints.cc index dac73885a5..8a2c8998aa 100644 --- a/runtime/entrypoints/portable/portable_thread_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_thread_entrypoints.cc @@ -15,7 +15,7 @@ */ #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/object-inl.h" #include "verifier/dex_gc_map.h" #include "stack.h" @@ -31,7 +31,7 @@ class ShadowFrameCopyVisitor : public StackVisitor { if (IsShadowFrame()) { ShadowFrame* cur_frame = GetCurrentShadowFrame(); size_t num_regs = cur_frame->NumberOfVRegs(); - mirror::AbstractMethod* method = cur_frame->GetMethod(); + mirror::ArtMethod* method = cur_frame->GetMethod(); uint32_t dex_pc = cur_frame->GetDexPC(); ShadowFrame* new_frame = ShadowFrame::Create(num_regs, NULL, method, dex_pc); @@ -88,7 +88,7 @@ extern "C" void art_portable_test_suspend_from_code(Thread* self) extern "C" ShadowFrame* art_portable_push_shadow_frame_from_code(Thread* thread, ShadowFrame* new_shadow_frame, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, uint32_t num_vregs) { ShadowFrame* old_frame = thread->PushShadowFrame(new_shadow_frame); new_shadow_frame->SetMethod(method); diff --git a/runtime/entrypoints/portable/portable_throw_entrypoints.cc b/runtime/entrypoints/portable/portable_throw_entrypoints.cc index 64a67ebb4c..2a0df9b896 100644 --- a/runtime/entrypoints/portable/portable_throw_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_throw_entrypoints.cc @@ -16,7 +16,7 @@ #include "dex_instruction.h" #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" namespace art { @@ -68,7 +68,7 @@ extern "C" void* art_portable_get_and_clear_exception(Thread* self) return exception; } -extern "C" int32_t art_portable_find_catch_block_from_code(mirror::AbstractMethod* current_method, +extern "C" int32_t art_portable_find_catch_block_from_code(mirror::ArtMethod* current_method, uint32_t ti_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { Thread* self = Thread::Current(); // TODO: make an argument. diff --git a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc index c02ace88c1..e1ce11a825 100644 --- a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc +++ b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc @@ -20,7 +20,7 @@ #include "dex_instruction-inl.h" #include "entrypoints/entrypoint_utils.h" #include "interpreter/interpreter.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" #include "object_utils.h" #include "scoped_thread_state_change.h" @@ -52,7 +52,7 @@ class PortableArgumentVisitor { #define PORTABLE_STACK_ARG_SKIP 0 #endif - PortableArgumentVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp) + PortableArgumentVisitor(MethodHelper& caller_mh, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : caller_mh_(caller_mh), args_in_regs_(ComputeArgsInRegs(caller_mh)), @@ -140,7 +140,7 @@ class PortableArgumentVisitor { // Visits arguments on the stack placing them into the shadow frame. class BuildPortableShadowFrameVisitor : public PortableArgumentVisitor { public: - BuildPortableShadowFrameVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp, + BuildPortableShadowFrameVisitor(MethodHelper& caller_mh, mirror::ArtMethod** sp, ShadowFrame& sf, size_t first_arg_reg) : PortableArgumentVisitor(caller_mh, sp), sf_(sf), cur_reg_(first_arg_reg) { } virtual void Visit() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -176,8 +176,8 @@ class BuildPortableShadowFrameVisitor : public PortableArgumentVisitor { DISALLOW_COPY_AND_ASSIGN(BuildPortableShadowFrameVisitor); }; -extern "C" uint64_t artPortableToInterpreterBridge(mirror::AbstractMethod* method, Thread* self, - mirror::AbstractMethod** sp) +extern "C" uint64_t artPortableToInterpreterBridge(mirror::ArtMethod* method, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Ensure we don't get thread suspension until the object arguments are safely in the shadow // frame. @@ -225,7 +225,7 @@ extern "C" uint64_t artPortableToInterpreterBridge(mirror::AbstractMethod* metho // to jobjects. class BuildPortableArgumentVisitor : public PortableArgumentVisitor { public: - BuildPortableArgumentVisitor(MethodHelper& caller_mh, mirror::AbstractMethod** sp, + BuildPortableArgumentVisitor(MethodHelper& caller_mh, mirror::ArtMethod** sp, ScopedObjectAccessUnchecked& soa, std::vector& args) : PortableArgumentVisitor(caller_mh, sp), soa_(soa), args_(args) {} @@ -269,9 +269,9 @@ class BuildPortableArgumentVisitor : public PortableArgumentVisitor { // which is responsible for recording callee save registers. We explicitly place into jobjects the // incoming reference arguments (so they survive GC). We invoke the invocation handler, which is a // field within the proxy object, which will box the primitive arguments and deal with error cases. -extern "C" uint64_t artPortableProxyInvokeHandler(mirror::AbstractMethod* proxy_method, +extern "C" uint64_t artPortableProxyInvokeHandler(mirror::ArtMethod* proxy_method, mirror::Object* receiver, - Thread* self, mirror::AbstractMethod** sp) + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Ensure we don't get thread suspension until the object arguments are safely in jobjects. const char* old_cause = @@ -292,7 +292,7 @@ extern "C" uint64_t artPortableProxyInvokeHandler(mirror::AbstractMethod* proxy_ args.erase(args.begin()); // Convert proxy method into expected interface method. - mirror::AbstractMethod* interface_method = proxy_method->FindOverriddenMethod(); + mirror::ArtMethod* interface_method = proxy_method->FindOverriddenMethod(); DCHECK(interface_method != NULL); DCHECK(!interface_method->IsProxyMethod()) << PrettyMethod(interface_method); jobject interface_method_jobj = soa.AddLocalReference(interface_method); @@ -306,13 +306,13 @@ extern "C" uint64_t artPortableProxyInvokeHandler(mirror::AbstractMethod* proxy_ } // Lazily resolve a method for portable. Called by stub code. -extern "C" const void* artPortableResolutionTrampoline(mirror::AbstractMethod* called, +extern "C" const void* artPortableResolutionTrampoline(mirror::ArtMethod* called, mirror::Object* receiver, Thread* thread, - mirror::AbstractMethod** called_addr) + mirror::ArtMethod** called_addr) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { uint32_t dex_pc; - mirror::AbstractMethod* caller = thread->GetCurrentMethod(&dex_pc); + mirror::ArtMethod* caller = thread->GetCurrentMethod(&dex_pc); ClassLinker* linker = Runtime::Current()->GetClassLinker(); InvokeType invoke_type; diff --git a/runtime/entrypoints/quick/callee_save_frame.h b/runtime/entrypoints/quick/callee_save_frame.h index 0cb578ddd0..8f7004920d 100644 --- a/runtime/entrypoints/quick/callee_save_frame.h +++ b/runtime/entrypoints/quick/callee_save_frame.h @@ -22,11 +22,11 @@ namespace art { namespace mirror { -class AbstractMethod; +class ArtMethod; } // namespace mirror // Place a special frame at the TOS that will save the callee saves for the given type. -static void FinishCalleeSaveFrameSetup(Thread* self, mirror::AbstractMethod** sp, +static void FinishCalleeSaveFrameSetup(Thread* self, mirror::ArtMethod** sp, Runtime::CalleeSaveType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Be aware the store below may well stomp on an incoming argument. diff --git a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc index 9ed802a2bb..420e63a1bb 100644 --- a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc @@ -16,61 +16,61 @@ #include "callee_save_frame.h" #include "entrypoints/entrypoint_utils.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" namespace art { -extern "C" mirror::Object* artAllocObjectFromCode(uint32_t type_idx, mirror::AbstractMethod* method, - Thread* self, mirror::AbstractMethod** sp) +extern "C" mirror::Object* artAllocObjectFromCode(uint32_t type_idx, mirror::ArtMethod* method, + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); return AllocObjectFromCode(type_idx, method, self, false); } extern "C" mirror::Object* artAllocObjectFromCodeWithAccessCheck(uint32_t type_idx, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); return AllocObjectFromCode(type_idx, method, self, true); } -extern "C" mirror::Array* artAllocArrayFromCode(uint32_t type_idx, mirror::AbstractMethod* method, +extern "C" mirror::Array* artAllocArrayFromCode(uint32_t type_idx, mirror::ArtMethod* method, int32_t component_count, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); return AllocArrayFromCode(type_idx, method, component_count, self, false); } extern "C" mirror::Array* artAllocArrayFromCodeWithAccessCheck(uint32_t type_idx, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, int32_t component_count, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); return AllocArrayFromCode(type_idx, method, component_count, self, true); } extern "C" mirror::Array* artCheckAndAllocArrayFromCode(uint32_t type_idx, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, int32_t component_count, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, false); } extern "C" mirror::Array* artCheckAndAllocArrayFromCodeWithAccessCheck(uint32_t type_idx, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, int32_t component_count, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); return CheckAndAllocArrayFromCode(type_idx, method, component_count, self, true); diff --git a/runtime/entrypoints/quick/quick_cast_entrypoints.cc b/runtime/entrypoints/quick/quick_cast_entrypoints.cc index b810bb70a6..9ffa736614 100644 --- a/runtime/entrypoints/quick/quick_cast_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_cast_entrypoints.cc @@ -33,7 +33,7 @@ extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, // Check whether it is safe to cast one class to the other, throw exception and return -1 on failure extern "C" int artCheckCastFromCode(mirror::Class* src_type, mirror::Class* dest_type, - Thread* self, mirror::AbstractMethod** sp) + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(src_type->IsClass()) << PrettyClass(src_type); DCHECK(dest_type->IsClass()) << PrettyClass(dest_type); @@ -50,7 +50,7 @@ extern "C" int artCheckCastFromCode(mirror::Class* src_type, mirror::Class* dest // Returns 0 on success and -1 if an exception is pending. extern "C" int artCanPutArrayElementFromCode(const mirror::Object* element, const mirror::Class* array_class, - Thread* self, mirror::AbstractMethod** sp) + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(array_class != NULL); // element can't be NULL as we catch this is screened in runtime_support diff --git a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc index 43fc9d2a2d..51c647adf1 100644 --- a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc @@ -17,7 +17,7 @@ #include "callee_save_frame.h" #include "dex_file-inl.h" #include "interpreter/interpreter.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" @@ -28,7 +28,7 @@ namespace art { -extern "C" void artDeoptimize(Thread* self, mirror::AbstractMethod** sp) +extern "C" void artDeoptimize(Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll); self->SetException(ThrowLocation(), reinterpret_cast(-1)); diff --git a/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc b/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc index 6400161b3e..003047a5f8 100644 --- a/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc @@ -19,16 +19,16 @@ #include "class_linker-inl.h" #include "dex_file-inl.h" #include "gc/accounting/card_table-inl.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" namespace art { extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx, - const mirror::AbstractMethod* referrer, + const mirror::ArtMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Called to ensure static storage base is initialized for direct static field reads and writes. // A class may be accessing another class' fields when it doesn't have access, as access has been @@ -38,8 +38,8 @@ extern "C" mirror::Class* artInitializeStaticStorageFromCode(uint32_t type_idx, } extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx, - const mirror::AbstractMethod* referrer, - Thread* self, mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Called when method->dex_cache_resolved_types_[] misses. FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); @@ -47,9 +47,9 @@ extern "C" mirror::Class* artInitializeTypeFromCode(uint32_t type_idx, } extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type_idx, - const mirror::AbstractMethod* referrer, + const mirror::ArtMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Called when caller isn't guaranteed to have access to a type and the dex cache may be // unpopulated. @@ -57,9 +57,9 @@ extern "C" mirror::Class* artInitializeTypeAndVerifyAccessFromCode(uint32_t type return ResolveVerifyAndClinit(type_idx, referrer, self, false, true); } -extern "C" mirror::String* artResolveStringFromCode(mirror::AbstractMethod* referrer, +extern "C" mirror::String* artResolveStringFromCode(mirror::ArtMethod* referrer, int32_t string_idx, - Thread* self, mirror::AbstractMethod** sp) + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); return ResolveStringFromCode(referrer, string_idx); diff --git a/runtime/entrypoints/quick/quick_entrypoints.h b/runtime/entrypoints/quick/quick_entrypoints.h index e76679b91f..9d3b8ef27c 100644 --- a/runtime/entrypoints/quick/quick_entrypoints.h +++ b/runtime/entrypoints/quick/quick_entrypoints.h @@ -29,9 +29,9 @@ namespace art { namespace mirror { - class AbstractMethod; - class Class; - class Object; +class ArtMethod; +class Class; +class Object; } // namespace mirror class Thread; @@ -116,8 +116,8 @@ struct PACKED(4) QuickEntryPoints { void* (*pMemcpy)(void*, const void*, size_t); // Invocation - void (*pQuickResolutionTrampoline)(mirror::AbstractMethod*); - void (*pQuickToInterpreterBridge)(mirror::AbstractMethod*); + void (*pQuickResolutionTrampoline)(mirror::ArtMethod*); + void (*pQuickToInterpreterBridge)(mirror::ArtMethod*); void (*pInvokeDirectTrampolineWithAccessCheck)(uint32_t, void*); void (*pInvokeInterfaceTrampoline)(uint32_t, void*); void (*pInvokeInterfaceTrampolineWithAccessCheck)(uint32_t, void*); diff --git a/runtime/entrypoints/quick/quick_field_entrypoints.cc b/runtime/entrypoints/quick/quick_field_entrypoints.cc index a4e9dc9b27..0ec1eb7920 100644 --- a/runtime/entrypoints/quick/quick_field_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_field_entrypoints.cc @@ -17,19 +17,20 @@ #include "callee_save_frame.h" #include "dex_file-inl.h" #include "entrypoints/entrypoint_utils.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include namespace art { extern "C" uint32_t artGet32StaticFromCode(uint32_t field_idx, - const mirror::AbstractMethod* referrer, - Thread* self, mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(int32_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, + sizeof(int32_t)); if (LIKELY(field != NULL)) { return field->Get32(field->GetDeclaringClass()); } @@ -42,10 +43,11 @@ extern "C" uint32_t artGet32StaticFromCode(uint32_t field_idx, } extern "C" uint64_t artGet64StaticFromCode(uint32_t field_idx, - const mirror::AbstractMethod* referrer, - Thread* self, mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, sizeof(int64_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveRead, + sizeof(int64_t)); if (LIKELY(field != NULL)) { return field->Get64(field->GetDeclaringClass()); } @@ -58,16 +60,17 @@ extern "C" uint64_t artGet64StaticFromCode(uint32_t field_idx, } extern "C" mirror::Object* artGetObjStaticFromCode(uint32_t field_idx, - const mirror::AbstractMethod* referrer, - Thread* self, mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticObjectRead, + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticObjectRead, sizeof(mirror::Object*)); if (LIKELY(field != NULL)) { return field->GetObj(field->GetDeclaringClass()); } FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); - field = FindFieldFromCode(field_idx, referrer, self, StaticObjectRead, sizeof(mirror::Object*), true); + field = FindFieldFromCode(field_idx, referrer, self, StaticObjectRead, sizeof(mirror::Object*), + true); if (LIKELY(field != NULL)) { return field->GetObj(field->GetDeclaringClass()); } @@ -75,15 +78,17 @@ extern "C" mirror::Object* artGetObjStaticFromCode(uint32_t field_idx, } extern "C" uint32_t artGet32InstanceFromCode(uint32_t field_idx, mirror::Object* obj, - const mirror::AbstractMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(int32_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, + sizeof(int32_t)); if (LIKELY(field != NULL && obj != NULL)) { return field->Get32(obj); } FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); - field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveRead, sizeof(int32_t), true); + field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveRead, sizeof(int32_t), + true); if (LIKELY(field != NULL)) { if (UNLIKELY(obj == NULL)) { ThrowLocation throw_location = self->GetCurrentLocationForThrow(); @@ -96,15 +101,17 @@ extern "C" uint32_t artGet32InstanceFromCode(uint32_t field_idx, mirror::Object* } extern "C" uint64_t artGet64InstanceFromCode(uint32_t field_idx, mirror::Object* obj, - const mirror::AbstractMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, sizeof(int64_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveRead, + sizeof(int64_t)); if (LIKELY(field != NULL && obj != NULL)) { return field->Get64(obj); } FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); - field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveRead, sizeof(int64_t), true); + field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveRead, sizeof(int64_t), + true); if (LIKELY(field != NULL)) { if (UNLIKELY(obj == NULL)) { ThrowLocation throw_location = self->GetCurrentLocationForThrow(); @@ -117,16 +124,18 @@ extern "C" uint64_t artGet64InstanceFromCode(uint32_t field_idx, mirror::Object* } extern "C" mirror::Object* artGetObjInstanceFromCode(uint32_t field_idx, mirror::Object* obj, - const mirror::AbstractMethod* referrer, + const mirror::ArtMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstanceObjectRead, sizeof(mirror::Object*)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstanceObjectRead, + sizeof(mirror::Object*)); if (LIKELY(field != NULL && obj != NULL)) { return field->GetObj(obj); } FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); - field = FindFieldFromCode(field_idx, referrer, self, InstanceObjectRead, sizeof(mirror::Object*), true); + field = FindFieldFromCode(field_idx, referrer, self, InstanceObjectRead, sizeof(mirror::Object*), + true); if (LIKELY(field != NULL)) { if (UNLIKELY(obj == NULL)) { ThrowLocation throw_location = self->GetCurrentLocationForThrow(); @@ -139,10 +148,11 @@ extern "C" mirror::Object* artGetObjInstanceFromCode(uint32_t field_idx, mirror: } extern "C" int artSet32StaticFromCode(uint32_t field_idx, uint32_t new_value, - const mirror::AbstractMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(int32_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, + sizeof(int32_t)); if (LIKELY(field != NULL)) { field->Set32(field->GetDeclaringClass(), new_value); return 0; // success @@ -156,10 +166,11 @@ extern "C" int artSet32StaticFromCode(uint32_t field_idx, uint32_t new_value, return -1; // failure } -extern "C" int artSet64StaticFromCode(uint32_t field_idx, const mirror::AbstractMethod* referrer, - uint64_t new_value, Thread* self, mirror::AbstractMethod** sp) +extern "C" int artSet64StaticFromCode(uint32_t field_idx, const mirror::ArtMethod* referrer, + uint64_t new_value, Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, sizeof(int64_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticPrimitiveWrite, + sizeof(int64_t)); if (LIKELY(field != NULL)) { field->Set64(field->GetDeclaringClass(), new_value); return 0; // success @@ -174,11 +185,11 @@ extern "C" int artSet64StaticFromCode(uint32_t field_idx, const mirror::Abstract } extern "C" int artSetObjStaticFromCode(uint32_t field_idx, mirror::Object* new_value, - const mirror::AbstractMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, StaticObjectWrite, - sizeof(mirror::Object*)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, StaticObjectWrite, + sizeof(mirror::Object*)); if (LIKELY(field != NULL)) { if (LIKELY(!FieldHelper(field).IsPrimitiveType())) { field->SetObj(field->GetDeclaringClass(), new_value); @@ -195,16 +206,18 @@ extern "C" int artSetObjStaticFromCode(uint32_t field_idx, mirror::Object* new_v } extern "C" int artSet32InstanceFromCode(uint32_t field_idx, mirror::Object* obj, uint32_t new_value, - const mirror::AbstractMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, sizeof(int32_t)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, + sizeof(int32_t)); if (LIKELY(field != NULL && obj != NULL)) { field->Set32(obj, new_value); return 0; // success } FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); - field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveWrite, sizeof(int32_t), true); + field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveWrite, sizeof(int32_t), + true); if (LIKELY(field != NULL)) { if (UNLIKELY(obj == NULL)) { ThrowLocation throw_location = self->GetCurrentLocationForThrow(); @@ -218,20 +231,21 @@ extern "C" int artSet32InstanceFromCode(uint32_t field_idx, mirror::Object* obj, } extern "C" int artSet64InstanceFromCode(uint32_t field_idx, mirror::Object* obj, uint64_t new_value, - Thread* self, mirror::AbstractMethod** sp) + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* callee_save = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsOnly); - mirror::AbstractMethod* referrer = - sp[callee_save->GetFrameSizeInBytes() / sizeof(mirror::AbstractMethod*)]; - mirror::Field* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, - sizeof(int64_t)); + mirror::ArtMethod* callee_save = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsOnly); + mirror::ArtMethod* referrer = + sp[callee_save->GetFrameSizeInBytes() / sizeof(mirror::ArtMethod*)]; + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstancePrimitiveWrite, + sizeof(int64_t)); if (LIKELY(field != NULL && obj != NULL)) { field->Set64(obj, new_value); return 0; // success } *sp = callee_save; self->SetTopOfStack(sp, 0); - field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveWrite, sizeof(int64_t), true); + field = FindFieldFromCode(field_idx, referrer, self, InstancePrimitiveWrite, sizeof(int64_t), + true); if (LIKELY(field != NULL)) { if (UNLIKELY(obj == NULL)) { ThrowLocation throw_location = self->GetCurrentLocationForThrow(); @@ -246,11 +260,11 @@ extern "C" int artSet64InstanceFromCode(uint32_t field_idx, mirror::Object* obj, extern "C" int artSetObjInstanceFromCode(uint32_t field_idx, mirror::Object* obj, mirror::Object* new_value, - const mirror::AbstractMethod* referrer, Thread* self, - mirror::AbstractMethod** sp) + const mirror::ArtMethod* referrer, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::Field* field = FindFieldFast(field_idx, referrer, InstanceObjectWrite, - sizeof(mirror::Object*)); + mirror::ArtField* field = FindFieldFast(field_idx, referrer, InstanceObjectWrite, + sizeof(mirror::Object*)); if (LIKELY(field != NULL && obj != NULL)) { field->SetObj(obj, new_value); return 0; // success diff --git a/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc b/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc index b81ad12b7b..ca0c92e6d5 100644 --- a/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc @@ -39,7 +39,7 @@ namespace art { */ extern "C" int artHandleFillArrayDataFromCode(mirror::Array* array, const Instruction::ArrayDataPayload* payload, - Thread* self, mirror::AbstractMethod** sp) + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); DCHECK_EQ(payload->ident, static_cast(Instruction::kArrayDataSignature)); diff --git a/runtime/entrypoints/quick/quick_instrumentation_entrypoints.cc b/runtime/entrypoints/quick/quick_instrumentation_entrypoints.cc index 0e61942209..633f580bd6 100644 --- a/runtime/entrypoints/quick/quick_instrumentation_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_instrumentation_entrypoints.cc @@ -16,17 +16,17 @@ #include "callee_save_frame.h" #include "instrumentation.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/object-inl.h" #include "runtime.h" #include "thread-inl.h" namespace art { -extern "C" const void* artInstrumentationMethodEntryFromCode(mirror::AbstractMethod* method, +extern "C" const void* artInstrumentationMethodEntryFromCode(mirror::ArtMethod* method, mirror::Object* this_object, Thread* self, - mirror::AbstractMethod** sp, + mirror::ArtMethod** sp, uintptr_t lr) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsAndArgs); @@ -39,7 +39,7 @@ extern "C" const void* artInstrumentationMethodEntryFromCode(mirror::AbstractMet return result; } -extern "C" uint64_t artInstrumentationMethodExitFromCode(Thread* self, mirror::AbstractMethod** sp, +extern "C" uint64_t artInstrumentationMethodExitFromCode(Thread* self, mirror::ArtMethod** sp, uint64_t gpr_result, uint64_t fpr_result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // TODO: use FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly) not the hand inlined below. @@ -47,7 +47,7 @@ extern "C" uint64_t artInstrumentationMethodExitFromCode(Thread* self, mirror::A // stack. // Be aware the store below may well stomp on an incoming argument. Locks::mutator_lock_->AssertSharedHeld(self); - mirror::AbstractMethod* callee_save = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsOnly); + mirror::ArtMethod* callee_save = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsOnly); *sp = callee_save; uintptr_t* return_pc = reinterpret_cast(reinterpret_cast(sp) + callee_save->GetReturnPcOffsetInBytes()); diff --git a/runtime/entrypoints/quick/quick_invoke_entrypoints.cc b/runtime/entrypoints/quick/quick_invoke_entrypoints.cc index 53b3628e2f..1d8022f803 100644 --- a/runtime/entrypoints/quick/quick_invoke_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_invoke_entrypoints.cc @@ -17,21 +17,21 @@ #include "callee_save_frame.h" #include "dex_instruction-inl.h" #include "entrypoints/entrypoint_utils.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/dex_cache-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" namespace art { // Determine target of interface dispatch. This object is known non-null. -extern "C" uint64_t artInvokeInterfaceTrampoline(mirror::AbstractMethod* interface_method, +extern "C" uint64_t artInvokeInterfaceTrampoline(mirror::ArtMethod* interface_method, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, - Thread* self, mirror::AbstractMethod** sp) + mirror::ArtMethod* caller_method, + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; if (LIKELY(interface_method->GetDexMethodIndex() != DexFile::kDexNoIndex16)) { method = this_object->GetClass()->FindVirtualMethodForInterface(interface_method); if (UNLIKELY(method == NULL)) { @@ -144,11 +144,11 @@ extern "C" uint64_t artInvokeInterfaceTrampoline(mirror::AbstractMethod* interfa static uint64_t artInvokeCommon(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, - Thread* self, mirror::AbstractMethod** sp, bool access_check, + mirror::ArtMethod* caller_method, + Thread* self, mirror::ArtMethod** sp, bool access_check, InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method = FindMethodFast(method_idx, this_object, caller_method, + mirror::ArtMethod* method = FindMethodFast(method_idx, this_object, caller_method, access_check, type); if (UNLIKELY(method == NULL)) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsAndArgs); @@ -179,9 +179,9 @@ static uint64_t artInvokeCommon(uint32_t method_idx, mirror::Object* this_object // See comments in runtime_support_asm.S extern "C" uint64_t artInvokeInterfaceTrampolineWithAccessCheck(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, + mirror::ArtMethod* caller_method, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return artInvokeCommon(method_idx, this_object, caller_method, self, sp, true, kInterface); } @@ -189,36 +189,36 @@ extern "C" uint64_t artInvokeInterfaceTrampolineWithAccessCheck(uint32_t method_ extern "C" uint64_t artInvokeDirectTrampolineWithAccessCheck(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, + mirror::ArtMethod* caller_method, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return artInvokeCommon(method_idx, this_object, caller_method, self, sp, true, kDirect); } extern "C" uint64_t artInvokeStaticTrampolineWithAccessCheck(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, + mirror::ArtMethod* caller_method, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return artInvokeCommon(method_idx, this_object, caller_method, self, sp, true, kStatic); } extern "C" uint64_t artInvokeSuperTrampolineWithAccessCheck(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, + mirror::ArtMethod* caller_method, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return artInvokeCommon(method_idx, this_object, caller_method, self, sp, true, kSuper); } extern "C" uint64_t artInvokeVirtualTrampolineWithAccessCheck(uint32_t method_idx, mirror::Object* this_object, - mirror::AbstractMethod* caller_method, + mirror::ArtMethod* caller_method, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return artInvokeCommon(method_idx, this_object, caller_method, self, sp, true, kVirtual); } diff --git a/runtime/entrypoints/quick/quick_jni_entrypoints.cc b/runtime/entrypoints/quick/quick_jni_entrypoints.cc index 9907c043ee..27ae59b9b0 100644 --- a/runtime/entrypoints/quick/quick_jni_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_jni_entrypoints.cc @@ -16,8 +16,8 @@ #include "dex_file-inl.h" #include "entrypoints/entrypoint_utils.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" diff --git a/runtime/entrypoints/quick/quick_lock_entrypoints.cc b/runtime/entrypoints/quick/quick_lock_entrypoints.cc index 79bb7a69f1..36ca6044a2 100644 --- a/runtime/entrypoints/quick/quick_lock_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_lock_entrypoints.cc @@ -20,7 +20,7 @@ namespace art { extern "C" int artUnlockObjectFromCode(mirror::Object* obj, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) UNLOCK_FUNCTION(monitor_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kRefsOnly); DCHECK(obj != NULL); // Assumed to have been checked before entry @@ -29,7 +29,7 @@ extern "C" int artUnlockObjectFromCode(mirror::Object* obj, Thread* self, } extern "C" void artLockObjectFromCode(mirror::Object* obj, Thread* thread, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) EXCLUSIVE_LOCK_FUNCTION(monitor_lock_) { FinishCalleeSaveFrameSetup(thread, sp, Runtime::kRefsOnly); DCHECK(obj != NULL); // Assumed to have been checked before entry diff --git a/runtime/entrypoints/quick/quick_thread_entrypoints.cc b/runtime/entrypoints/quick/quick_thread_entrypoints.cc index b4d6c0ba8d..53e725edba 100644 --- a/runtime/entrypoints/quick/quick_thread_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_thread_entrypoints.cc @@ -28,7 +28,7 @@ void CheckSuspendFromCode(Thread* thread) CheckSuspend(thread); } -extern "C" void artTestSuspendFromCode(Thread* thread, mirror::AbstractMethod** sp) +extern "C" void artTestSuspendFromCode(Thread* thread, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Called when suspend count check value is 0 and thread->suspend_count_ != 0 FinishCalleeSaveFrameSetup(thread, sp, Runtime::kRefsOnly); diff --git a/runtime/entrypoints/quick/quick_throw_entrypoints.cc b/runtime/entrypoints/quick/quick_throw_entrypoints.cc index 3bfa2f2611..f67b2fc4ab 100644 --- a/runtime/entrypoints/quick/quick_throw_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_throw_entrypoints.cc @@ -24,7 +24,7 @@ namespace art { // Deliver an exception that's pending on thread helping set up a callee save frame on the way. -extern "C" void artDeliverPendingExceptionFromCode(Thread* thread, mirror::AbstractMethod** sp) +extern "C" void artDeliverPendingExceptionFromCode(Thread* thread, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(thread, sp, Runtime::kSaveAll); thread->QuickDeliverException(); @@ -32,7 +32,7 @@ extern "C" void artDeliverPendingExceptionFromCode(Thread* thread, mirror::Abstr // Called by generated call to throw an exception. extern "C" void artDeliverExceptionFromCode(mirror::Throwable* exception, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { /* * exception may be NULL, in which case this routine should @@ -54,7 +54,7 @@ extern "C" void artDeliverExceptionFromCode(mirror::Throwable* exception, Thread // Called by generated call to throw a NPE exception. extern "C" void artThrowNullPointerExceptionFromCode(Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll); ThrowLocation throw_location = self->GetCurrentLocationForThrow(); @@ -64,7 +64,7 @@ extern "C" void artThrowNullPointerExceptionFromCode(Thread* self, // Called by generated call to throw an arithmetic divide by zero exception. extern "C" void artThrowDivZeroFromCode(Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll); ThrowArithmeticExceptionDivideByZero(); @@ -73,14 +73,14 @@ extern "C" void artThrowDivZeroFromCode(Thread* self, // Called by generated call to throw an array index out of bounds exception. extern "C" void artThrowArrayBoundsFromCode(int index, int length, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll); ThrowArrayIndexOutOfBoundsException(index, length); self->QuickDeliverException(); } -extern "C" void artThrowStackOverflowFromCode(Thread* self, mirror::AbstractMethod** sp) +extern "C" void artThrowStackOverflowFromCode(Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll); ThrowStackOverflowError(self); @@ -88,7 +88,7 @@ extern "C" void artThrowStackOverflowFromCode(Thread* self, mirror::AbstractMeth } extern "C" void artThrowNoSuchMethodFromCode(int32_t method_idx, Thread* self, - mirror::AbstractMethod** sp) + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(self, sp, Runtime::kSaveAll); ThrowNoSuchMethodError(method_idx); diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index 9bf02e8c8e..392bcc5257 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -19,7 +19,7 @@ #include "dex_instruction-inl.h" #include "interpreter/interpreter.h" #include "invoke_arg_array_builder.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" @@ -100,18 +100,18 @@ class QuickArgumentVisitor { #define QUICK_STACK_ARG_SKIP 0 #endif - static mirror::AbstractMethod* GetCallingMethod(mirror::AbstractMethod** sp) { + static mirror::ArtMethod* GetCallingMethod(mirror::ArtMethod** sp) { byte* previous_sp = reinterpret_cast(sp) + QUICK_CALLEE_SAVE_FRAME__REF_AND_ARGS__FRAME_SIZE; - return *reinterpret_cast(previous_sp); + return *reinterpret_cast(previous_sp); } - static uintptr_t GetCallingPc(mirror::AbstractMethod** sp) { + static uintptr_t GetCallingPc(mirror::ArtMethod** sp) { byte* lr = reinterpret_cast(sp) + QUICK_CALLEE_SAVE_FRAME__REF_AND_ARGS__LR_OFFSET; return *reinterpret_cast(lr); } - QuickArgumentVisitor(mirror::AbstractMethod** sp, bool is_static, + QuickArgumentVisitor(mirror::ArtMethod** sp, bool is_static, const char* shorty, uint32_t shorty_len) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : is_static_(is_static), shorty_(shorty), shorty_len_(shorty_len), @@ -220,7 +220,7 @@ class QuickArgumentVisitor { // Visits arguments on the stack placing them into the shadow frame. class BuildShadowFrameVisitor : public QuickArgumentVisitor { public: - BuildShadowFrameVisitor(mirror::AbstractMethod** sp, bool is_static, const char* shorty, + BuildShadowFrameVisitor(mirror::ArtMethod** sp, bool is_static, const char* shorty, uint32_t shorty_len, ShadowFrame& sf, size_t first_arg_reg) : QuickArgumentVisitor(sp, is_static, shorty, shorty_len), sf_(sf), cur_reg_(first_arg_reg) {} @@ -261,8 +261,8 @@ class BuildShadowFrameVisitor : public QuickArgumentVisitor { DISALLOW_COPY_AND_ASSIGN(BuildShadowFrameVisitor); }; -extern "C" uint64_t artQuickToInterpreterBridge(mirror::AbstractMethod* method, Thread* self, - mirror::AbstractMethod** sp) +extern "C" uint64_t artQuickToInterpreterBridge(mirror::ArtMethod* method, Thread* self, + mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Ensure we don't get thread suspension until the object arguments are safely in the shadow // frame. @@ -311,7 +311,7 @@ extern "C" uint64_t artQuickToInterpreterBridge(mirror::AbstractMethod* method, // to jobjects. class BuildQuickArgumentVisitor : public QuickArgumentVisitor { public: - BuildQuickArgumentVisitor(mirror::AbstractMethod** sp, bool is_static, const char* shorty, + BuildQuickArgumentVisitor(mirror::ArtMethod** sp, bool is_static, const char* shorty, uint32_t shorty_len, ScopedObjectAccessUnchecked* soa, std::vector* args) : QuickArgumentVisitor(sp, is_static, shorty, shorty_len), soa_(soa), args_(args) {} @@ -360,9 +360,9 @@ class BuildQuickArgumentVisitor : public QuickArgumentVisitor { // which is responsible for recording callee save registers. We explicitly place into jobjects the // incoming reference arguments (so they survive GC). We invoke the invocation handler, which is a // field within the proxy object, which will box the primitive arguments and deal with error cases. -extern "C" uint64_t artQuickProxyInvokeHandler(mirror::AbstractMethod* proxy_method, +extern "C" uint64_t artQuickProxyInvokeHandler(mirror::ArtMethod* proxy_method, mirror::Object* receiver, - Thread* self, mirror::AbstractMethod** sp) + Thread* self, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // Ensure we don't get thread suspension until the object arguments are safely in jobjects. const char* old_cause = @@ -389,7 +389,7 @@ extern "C" uint64_t artQuickProxyInvokeHandler(mirror::AbstractMethod* proxy_met args.erase(args.begin()); // Convert proxy method into expected interface method. - mirror::AbstractMethod* interface_method = proxy_method->FindOverriddenMethod(); + mirror::ArtMethod* interface_method = proxy_method->FindOverriddenMethod(); DCHECK(interface_method != NULL); DCHECK(!interface_method->IsProxyMethod()) << PrettyMethod(interface_method); jobject interface_method_jobj = soa.AddLocalReference(interface_method); @@ -406,7 +406,7 @@ extern "C" uint64_t artQuickProxyInvokeHandler(mirror::AbstractMethod* proxy_met // so they don't get garbage collected. class RememberFoGcArgumentVisitor : public QuickArgumentVisitor { public: - RememberFoGcArgumentVisitor(mirror::AbstractMethod** sp, bool is_static, const char* shorty, + RememberFoGcArgumentVisitor(mirror::ArtMethod** sp, bool is_static, const char* shorty, uint32_t shorty_len, ScopedObjectAccessUnchecked* soa) : QuickArgumentVisitor(sp, is_static, shorty, shorty_len), soa_(soa) {} @@ -423,9 +423,9 @@ class RememberFoGcArgumentVisitor : public QuickArgumentVisitor { }; // Lazily resolve a method for quick. Called by stub code. -extern "C" const void* artQuickResolutionTrampoline(mirror::AbstractMethod* called, +extern "C" const void* artQuickResolutionTrampoline(mirror::ArtMethod* called, mirror::Object* receiver, - Thread* thread, mirror::AbstractMethod** sp) + Thread* thread, mirror::ArtMethod** sp) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { FinishCalleeSaveFrameSetup(thread, sp, Runtime::kRefsAndArgs); // Start new JNI local reference state @@ -436,7 +436,7 @@ extern "C" const void* artQuickResolutionTrampoline(mirror::AbstractMethod* call // Compute details about the called method (avoid GCs) ClassLinker* linker = Runtime::Current()->GetClassLinker(); - mirror::AbstractMethod* caller = QuickArgumentVisitor::GetCallingMethod(sp); + mirror::ArtMethod* caller = QuickArgumentVisitor::GetCallingMethod(sp); InvokeType invoke_type; const DexFile* dex_file; uint32_t dex_method_idx; diff --git a/runtime/exception_test.cc b/runtime/exception_test.cc index 933b74ace1..e48208d771 100644 --- a/runtime/exception_test.cc +++ b/runtime/exception_test.cc @@ -95,8 +95,8 @@ class ExceptionTest : public CommonTest { UnsignedLeb128EncodingVector fake_vmap_table_data_; std::vector fake_gc_map_; - mirror::AbstractMethod* method_f_; - mirror::AbstractMethod* method_g_; + mirror::ArtMethod* method_f_; + mirror::ArtMethod* method_g_; private: mirror::Class* my_klass_; diff --git a/runtime/gc/accounting/mod_union_table.cc b/runtime/gc/accounting/mod_union_table.cc index 0363acb477..3bbc3810a0 100644 --- a/runtime/gc/accounting/mod_union_table.cc +++ b/runtime/gc/accounting/mod_union_table.cc @@ -22,9 +22,9 @@ #include "gc/collector/mark_sweep-inl.h" #include "gc/heap.h" #include "gc/space/space.h" +#include "mirror/art_field-inl.h" #include "mirror/object-inl.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include "mirror/object_array-inl.h" #include "space_bitmap-inl.h" #include "thread.h" diff --git a/runtime/gc/accounting/space_bitmap.cc b/runtime/gc/accounting/space_bitmap.cc index 6edc067cc7..702e162262 100644 --- a/runtime/gc/accounting/space_bitmap.cc +++ b/runtime/gc/accounting/space_bitmap.cc @@ -17,8 +17,8 @@ #include "base/logging.h" #include "dex_file-inl.h" #include "heap_bitmap.h" +#include "mirror/art_field-inl.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "object_utils.h" @@ -182,10 +182,10 @@ static void WalkInstanceFields(SpaceBitmap* visited, SpaceBitmap::Callback* call WalkInstanceFields(visited, callback, obj, super, arg); } // Walk instance fields - mirror::ObjectArray* fields = klass->GetIFields(); + mirror::ObjectArray* fields = klass->GetIFields(); if (fields != NULL) { for (int32_t i = 0; i < fields->GetLength(); i++) { - mirror::Field* field = fields->Get(i); + mirror::ArtField* field = fields->Get(i); FieldHelper fh(field); if (!fh.IsPrimitiveType()) { mirror::Object* value = field->GetObj(obj); @@ -212,10 +212,10 @@ static void WalkFieldsInOrder(SpaceBitmap* visited, SpaceBitmap::Callback* callb WalkInstanceFields(visited, callback, obj, klass, arg); // Walk static fields of a Class if (obj->IsClass()) { - mirror::ObjectArray* fields = klass->GetSFields(); + mirror::ObjectArray* fields = klass->GetSFields(); if (fields != NULL) { for (int32_t i = 0; i < fields->GetLength(); i++) { - mirror::Field* field = fields->Get(i); + mirror::ArtField* field = fields->Get(i); FieldHelper fh(field); if (!fh.IsPrimitiveType()) { mirror::Object* value = field->GetObj(NULL); diff --git a/runtime/gc/collector/mark_sweep-inl.h b/runtime/gc/collector/mark_sweep-inl.h index 6b1b617eb4..e158952119 100644 --- a/runtime/gc/collector/mark_sweep-inl.h +++ b/runtime/gc/collector/mark_sweep-inl.h @@ -20,8 +20,8 @@ #include "gc/collector/mark_sweep.h" #include "gc/heap.h" +#include "mirror/art_field.h" #include "mirror/class.h" -#include "mirror/field.h" #include "mirror/object_array.h" namespace art { @@ -136,8 +136,8 @@ inline void MarkSweep::VisitFieldsReferences(const mirror::Object* obj, uint32_t ? klass->NumReferenceStaticFields() : klass->NumReferenceInstanceFields()); for (size_t i = 0; i < num_reference_fields; ++i) { - mirror::Field* field = (is_static ? klass->GetStaticField(i) - : klass->GetInstanceField(i)); + mirror::ArtField* field = (is_static ? klass->GetStaticField(i) + : klass->GetInstanceField(i)); MemberOffset field_offset = field->GetOffset(); const mirror::Object* ref = obj->GetFieldObject(field_offset, false); visitor(obj, ref, field_offset, is_static); diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc index 7b78720392..61570ae393 100644 --- a/runtime/gc/collector/mark_sweep.cc +++ b/runtime/gc/collector/mark_sweep.cc @@ -37,11 +37,11 @@ #include "jni_internal.h" #include "monitor.h" #include "mark_sweep-inl.h" +#include "mirror/art_field.h" +#include "mirror/art_field-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/dex_cache.h" -#include "mirror/field.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array.h" #include "mirror/object_array-inl.h" @@ -50,8 +50,8 @@ #include "thread_list.h" #include "verifier/method_verifier.h" +using ::art::mirror::ArtField; using ::art::mirror::Class; -using ::art::mirror::Field; using ::art::mirror::Object; using ::art::mirror::ObjectArray; @@ -1072,11 +1072,11 @@ void MarkSweep::CheckReference(const Object* obj, const Object* ref, MemberOffse const Class* klass = is_static ? obj->AsClass() : obj->GetClass(); DCHECK(klass != NULL); - const ObjectArray* fields = is_static ? klass->GetSFields() : klass->GetIFields(); + const ObjectArray* fields = is_static ? klass->GetSFields() : klass->GetIFields(); DCHECK(fields != NULL); bool found = false; for (int32_t i = 0; i < fields->GetLength(); ++i) { - const Field* cur = fields->Get(i); + const ArtField* cur = fields->Get(i); if (cur->GetOffset().Int32Value() == offset.Int32Value()) { LOG(WARNING) << "Field referencing the alloc space was " << PrettyField(cur); found = true; diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index df1f3fe92e..a2453b8405 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -41,8 +41,8 @@ #include "gc/space/space-inl.h" #include "image.h" #include "invoke_arg_array_builder.h" +#include "mirror/art_field-inl.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include "mirror/object.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" @@ -1512,11 +1512,11 @@ class VerifyReferenceCardVisitor { if (!obj->IsObjectArray()) { const mirror::Class* klass = is_static ? obj->AsClass() : obj->GetClass(); CHECK(klass != NULL); - const mirror::ObjectArray* fields = is_static ? klass->GetSFields() - : klass->GetIFields(); + const mirror::ObjectArray* fields = is_static ? klass->GetSFields() + : klass->GetIFields(); CHECK(fields != NULL); for (int32_t i = 0; i < fields->GetLength(); ++i) { - const mirror::Field* cur = fields->Get(i); + const mirror::ArtField* cur = fields->Get(i); if (cur->GetOffset().Int32Value() == offset.Int32Value()) { LOG(ERROR) << (is_static ? "Static " : "") << "field in the live stack is " << PrettyField(cur); diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index 8ff7025c34..22562df512 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -22,7 +22,7 @@ #include "base/stl_util.h" #include "base/unix_file/fd_file.h" #include "gc/accounting/space_bitmap-inl.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/class-inl.h" #include "mirror/object-inl.h" #include "oat_file.h" @@ -187,14 +187,14 @@ ImageSpace* ImageSpace::Init(const std::string& image_file_name, bool validate_o Runtime* runtime = Runtime::Current(); mirror::Object* resolution_method = image_header.GetImageRoot(ImageHeader::kResolutionMethod); - runtime->SetResolutionMethod(down_cast(resolution_method)); + runtime->SetResolutionMethod(down_cast(resolution_method)); mirror::Object* callee_save_method = image_header.GetImageRoot(ImageHeader::kCalleeSaveMethod); - runtime->SetCalleeSaveMethod(down_cast(callee_save_method), Runtime::kSaveAll); + runtime->SetCalleeSaveMethod(down_cast(callee_save_method), Runtime::kSaveAll); callee_save_method = image_header.GetImageRoot(ImageHeader::kRefsOnlySaveMethod); - runtime->SetCalleeSaveMethod(down_cast(callee_save_method), Runtime::kRefsOnly); + runtime->SetCalleeSaveMethod(down_cast(callee_save_method), Runtime::kRefsOnly); callee_save_method = image_header.GetImageRoot(ImageHeader::kRefsAndArgsSaveMethod); - runtime->SetCalleeSaveMethod(down_cast(callee_save_method), Runtime::kRefsAndArgs); + runtime->SetCalleeSaveMethod(down_cast(callee_save_method), Runtime::kRefsAndArgs); UniquePtr space(new ImageSpace(image_file_name, map.release())); diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc index d3bb2e8f5f..0b2e741527 100644 --- a/runtime/hprof/hprof.cc +++ b/runtime/hprof/hprof.cc @@ -48,10 +48,9 @@ #include "gc/heap.h" #include "gc/space/space.h" #include "globals.h" +#include "mirror/art_field-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" -#include "mirror/field.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "object_utils.h" #include "os.h" @@ -922,7 +921,7 @@ int Hprof::DumpHeapObject(mirror::Object* obj) { rec->AddId(CLASS_STATICS_ID(obj)); for (size_t i = 0; i < sFieldCount; ++i) { - mirror::Field* f = thisClass->GetStaticField(i); + mirror::ArtField* f = thisClass->GetStaticField(i); fh.ChangeField(f); size_t size; @@ -947,7 +946,7 @@ int Hprof::DumpHeapObject(mirror::Object* obj) { int iFieldCount = thisClass->IsObjectClass() ? 0 : thisClass->NumInstanceFields(); rec->AddU2((uint16_t)iFieldCount); for (int i = 0; i < iFieldCount; ++i) { - mirror::Field* f = thisClass->GetInstanceField(i); + mirror::ArtField* f = thisClass->GetInstanceField(i); fh.ChangeField(f); HprofBasicType t = SignatureToBasicTypeAndSize(fh.GetTypeDescriptor(), NULL); rec->AddId(LookupStringId(fh.GetName())); @@ -1010,7 +1009,7 @@ int Hprof::DumpHeapObject(mirror::Object* obj) { while (!sclass->IsObjectClass()) { int ifieldCount = sclass->NumInstanceFields(); for (int i = 0; i < ifieldCount; ++i) { - mirror::Field* f = sclass->GetInstanceField(i); + mirror::ArtField* f = sclass->GetInstanceField(i); fh.ChangeField(f); size_t size; SignatureToBasicTypeAndSize(fh.GetTypeDescriptor(), &size); diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc index c3b66b3f79..ae3a165a70 100644 --- a/runtime/instrumentation.cc +++ b/runtime/instrumentation.cc @@ -23,9 +23,9 @@ #include "class_linker.h" #include "debugger.h" #include "dex_file-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/dex_cache.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" #include "nth_caller_visitor.h" @@ -55,7 +55,7 @@ bool Instrumentation::InstallStubsForClass(mirror::Class* klass) { } bool is_initialized = klass->IsInitialized(); for (size_t i = 0; i < klass->NumDirectMethods(); i++) { - mirror::AbstractMethod* method = klass->GetDirectMethod(i); + mirror::ArtMethod* method = klass->GetDirectMethod(i); if (!method->IsAbstract()) { const void* new_code; if (uninstall) { @@ -77,7 +77,7 @@ bool Instrumentation::InstallStubsForClass(mirror::Class* klass) { } } for (size_t i = 0; i < klass->NumVirtualMethods(); i++) { - mirror::AbstractMethod* method = klass->GetVirtualMethod(i); + mirror::ArtMethod* method = klass->GetVirtualMethod(i); if (!method->IsAbstract()) { const void* new_code; if (uninstall) { @@ -109,7 +109,7 @@ static void InstrumentationInstallStack(Thread* thread, void* arg) instrumentation_exit_pc_(instrumentation_exit_pc), last_return_pc_(0) {} virtual bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (GetCurrentQuickFrame() == NULL) { if (kVerboseInstrumentation) { LOG(INFO) << " Ignoring a shadow frame. Frame " << GetFrameId() @@ -169,7 +169,7 @@ static void InstrumentationInstallStack(Thread* thread, void* arg) for (It it = thread->GetInstrumentationStack()->rbegin(), end = thread->GetInstrumentationStack()->rend(); it != end; ++it) { mirror::Object* this_object = (*it).this_object_; - mirror::AbstractMethod* method = (*it).method_; + mirror::ArtMethod* method = (*it).method_; uint32_t dex_pc = visitor.dex_pcs_.back(); visitor.dex_pcs_.pop_back(); instrumentation->MethodEnterEvent(thread, this_object, method, dex_pc); @@ -193,7 +193,7 @@ static void InstrumentationRestoreStack(Thread* thread, void* arg) if (instrumentation_stack_->size() == 0) { return false; // Stop. } - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (GetCurrentQuickFrame() == NULL) { if (kVerboseInstrumentation) { LOG(INFO) << " Ignoring a shadow frame. Frame " << GetFrameId() << " Method=" << PrettyMethod(m); @@ -379,7 +379,7 @@ void Instrumentation::ConfigureStubs(bool require_entry_exit_stubs, bool require } } -void Instrumentation::UpdateMethodsCode(mirror::AbstractMethod* method, const void* code) const { +void Instrumentation::UpdateMethodsCode(mirror::ArtMethod* method, const void* code) const { if (LIKELY(!instrumentation_stubs_installed_)) { method->SetEntryPointFromCompiledCode(code); } else { @@ -391,7 +391,7 @@ void Instrumentation::UpdateMethodsCode(mirror::AbstractMethod* method, const vo } } -const void* Instrumentation::GetQuickCodeFor(const mirror::AbstractMethod* method) const { +const void* Instrumentation::GetQuickCodeFor(const mirror::ArtMethod* method) const { Runtime* runtime = Runtime::Current(); if (LIKELY(!instrumentation_stubs_installed_)) { const void* code = method->GetEntryPointFromCompiledCode(); @@ -405,7 +405,7 @@ const void* Instrumentation::GetQuickCodeFor(const mirror::AbstractMethod* metho } void Instrumentation::MethodEnterEventImpl(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, + const mirror::ArtMethod* method, uint32_t dex_pc) const { typedef std::list::const_iterator It; // TODO: C++0x auto It it = method_entry_listeners_.begin(); @@ -420,7 +420,7 @@ void Instrumentation::MethodEnterEventImpl(Thread* thread, mirror::Object* this_ } void Instrumentation::MethodExitEventImpl(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, + const mirror::ArtMethod* method, uint32_t dex_pc, const JValue& return_value) const { typedef std::list::const_iterator It; // TODO: C++0x auto It it = method_exit_listeners_.begin(); @@ -435,7 +435,7 @@ void Instrumentation::MethodExitEventImpl(Thread* thread, mirror::Object* this_o } void Instrumentation::MethodUnwindEvent(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, + const mirror::ArtMethod* method, uint32_t dex_pc) const { if (have_method_unwind_listeners_) { typedef std::list::const_iterator It; // TODO: C++0x auto @@ -447,7 +447,7 @@ void Instrumentation::MethodUnwindEvent(Thread* thread, mirror::Object* this_obj } void Instrumentation::DexPcMovedEventImpl(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, + const mirror::ArtMethod* method, uint32_t dex_pc) const { // TODO: STL copy-on-write collection? The copy below is due to the debug listener having an // action where it can remove itself as a listener and break the iterator. The copy only works @@ -461,7 +461,7 @@ void Instrumentation::DexPcMovedEventImpl(Thread* thread, mirror::Object* this_o } void Instrumentation::ExceptionCaughtEvent(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception_object) { if (have_exception_caught_listeners_) { @@ -489,7 +489,7 @@ static void CheckStackDepth(Thread* self, const InstrumentationStackFrame& instr } void Instrumentation::PushInstrumentationStackFrame(Thread* self, mirror::Object* this_object, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, uintptr_t lr, bool interpreter_entry) { // We have a callee-save frame meaning this value is guaranteed to never be 0. size_t frame_id = StackVisitor::ComputeNumFrames(self); @@ -516,7 +516,7 @@ uint64_t Instrumentation::PopInstrumentationStackFrame(Thread* self, uintptr_t* *return_pc = instrumentation_frame.return_pc_; CheckStackDepth(self, instrumentation_frame, 0); - mirror::AbstractMethod* method = instrumentation_frame.method_; + mirror::ArtMethod* method = instrumentation_frame.method_; char return_shorty = MethodHelper(method).GetShorty()[0]; JValue return_value; if (return_shorty == 'V') { @@ -567,7 +567,7 @@ void Instrumentation::PopMethodForUnwind(Thread* self, bool is_deoptimization) c // TODO: bring back CheckStackDepth(self, instrumentation_frame, 2); stack->pop_front(); - mirror::AbstractMethod* method = instrumentation_frame.method_; + mirror::ArtMethod* method = instrumentation_frame.method_; if (is_deoptimization) { if (kVerboseInstrumentation) { LOG(INFO) << "Popping for deoptimization " << PrettyMethod(method); diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h index 798b7ab56d..6c80b41b64 100644 --- a/runtime/instrumentation.h +++ b/runtime/instrumentation.h @@ -25,10 +25,10 @@ namespace art { namespace mirror { -class AbstractMethod; -class Class; -class Object; -class Throwable; + class ArtMethod; + class Class; + class Object; + class Throwable; } // namespace mirror union JValue; class Thread; @@ -47,30 +47,30 @@ struct InstrumentationListener { // Call-back for when a method is entered. virtual void MethodEntered(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, + const mirror::ArtMethod* method, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; // Call-back for when a method is exited. // TODO: its likely passing the return value would be useful, however, we may need to get and // parse the shorty to determine what kind of register holds the result. virtual void MethodExited(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc, + const mirror::ArtMethod* method, uint32_t dex_pc, const JValue& return_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; // Call-back for when a method is popped due to an exception throw. A method will either cause a // MethodExited call-back or a MethodUnwind call-back when its activation is removed. - virtual void MethodUnwind(Thread* thread, const mirror::AbstractMethod* method, + virtual void MethodUnwind(Thread* thread, const mirror::ArtMethod* method, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; // Call-back for when the dex pc moves in a method. virtual void DexPcMoved(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t new_dex_pc) + const mirror::ArtMethod* method, uint32_t new_dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; // Call-back when an exception is caught. virtual void ExceptionCaught(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, uint32_t catch_dex_pc, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception_object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) = 0; }; @@ -111,12 +111,12 @@ class Instrumentation { LOCKS_EXCLUDED(Locks::thread_list_lock_, Locks::classlinker_classes_lock_); // Update the code of a method respecting any installed stubs. - void UpdateMethodsCode(mirror::AbstractMethod* method, const void* code) const; + void UpdateMethodsCode(mirror::ArtMethod* method, const void* code) const; // Get the quick code for the given method. More efficient than asking the class linker as it // will short-cut to GetCode if instrumentation and static method resolution stubs aren't // installed. - const void* GetQuickCodeFor(const mirror::AbstractMethod* method) const + const void* GetQuickCodeFor(const mirror::ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void ForceInterpretOnly() { @@ -124,7 +124,7 @@ class Instrumentation { forced_interpret_only_ = true; } - // Called by AbstractMethod::Invoke to determine dispatch mechanism. + // Called by ArtMethod::Invoke to determine dispatch mechanism. bool InterpretOnly() const { return interpret_only_; } @@ -152,7 +152,7 @@ class Instrumentation { // Inform listeners that a method has been entered. A dex PC is provided as we may install // listeners into executing code and get method enter events for methods already on the stack. void MethodEnterEvent(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) const + const mirror::ArtMethod* method, uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (UNLIKELY(HasMethodEntryListeners())) { MethodEnterEventImpl(thread, this_object, method, dex_pc); @@ -161,7 +161,7 @@ class Instrumentation { // Inform listeners that a method has been exited. void MethodExitEvent(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc, + const mirror::ArtMethod* method, uint32_t dex_pc, const JValue& return_value) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (UNLIKELY(HasMethodExitListeners())) { @@ -171,12 +171,12 @@ class Instrumentation { // Inform listeners that a method has been exited due to an exception. void MethodUnwindEvent(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) const + const mirror::ArtMethod* method, uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Inform listeners that the dex pc has moved (only supported by the interpreter). void DexPcMovedEvent(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) const + const mirror::ArtMethod* method, uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (UNLIKELY(HasDexPcListeners())) { DexPcMovedEventImpl(thread, this_object, method, dex_pc); @@ -185,14 +185,14 @@ class Instrumentation { // Inform listeners that an exception was caught. void ExceptionCaughtEvent(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, uint32_t catch_dex_pc, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception_object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Called when an instrumented method is entered. The intended link register (lr) is saved so // that returning causes a branch to the method exit stub. Generates method enter events. void PushInstrumentationStackFrame(Thread* self, mirror::Object* this_object, - mirror::AbstractMethod* method, uintptr_t lr, + mirror::ArtMethod* method, uintptr_t lr, bool interpreter_entry) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -216,23 +216,23 @@ class Instrumentation { LOCKS_EXCLUDED(Locks::thread_list_lock_, Locks::classlinker_classes_lock_); void MethodEnterEventImpl(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) const + const mirror::ArtMethod* method, uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void MethodExitEventImpl(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, + const mirror::ArtMethod* method, uint32_t dex_pc, const JValue& return_value) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void DexPcMovedEventImpl(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) const + const mirror::ArtMethod* method, uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - // Have we hijacked AbstractMethod::code_ so that it calls instrumentation/interpreter code? + // Have we hijacked ArtMethod::code_ so that it calls instrumentation/interpreter code? bool instrumentation_stubs_installed_; - // Have we hijacked AbstractMethod::code_ to reference the enter/exit stubs? + // Have we hijacked ArtMethod::code_ to reference the enter/exit stubs? bool entry_exit_stubs_installed_; - // Have we hijacked AbstractMethod::code_ to reference the enter interpreter stub? + // Have we hijacked ArtMethod::code_ to reference the enter interpreter stub? bool interpreter_stubs_installed_; // Do we need the fidelity of events that we only get from running within the interpreter? @@ -272,7 +272,7 @@ class Instrumentation { // An element in the instrumentation side stack maintained in art::Thread. struct InstrumentationStackFrame { - InstrumentationStackFrame(mirror::Object* this_object, mirror::AbstractMethod* method, + InstrumentationStackFrame(mirror::Object* this_object, mirror::ArtMethod* method, uintptr_t return_pc, size_t frame_id, bool interpreter_entry) : this_object_(this_object), method_(method), return_pc_(return_pc), frame_id_(frame_id), interpreter_entry_(interpreter_entry) { @@ -281,7 +281,7 @@ struct InstrumentationStackFrame { std::string Dump() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); mirror::Object* this_object_; - mirror::AbstractMethod* method_; + mirror::ArtMethod* method_; const uintptr_t return_pc_; const size_t frame_id_; const bool interpreter_entry_; diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index 6e35d937fb..59f0ac2e38 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -28,26 +28,27 @@ #include "gc/accounting/card_table-inl.h" #include "invoke_arg_array_builder.h" #include "nth_caller_visitor.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "object_utils.h" #include "ScopedLocalRef.h" #include "scoped_thread_state_change.h" #include "thread.h" +#include "well_known_classes.h" -using ::art::mirror::AbstractMethod; +using ::art::mirror::ArtField; +using ::art::mirror::ArtMethod; using ::art::mirror::Array; using ::art::mirror::BooleanArray; using ::art::mirror::ByteArray; using ::art::mirror::CharArray; using ::art::mirror::Class; using ::art::mirror::ClassLoader; -using ::art::mirror::Field; using ::art::mirror::IntArray; using ::art::mirror::LongArray; using ::art::mirror::Object; @@ -82,22 +83,22 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh, result->SetL(found); } else if (name == "java.lang.Object java.lang.Class.newInstance()") { Class* klass = shadow_frame->GetVRegReference(arg_offset)->AsClass(); - AbstractMethod* c = klass->FindDeclaredDirectMethod("", "()V"); + ArtMethod* c = klass->FindDeclaredDirectMethod("", "()V"); CHECK(c != NULL); - Object* obj = klass->AllocObject(self); - CHECK(obj != NULL); - EnterInterpreterFromInvoke(self, c, obj, NULL, NULL); - result->SetL(obj); + SirtRef obj(self, klass->AllocObject(self)); + CHECK(obj.get() != NULL); + EnterInterpreterFromInvoke(self, c, obj.get(), NULL, NULL); + result->SetL(obj.get()); } else if (name == "java.lang.reflect.Field java.lang.Class.getDeclaredField(java.lang.String)") { // Special managed code cut-out to allow field lookup in a un-started runtime that'd fail // going the reflective Dex way. Class* klass = shadow_frame->GetVRegReference(arg_offset)->AsClass(); String* name = shadow_frame->GetVRegReference(arg_offset + 1)->AsString(); - Field* found = NULL; + ArtField* found = NULL; FieldHelper fh; - ObjectArray* fields = klass->GetIFields(); + ObjectArray* fields = klass->GetIFields(); for (int32_t i = 0; i < fields->GetLength() && found == NULL; ++i) { - Field* f = fields->Get(i); + ArtField* f = fields->Get(i); fh.ChangeField(f); if (name->Equals(fh.GetName())) { found = f; @@ -106,7 +107,7 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh, if (found == NULL) { fields = klass->GetSFields(); for (int32_t i = 0; i < fields->GetLength() && found == NULL; ++i) { - Field* f = fields->Get(i); + ArtField* f = fields->Get(i); fh.ChangeField(f); if (name->Equals(fh.GetName())) { found = f; @@ -118,7 +119,14 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh, << name->ToModifiedUtf8() << " class=" << PrettyDescriptor(klass); // TODO: getDeclaredField calls GetType once the field is found to ensure a // NoClassDefFoundError is thrown if the field's type cannot be resolved. - result->SetL(found); + Class* jlr_Field = self->DecodeJObject(WellKnownClasses::java_lang_reflect_Field)->AsClass(); + SirtRef field(self, jlr_Field->AllocObject(self)); + CHECK(field.get() != NULL); + ArtMethod* c = jlr_Field->FindDeclaredDirectMethod("", "(Ljava/lang/reflect/ArtField;)V"); + uint32_t args[1]; + args[0] = reinterpret_cast(found); + EnterInterpreterFromInvoke(self, c, field.get(), args, NULL); + result->SetL(field.get()); } else if (name == "void java.lang.System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)") { // Special case array copying without initializing System. Class* ctype = shadow_frame->GetVRegReference(arg_offset)->GetClass()->GetComponentType(); @@ -153,7 +161,7 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh, } // Hand select a number of methods to be run in a not yet started runtime without using JNI. -static void UnstartedRuntimeJni(Thread* self, AbstractMethod* method, +static void UnstartedRuntimeJni(Thread* self, ArtMethod* method, Object* receiver, uint32_t* args, JValue* result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { std::string name(PrettyMethod(method)); @@ -215,7 +223,7 @@ static void UnstartedRuntimeJni(Thread* self, AbstractMethod* method, } } -static void InterpreterJni(Thread* self, AbstractMethod* method, StringPiece shorty, +static void InterpreterJni(Thread* self, ArtMethod* method, StringPiece shorty, Object* receiver, uint32_t* args, JValue* result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { // TODO: The following enters JNI code using a typedef-ed function rather than the JNI compiler, @@ -417,8 +425,8 @@ static bool DoInvoke(Thread* self, ShadowFrame& shadow_frame, uint32_t method_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); uint32_t vregC = (is_range) ? inst->VRegC_3rc() : inst->VRegC_35c(); Object* receiver = (type == kStatic) ? NULL : shadow_frame.GetVRegReference(vregC); - AbstractMethod* method = FindMethodFromCode(method_idx, receiver, shadow_frame.GetMethod(), self, - do_access_check, type); + ArtMethod* method = FindMethodFromCode(method_idx, receiver, shadow_frame.GetMethod(), self, + do_access_check, type); if (UNLIKELY(method == NULL)) { CHECK(self->IsExceptionPending()); result->SetJ(0); @@ -438,7 +446,7 @@ static bool DoInvoke(Thread* self, ShadowFrame& shadow_frame, num_ins = code_item->ins_size_; } else { DCHECK(method->IsNative() || method->IsProxyMethod()); - num_regs = num_ins = AbstractMethod::NumArgRegisters(mh.GetShorty()); + num_regs = num_ins = ArtMethod::NumArgRegisters(mh.GetShorty()); if (!method->IsStatic()) { num_regs++; num_ins++; @@ -510,7 +518,7 @@ static bool DoInvokeVirtualQuick(Thread* self, ShadowFrame& shadow_frame, } uint32_t vtable_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); // TODO: use ObjectArray::GetWithoutChecks ? - AbstractMethod* method = receiver->GetClass()->GetVTable()->Get(vtable_idx); + ArtMethod* method = receiver->GetClass()->GetVTable()->Get(vtable_idx); if (UNLIKELY(method == NULL)) { CHECK(self->IsExceptionPending()); result->SetJ(0); @@ -530,7 +538,7 @@ static bool DoInvokeVirtualQuick(Thread* self, ShadowFrame& shadow_frame, num_ins = code_item->ins_size_; } else { DCHECK(method->IsNative() || method->IsProxyMethod()); - num_regs = num_ins = AbstractMethod::NumArgRegisters(mh.GetShorty()); + num_regs = num_ins = ArtMethod::NumArgRegisters(mh.GetShorty()); if (!method->IsStatic()) { num_regs++; num_ins++; @@ -601,9 +609,9 @@ static inline bool DoFieldGet(Thread* self, ShadowFrame& shadow_frame, const Instruction* inst) { bool is_static = (find_type == StaticObjectRead) || (find_type == StaticPrimitiveRead); uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c(); - Field* f = FindFieldFromCode(field_idx, shadow_frame.GetMethod(), self, - find_type, Primitive::FieldSize(field_type), - do_access_check); + ArtField* f = FindFieldFromCode(field_idx, shadow_frame.GetMethod(), self, + find_type, Primitive::FieldSize(field_type), + do_access_check); if (UNLIKELY(f == NULL)) { CHECK(self->IsExceptionPending()); return false; @@ -695,9 +703,9 @@ static inline bool DoFieldPut(Thread* self, const ShadowFrame& shadow_frame, const Instruction* inst) { bool is_static = (find_type == StaticObjectWrite) || (find_type == StaticPrimitiveWrite); uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c(); - Field* f = FindFieldFromCode(field_idx, shadow_frame.GetMethod(), self, - find_type, Primitive::FieldSize(field_type), - do_access_check); + ArtField* f = FindFieldFromCode(field_idx, shadow_frame.GetMethod(), self, + find_type, Primitive::FieldSize(field_type), + do_access_check); if (UNLIKELY(f == NULL)) { CHECK(self->IsExceptionPending()); return false; @@ -3052,7 +3060,7 @@ static inline JValue Execute(Thread* self, MethodHelper& mh, const DexFile::Code } } -void EnterInterpreterFromInvoke(Thread* self, AbstractMethod* method, Object* receiver, +void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, Object* receiver, uint32_t* args, JValue* result) { DCHECK_EQ(self, Thread::Current()); if (UNLIKELY(__builtin_frame_address(0) < self->GetStackEnd())) { @@ -3072,7 +3080,7 @@ void EnterInterpreterFromInvoke(Thread* self, AbstractMethod* method, Object* re return; } else { DCHECK(method->IsNative()); - num_regs = num_ins = AbstractMethod::NumArgRegisters(mh.GetShorty()); + num_regs = num_ins = ArtMethod::NumArgRegisters(mh.GetShorty()); if (!method->IsStatic()) { num_regs++; num_ins++; @@ -3172,7 +3180,7 @@ extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh return; } - AbstractMethod* method = shadow_frame->GetMethod(); + ArtMethod* method = shadow_frame->GetMethod(); if (method->IsStatic() && !method->GetDeclaringClass()->IsInitializing()) { if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(method->GetDeclaringClass(), true, true)) { diff --git a/runtime/interpreter/interpreter.h b/runtime/interpreter/interpreter.h index af4a1472ee..49e8de08ec 100644 --- a/runtime/interpreter/interpreter.h +++ b/runtime/interpreter/interpreter.h @@ -22,7 +22,7 @@ namespace art { namespace mirror { -class AbstractMethod; +class ArtMethod; class Object; } // namespace mirror @@ -33,8 +33,8 @@ class Thread; namespace interpreter { -// Called by AbstractMethod::Invoke, shadow frames arguments are taken from the args array. -extern void EnterInterpreterFromInvoke(Thread* self, mirror::AbstractMethod* method, +// Called by ArtMethod::Invoke, shadow frames arguments are taken from the args array. +extern void EnterInterpreterFromInvoke(Thread* self, mirror::ArtMethod* method, mirror::Object* receiver, uint32_t* args, JValue* result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/runtime/invoke_arg_array_builder.h b/runtime/invoke_arg_array_builder.h index 084d005e96..f615e8ebac 100644 --- a/runtime/invoke_arg_array_builder.h +++ b/runtime/invoke_arg_array_builder.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_INVOKE_ARG_ARRAY_BUILDER_H_ #define ART_RUNTIME_INVOKE_ARG_ARRAY_BUILDER_H_ -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "mirror/object.h" #include "scoped_thread_state_change.h" diff --git a/runtime/jdwp/jdwp.h b/runtime/jdwp/jdwp.h index 010a2079b4..a1657d098b 100644 --- a/runtime/jdwp/jdwp.h +++ b/runtime/jdwp/jdwp.h @@ -32,7 +32,7 @@ struct iovec; namespace art { namespace mirror { -class AbstractMethod; + class ArtMethod; } // namespace mirror class Thread; diff --git a/runtime/jdwp/object_registry.h b/runtime/jdwp/object_registry.h index 345f0ad73a..7f162ca80b 100644 --- a/runtime/jdwp/object_registry.h +++ b/runtime/jdwp/object_registry.h @@ -22,9 +22,9 @@ #include #include "jdwp/jdwp.h" +#include "mirror/art_field-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "safe_map.h" diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc index d1de6e6f5a..852dd00a77 100644 --- a/runtime/jni_internal.cc +++ b/runtime/jni_internal.cc @@ -32,10 +32,10 @@ #include "interpreter/interpreter.h" #include "invoke_arg_array_builder.h" #include "jni.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" -#include "mirror/field-inl.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/throwable.h" @@ -49,7 +49,8 @@ #include "UniquePtr.h" #include "well_known_classes.h" -using ::art::mirror::AbstractMethod; +using ::art::mirror::ArtField; +using ::art::mirror::ArtMethod; using ::art::mirror::Array; using ::art::mirror::BooleanArray; using ::art::mirror::ByteArray; @@ -57,7 +58,6 @@ using ::art::mirror::CharArray; using ::art::mirror::Class; using ::art::mirror::ClassLoader; using ::art::mirror::DoubleArray; -using ::art::mirror::Field; using ::art::mirror::FloatArray; using ::art::mirror::IntArray; using ::art::mirror::LongArray; @@ -101,7 +101,7 @@ static bool IsBadJniVersion(int version) { return version != JNI_VERSION_1_2 && version != JNI_VERSION_1_4 && version != JNI_VERSION_1_6; } -static void CheckMethodArguments(AbstractMethod* m, uint32_t* args) +static void CheckMethodArguments(ArtMethod* m, uint32_t* args) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { MethodHelper mh(m); const DexFile::TypeList* params = mh.GetParameterTypeList(); @@ -144,7 +144,7 @@ static void CheckMethodArguments(AbstractMethod* m, uint32_t* args) } } -void InvokeWithArgArray(const ScopedObjectAccess& soa, AbstractMethod* method, +void InvokeWithArgArray(const ScopedObjectAccess& soa, ArtMethod* method, ArgArray* arg_array, JValue* result, char result_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { uint32_t* args = arg_array->GetArray(); @@ -157,7 +157,7 @@ void InvokeWithArgArray(const ScopedObjectAccess& soa, AbstractMethod* method, static JValue InvokeWithVarArgs(const ScopedObjectAccess& soa, jobject obj, jmethodID mid, va_list args) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - AbstractMethod* method = soa.DecodeMethod(mid); + ArtMethod* method = soa.DecodeMethod(mid); Object* receiver = method->IsStatic() ? NULL : soa.Decode(obj); MethodHelper mh(method); JValue result; @@ -167,7 +167,7 @@ static JValue InvokeWithVarArgs(const ScopedObjectAccess& soa, jobject obj, return result; } -static AbstractMethod* FindVirtualMethod(Object* receiver, AbstractMethod* method) +static ArtMethod* FindVirtualMethod(Object* receiver, ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return receiver->GetClass()->FindVirtualMethodForVirtualOrInterface(method); } @@ -176,7 +176,7 @@ static JValue InvokeVirtualOrInterfaceWithJValues(const ScopedObjectAccess& soa, jobject obj, jmethodID mid, jvalue* args) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { Object* receiver = soa.Decode(obj); - AbstractMethod* method = FindVirtualMethod(receiver, soa.DecodeMethod(mid)); + ArtMethod* method = FindVirtualMethod(receiver, soa.DecodeMethod(mid)); MethodHelper mh(method); JValue result; ArgArray arg_array(mh.GetShorty(), mh.GetShortyLength()); @@ -189,7 +189,7 @@ static JValue InvokeVirtualOrInterfaceWithVarArgs(const ScopedObjectAccess& soa, jobject obj, jmethodID mid, va_list args) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { Object* receiver = soa.Decode(obj); - AbstractMethod* method = FindVirtualMethod(receiver, soa.DecodeMethod(mid)); + ArtMethod* method = FindVirtualMethod(receiver, soa.DecodeMethod(mid)); MethodHelper mh(method); JValue result; ArgArray arg_array(mh.GetShorty(), mh.GetShortyLength()); @@ -239,7 +239,7 @@ static jmethodID FindMethodID(ScopedObjectAccess& soa, jclass jni_class, return NULL; } - AbstractMethod* method = NULL; + ArtMethod* method = NULL; if (is_static) { method = c->FindDirectMethod(name, sig); } else { @@ -261,7 +261,7 @@ static jmethodID FindMethodID(ScopedObjectAccess& soa, jclass jni_class, static ClassLoader* GetClassLoader(const ScopedObjectAccess& soa) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - AbstractMethod* method = soa.Self()->GetCurrentMethod(NULL); + ArtMethod* method = soa.Self()->GetCurrentMethod(NULL); if (method == NULL || method == soa.DecodeMethod(WellKnownClasses::java_lang_Runtime_nativeLoad)) { return soa.Self()->GetClassLoaderOverride(); @@ -277,7 +277,7 @@ static jfieldID FindFieldID(const ScopedObjectAccess& soa, jclass jni_class, con return NULL; } - Field* field = NULL; + ArtField* field = NULL; Class* field_type; ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); if (sig[1] != '\0') { @@ -290,7 +290,7 @@ static jfieldID FindFieldID(const ScopedObjectAccess& soa, jclass jni_class, con // Failed to find type from the signature of the field. DCHECK(soa.Self()->IsExceptionPending()); ThrowLocation throw_location; - SirtRef cause(soa.Self(), soa.Self()->GetException(&throw_location)); + SirtRef cause(soa.Self(), soa.Self()->GetException(&throw_location)); soa.Self()->ClearException(); soa.Self()->ThrowNewExceptionF(throw_location, "Ljava/lang/NoSuchFieldError;", "no type \"%s\" found and so no field \"%s\" could be found in class " @@ -561,7 +561,7 @@ class Libraries { } // See section 11.3 "Linking Native Methods" of the JNI spec. - void* FindNativeMethod(const AbstractMethod* m, std::string& detail) + void* FindNativeMethod(const ArtMethod* m, std::string& detail) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { std::string jni_short_name(JniShortName(m)); std::string jni_long_name(JniLongName(m)); @@ -598,7 +598,7 @@ class Libraries { JValue InvokeWithJValues(const ScopedObjectAccess& soa, jobject obj, jmethodID mid, jvalue* args) { - AbstractMethod* method = soa.DecodeMethod(mid); + ArtMethod* method = soa.DecodeMethod(mid); Object* receiver = method->IsStatic() ? NULL : soa.Decode(obj); MethodHelper mh(method); JValue result; @@ -620,10 +620,10 @@ class JNI { } static jclass FindClass(JNIEnv* env, const char* name) { - ScopedObjectAccess soa(env); Runtime* runtime = Runtime::Current(); ClassLinker* class_linker = runtime->GetClassLinker(); std::string descriptor(NormalizeJniClassDescriptor(name)); + ScopedObjectAccess soa(env); Class* c = NULL; if (runtime->IsStarted()) { ClassLoader* cl = GetClassLoader(soa); @@ -636,26 +636,50 @@ class JNI { static jmethodID FromReflectedMethod(JNIEnv* env, jobject java_method) { ScopedObjectAccess soa(env); - AbstractMethod* method = soa.Decode(java_method); + jobject art_method = env->GetObjectField(java_method, + WellKnownClasses::java_lang_reflect_AbstractMethod_artMethod); + ArtMethod* method = soa.Decode(art_method); + DCHECK(method != NULL); return soa.EncodeMethod(method); } static jfieldID FromReflectedField(JNIEnv* env, jobject java_field) { ScopedObjectAccess soa(env); - Field* field = soa.Decode(java_field); + jobject art_field = env->GetObjectField(java_field, + WellKnownClasses::java_lang_reflect_Field_artField); + ArtField* field = soa.Decode(art_field); + DCHECK(field != NULL); return soa.EncodeField(field); } static jobject ToReflectedMethod(JNIEnv* env, jclass, jmethodID mid, jboolean) { ScopedObjectAccess soa(env); - AbstractMethod* method = soa.DecodeMethod(mid); - return soa.AddLocalReference(method); + ArtMethod* m = soa.DecodeMethod(mid); + jobject art_method = soa.AddLocalReference(m); + jobject reflect_method = env->AllocObject(WellKnownClasses::java_lang_reflect_Method); + if (env->ExceptionCheck()) { + return NULL; + } + SetObjectField(env, + reflect_method, + WellKnownClasses::java_lang_reflect_AbstractMethod_artMethod, + art_method); + return reflect_method; } static jobject ToReflectedField(JNIEnv* env, jclass, jfieldID fid, jboolean) { ScopedObjectAccess soa(env); - Field* field = soa.DecodeField(fid); - return soa.AddLocalReference(field); + ArtField* f = soa.DecodeField(fid); + jobject art_field = soa.AddLocalReference(f); + jobject reflect_field = env->AllocObject(WellKnownClasses::java_lang_reflect_Field); + if (env->ExceptionCheck()) { + return NULL; + } + SetObjectField(env, + reflect_field, + WellKnownClasses::java_lang_reflect_Field_artField, + art_field); + return reflect_field; } static jclass GetObjectClass(JNIEnv* env, jobject java_object) { @@ -678,7 +702,6 @@ class JNI { } static jboolean IsInstanceOf(JNIEnv* env, jobject jobj, jclass java_class) { - ScopedObjectAccess soa(env); if (java_class == NULL) { JniAbortF("IsInstanceOf", "null class (second argument)"); } @@ -686,6 +709,7 @@ class JNI { // Note: JNI is different from regular Java instanceof in this respect return JNI_TRUE; } else { + ScopedObjectAccess soa(env); Object* obj = soa.Decode(jobj); Class* c = soa.Decode(java_class); return obj->InstanceOf(c) ? JNI_TRUE : JNI_FALSE; @@ -718,13 +742,13 @@ class JNI { static void ExceptionDescribe(JNIEnv* env) { ScopedObjectAccess soa(env); - SirtRef old_throw_this_object(soa.Self(), NULL); - SirtRef old_throw_method(soa.Self(), NULL); - SirtRef old_exception(soa.Self(), NULL); + SirtRef old_throw_this_object(soa.Self(), NULL); + SirtRef old_throw_method(soa.Self(), NULL); + SirtRef old_exception(soa.Self(), NULL); uint32_t old_throw_dex_pc; { ThrowLocation old_throw_location; - mirror::Throwable* old_exception_obj = soa.Self()->GetException(&old_throw_location); + Throwable* old_exception_obj = soa.Self()->GetException(&old_throw_location); old_throw_this_object.reset(old_throw_location.GetThis()); old_throw_method.reset(old_throw_location.GetMethod()); old_exception.reset(old_exception_obj); @@ -855,8 +879,12 @@ class JNI { } static jboolean IsSameObject(JNIEnv* env, jobject obj1, jobject obj2) { - ScopedObjectAccess soa(env); - return (soa.Decode(obj1) == soa.Decode(obj2)) ? JNI_TRUE : JNI_FALSE; + if (obj1 == obj2) { + return JNI_TRUE; + } else { + ScopedObjectAccess soa(env); + return (soa.Decode(obj1) == soa.Decode(obj2)) ? JNI_TRUE : JNI_FALSE; + } } static jobject AllocObject(JNIEnv* env, jclass java_class) { @@ -1316,8 +1344,8 @@ class JNI { va_end(ap); } - static void CallNonvirtualVoidMethodV(JNIEnv* env, - jobject obj, jclass, jmethodID mid, va_list args) { + static void CallNonvirtualVoidMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, + va_list args) { ScopedObjectAccess soa(env); InvokeWithVarArgs(soa, obj, mid, args); } @@ -1342,13 +1370,13 @@ class JNI { static jobject GetObjectField(JNIEnv* env, jobject obj, jfieldID fid) { ScopedObjectAccess soa(env); Object* o = soa.Decode(obj); - Field* f = soa.DecodeField(fid); + ArtField* f = soa.DecodeField(fid); return soa.AddLocalReference(f->GetObject(o)); } static jobject GetStaticObjectField(JNIEnv* env, jclass, jfieldID fid) { ScopedObjectAccess soa(env); - Field* f = soa.DecodeField(fid); + ArtField* f = soa.DecodeField(fid); return soa.AddLocalReference(f->GetObject(f->GetDeclaringClass())); } @@ -1356,37 +1384,37 @@ class JNI { ScopedObjectAccess soa(env); Object* o = soa.Decode(java_object); Object* v = soa.Decode(java_value); - Field* f = soa.DecodeField(fid); + ArtField* f = soa.DecodeField(fid); f->SetObject(o, v); } static void SetStaticObjectField(JNIEnv* env, jclass, jfieldID fid, jobject java_value) { ScopedObjectAccess soa(env); Object* v = soa.Decode(java_value); - Field* f = soa.DecodeField(fid); + ArtField* f = soa.DecodeField(fid); f->SetObject(f->GetDeclaringClass(), v); } #define GET_PRIMITIVE_FIELD(fn, instance) \ ScopedObjectAccess soa(env); \ Object* o = soa.Decode(instance); \ - Field* f = soa.DecodeField(fid); \ + ArtField* f = soa.DecodeField(fid); \ return f->fn(o) #define GET_STATIC_PRIMITIVE_FIELD(fn) \ ScopedObjectAccess soa(env); \ - Field* f = soa.DecodeField(fid); \ + ArtField* f = soa.DecodeField(fid); \ return f->fn(f->GetDeclaringClass()) #define SET_PRIMITIVE_FIELD(fn, instance, value) \ ScopedObjectAccess soa(env); \ Object* o = soa.Decode(instance); \ - Field* f = soa.DecodeField(fid); \ + ArtField* f = soa.DecodeField(fid); \ f->fn(o, value) #define SET_STATIC_PRIMITIVE_FIELD(fn, value) \ ScopedObjectAccess soa(env); \ - Field* f = soa.DecodeField(fid); \ + ArtField* f = soa.DecodeField(fid); \ f->fn(f->GetDeclaringClass(), value) static jboolean GetBooleanField(JNIEnv* env, jobject obj, jfieldID fid) { @@ -1806,7 +1834,7 @@ class JNI { static jsize GetArrayLength(JNIEnv* env, jarray java_array) { ScopedObjectAccess soa(env); Object* obj = soa.Decode(java_array); - if (!obj->IsArrayInstance()) { + if (UNLIKELY(!obj->IsArrayInstance())) { JniAbortF("GetArrayLength", "not an array: %s", PrettyTypeOf(obj).c_str()); } Array* array = obj->AsArray(); @@ -1863,12 +1891,12 @@ class JNI { } static jobjectArray NewObjectArray(JNIEnv* env, jsize length, jclass element_jclass, jobject initial_element) { - ScopedObjectAccess soa(env); if (length < 0) { JniAbortF("NewObjectArray", "negative array length: %d", length); } // Compute the array class corresponding to the given element class. + ScopedObjectAccess soa(env); Class* element_class = soa.Decode(element_jclass); std::string descriptor; descriptor += "["; @@ -2080,7 +2108,7 @@ class JNI { ++sig; } - AbstractMethod* m = c->FindDirectMethod(name, sig); + ArtMethod* m = c->FindDirectMethod(name, sig); if (m == NULL) { m = c->FindVirtualMethod(name, sig); } @@ -2111,13 +2139,13 @@ class JNI { VLOG(jni) << "[Unregistering JNI native methods for " << PrettyClass(c) << "]"; for (size_t i = 0; i < c->NumDirectMethods(); ++i) { - AbstractMethod* m = c->GetDirectMethod(i); + ArtMethod* m = c->GetDirectMethod(i); if (m->IsNative()) { m->UnregisterNative(soa.Self()); } } for (size_t i = 0; i < c->NumVirtualMethods(); ++i) { - AbstractMethod* m = c->GetVirtualMethod(i); + ArtMethod* m = c->GetVirtualMethod(i); if (m->IsNative()) { m->UnregisterNative(soa.Self()); } @@ -2899,7 +2927,7 @@ bool JavaVMExt::LoadNativeLibrary(const std::string& path, ClassLoader* class_lo return was_successful; } -void* JavaVMExt::FindCodeForNativeMethod(AbstractMethod* m) { +void* JavaVMExt::FindCodeForNativeMethod(ArtMethod* m) { CHECK(m->IsNative()); Class* c = m->GetDeclaringClass(); diff --git a/runtime/jni_internal.h b/runtime/jni_internal.h index fcac4811c6..e3ffc8421b 100644 --- a/runtime/jni_internal.h +++ b/runtime/jni_internal.h @@ -38,10 +38,10 @@ namespace art { namespace mirror { -class AbstractMethod; -class ClassLoader; -class Field; -} + class ArtField; + class ArtMethod; + class ClassLoader; +} // namespace mirror class ArgArray; union JValue; class Libraries; @@ -55,7 +55,7 @@ void RegisterNativeMethods(JNIEnv* env, const char* jni_class_name, const JNINat JValue InvokeWithJValues(const ScopedObjectAccess&, jobject obj, jmethodID mid, jvalue* args) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); -void InvokeWithArgArray(const ScopedObjectAccess& soa, mirror::AbstractMethod* method, +void InvokeWithArgArray(const ScopedObjectAccess& soa, mirror::ArtMethod* method, ArgArray *arg_array, JValue* result, char result_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -79,7 +79,7 @@ struct JavaVMExt : public JavaVM { * Returns a pointer to the code for the native method 'm', found * using dlsym(3) on every native library that's been loaded so far. */ - void* FindCodeForNativeMethod(mirror::AbstractMethod* m) + void* FindCodeForNativeMethod(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void DumpForSigQuit(std::ostream& os); diff --git a/runtime/jni_internal_test.cc b/runtime/jni_internal_test.cc index c8b9eb95e3..234e40ac46 100644 --- a/runtime/jni_internal_test.cc +++ b/runtime/jni_internal_test.cc @@ -22,7 +22,7 @@ #include "common_test.h" #include "invoke_arg_array_builder.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" @@ -43,7 +43,8 @@ class JniInternalTest : public CommonTest { vm_->AttachCurrentThread(&env_, NULL); - ScopedLocalRef aioobe(env_, env_->FindClass("java/lang/ArrayIndexOutOfBoundsException")); + ScopedLocalRef aioobe(env_, + env_->FindClass("java/lang/ArrayIndexOutOfBoundsException")); CHECK(aioobe.get() != NULL); aioobe_ = reinterpret_cast(env_->NewGlobalRef(aioobe.get())); @@ -51,7 +52,8 @@ class JniInternalTest : public CommonTest { CHECK(ase.get() != NULL); ase_ = reinterpret_cast(env_->NewGlobalRef(ase.get())); - ScopedLocalRef sioobe(env_, env_->FindClass("java/lang/StringIndexOutOfBoundsException")); + ScopedLocalRef sioobe(env_, + env_->FindClass("java/lang/StringIndexOutOfBoundsException")); CHECK(sioobe.get() != NULL); sioobe_ = reinterpret_cast(env_->NewGlobalRef(sioobe.get())); } @@ -76,7 +78,7 @@ class JniInternalTest : public CommonTest { CommonTest::TearDown(); } - void DoCompile(mirror::AbstractMethod*& method, + void DoCompile(mirror::ArtMethod*& method, mirror::Object*& receiver, bool is_static, const char* method_name, const char* method_signature) @@ -95,7 +97,8 @@ class JniInternalTest : public CommonTest { CompileVirtualMethod(class_loader.get(), class_name, method_name, method_signature); } - mirror::Class* c = class_linker_->FindClass(DotToDescriptor(class_name).c_str(), class_loader.get()); + mirror::Class* c = class_linker_->FindClass(DotToDescriptor(class_name).c_str(), + class_loader.get()); CHECK(c != NULL); method = is_static ? c->FindDirectMethod(method_name, method_signature) @@ -111,7 +114,7 @@ class JniInternalTest : public CommonTest { } void InvokeNopMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "nop", "()V"); @@ -127,7 +130,7 @@ class JniInternalTest : public CommonTest { void InvokeIdentityByteMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "identity", "(I)I"); @@ -163,7 +166,7 @@ class JniInternalTest : public CommonTest { void InvokeIdentityIntMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "identity", "(I)I"); @@ -199,7 +202,7 @@ class JniInternalTest : public CommonTest { void InvokeIdentityDoubleMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "identity", "(D)D"); @@ -243,7 +246,7 @@ class JniInternalTest : public CommonTest { void InvokeSumIntIntMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(II)I"); @@ -289,7 +292,7 @@ class JniInternalTest : public CommonTest { void InvokeSumIntIntIntMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(III)I"); @@ -340,7 +343,7 @@ class JniInternalTest : public CommonTest { void InvokeSumIntIntIntIntMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(IIII)I"); @@ -396,7 +399,7 @@ class JniInternalTest : public CommonTest { void InvokeSumIntIntIntIntIntMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(IIIII)I"); @@ -457,7 +460,7 @@ class JniInternalTest : public CommonTest { void InvokeSumDoubleDoubleMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(DD)D"); @@ -523,7 +526,7 @@ class JniInternalTest : public CommonTest { void InvokeSumDoubleDoubleDoubleMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(DDD)D"); @@ -578,7 +581,7 @@ class JniInternalTest : public CommonTest { void InvokeSumDoubleDoubleDoubleDoubleMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(DDDD)D"); @@ -642,7 +645,7 @@ class JniInternalTest : public CommonTest { void InvokeSumDoubleDoubleDoubleDoubleDoubleMethod(bool is_static) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method; + mirror::ArtMethod* method; mirror::Object* receiver; DoCompile(method, receiver, is_static, "sum", "(DDDDD)D"); @@ -891,6 +894,11 @@ TEST_F(JniInternalTest, GetMethodID) { method = env_->GetMethodID(jlstring, "valueOf", "(I)Ljava/lang/String;"); EXPECT_EQ(static_cast(NULL), method); EXPECT_EXCEPTION(jlnsme); + + // Check that GetMethodID for java.lang.NoSuchMethodError.(String) finds the constructor + method = env_->GetMethodID(jlnsme, "", "(Ljava/lang/String;)V"); + EXPECT_NE(static_cast(NULL), method); + EXPECT_FALSE(env_->ExceptionCheck()); } TEST_F(JniInternalTest, GetStaticMethodID) { @@ -933,6 +941,9 @@ TEST_F(JniInternalTest, FromReflectedField_ToReflectedField) { // ...and back again. jfieldID fid2 = env_->FromReflectedField(field); ASSERT_TRUE(fid2 != NULL); + // Make sure we can actually use it. + jstring s = env_->NewStringUTF("poop"); + ASSERT_EQ(4, env_->GetIntField(s, fid2)); } TEST_F(JniInternalTest, FromReflectedMethod_ToReflectedMethod) { @@ -948,6 +959,13 @@ TEST_F(JniInternalTest, FromReflectedMethod_ToReflectedMethod) { // ...and back again. jmethodID mid2 = env_->FromReflectedMethod(method); ASSERT_TRUE(mid2 != NULL); + // Make sure we can actually use it. + jstring s = env_->NewStringUTF("poop"); + // TODO: this should return 4, but the runtime skips the method + // invoke because the runtime isn't started. In the future it would + // be nice to use interpretter for things like this. This still does + // validate that we have a sane jmethodID value. + ASSERT_EQ(0, env_->CallIntMethod(s, mid2)); } void BogusMethod() { @@ -986,7 +1004,13 @@ TEST_F(JniInternalTest, RegisterNatives) { env_->UnregisterNatives(jlobject); } -#define EXPECT_PRIMITIVE_ARRAY(new_fn, get_region_fn, set_region_fn, get_elements_fn, release_elements_fn, scalar_type, expected_class_descriptor) \ +#define EXPECT_PRIMITIVE_ARRAY(new_fn, \ + get_region_fn, \ + set_region_fn, \ + get_elements_fn, \ + release_elements_fn, \ + scalar_type, \ + expected_class_descriptor) \ jsize size = 4; \ /* Allocate an array and check it has the right type and length. */ \ scalar_type ## Array a = env_->new_fn(size); \ @@ -1017,47 +1041,60 @@ TEST_F(JniInternalTest, RegisterNatives) { env_->set_region_fn(a, 0, size, &src_buf[0]); \ /* Copy back only part. */ \ env_->get_region_fn(a, 1, size - 2, &dst_buf[1]); \ - EXPECT_NE(memcmp(&src_buf[0], &dst_buf[0], size * sizeof(scalar_type)), 0) << "short copy equal"; \ + EXPECT_NE(memcmp(&src_buf[0], &dst_buf[0], size * sizeof(scalar_type)), 0) \ + << "short copy equal"; \ /* Copy the missing pieces. */ \ env_->get_region_fn(a, 0, 1, &dst_buf[0]); \ env_->get_region_fn(a, size - 1, 1, &dst_buf[size - 1]); \ - EXPECT_EQ(memcmp(&src_buf[0], &dst_buf[0], size * sizeof(scalar_type)), 0) << "fixed copy not equal"; \ + EXPECT_EQ(memcmp(&src_buf[0], &dst_buf[0], size * sizeof(scalar_type)), 0) \ + << "fixed copy not equal"; \ /* Copy back the whole array. */ \ env_->get_region_fn(a, 0, size, &dst_buf[0]); \ - EXPECT_EQ(memcmp(&src_buf[0], &dst_buf[0], size * sizeof(scalar_type)), 0) << "full copy not equal"; \ + EXPECT_EQ(memcmp(&src_buf[0], &dst_buf[0], size * sizeof(scalar_type)), 0) \ + << "full copy not equal"; \ /* GetPrimitiveArrayCritical */ \ void* v = env_->GetPrimitiveArrayCritical(a, NULL); \ - EXPECT_EQ(memcmp(&src_buf[0], v, size * sizeof(scalar_type)), 0) << "GetPrimitiveArrayCritical not equal"; \ + EXPECT_EQ(memcmp(&src_buf[0], v, size * sizeof(scalar_type)), 0) \ + << "GetPrimitiveArrayCritical not equal"; \ env_->ReleasePrimitiveArrayCritical(a, v, 0); \ /* GetXArrayElements */ \ scalar_type* xs = env_->get_elements_fn(a, NULL); \ - EXPECT_EQ(memcmp(&src_buf[0], xs, size * sizeof(scalar_type)), 0) << # get_elements_fn " not equal"; \ + EXPECT_EQ(memcmp(&src_buf[0], xs, size * sizeof(scalar_type)), 0) \ + << # get_elements_fn " not equal"; \ env_->release_elements_fn(a, xs, 0); \ EXPECT_EQ(reinterpret_cast(v), reinterpret_cast(xs)) TEST_F(JniInternalTest, BooleanArrays) { - EXPECT_PRIMITIVE_ARRAY(NewBooleanArray, GetBooleanArrayRegion, SetBooleanArrayRegion, GetBooleanArrayElements, ReleaseBooleanArrayElements, jboolean, "[Z"); + EXPECT_PRIMITIVE_ARRAY(NewBooleanArray, GetBooleanArrayRegion, SetBooleanArrayRegion, + GetBooleanArrayElements, ReleaseBooleanArrayElements, jboolean, "[Z"); } TEST_F(JniInternalTest, ByteArrays) { - EXPECT_PRIMITIVE_ARRAY(NewByteArray, GetByteArrayRegion, SetByteArrayRegion, GetByteArrayElements, ReleaseByteArrayElements, jbyte, "[B"); + EXPECT_PRIMITIVE_ARRAY(NewByteArray, GetByteArrayRegion, SetByteArrayRegion, + GetByteArrayElements, ReleaseByteArrayElements, jbyte, "[B"); } TEST_F(JniInternalTest, CharArrays) { - EXPECT_PRIMITIVE_ARRAY(NewCharArray, GetCharArrayRegion, SetCharArrayRegion, GetCharArrayElements, ReleaseCharArrayElements, jchar, "[C"); + EXPECT_PRIMITIVE_ARRAY(NewCharArray, GetCharArrayRegion, SetCharArrayRegion, + GetCharArrayElements, ReleaseCharArrayElements, jchar, "[C"); } TEST_F(JniInternalTest, DoubleArrays) { - EXPECT_PRIMITIVE_ARRAY(NewDoubleArray, GetDoubleArrayRegion, SetDoubleArrayRegion, GetDoubleArrayElements, ReleaseDoubleArrayElements, jdouble, "[D"); + EXPECT_PRIMITIVE_ARRAY(NewDoubleArray, GetDoubleArrayRegion, SetDoubleArrayRegion, + GetDoubleArrayElements, ReleaseDoubleArrayElements, jdouble, "[D"); } TEST_F(JniInternalTest, FloatArrays) { - EXPECT_PRIMITIVE_ARRAY(NewFloatArray, GetFloatArrayRegion, SetFloatArrayRegion, GetFloatArrayElements, ReleaseFloatArrayElements, jfloat, "[F"); + EXPECT_PRIMITIVE_ARRAY(NewFloatArray, GetFloatArrayRegion, SetFloatArrayRegion, + GetFloatArrayElements, ReleaseFloatArrayElements, jfloat, "[F"); } TEST_F(JniInternalTest, IntArrays) { - EXPECT_PRIMITIVE_ARRAY(NewIntArray, GetIntArrayRegion, SetIntArrayRegion, GetIntArrayElements, ReleaseIntArrayElements, jint, "[I"); + EXPECT_PRIMITIVE_ARRAY(NewIntArray, GetIntArrayRegion, SetIntArrayRegion, + GetIntArrayElements, ReleaseIntArrayElements, jint, "[I"); } TEST_F(JniInternalTest, LongArrays) { - EXPECT_PRIMITIVE_ARRAY(NewLongArray, GetLongArrayRegion, SetLongArrayRegion, GetLongArrayElements, ReleaseLongArrayElements, jlong, "[J"); + EXPECT_PRIMITIVE_ARRAY(NewLongArray, GetLongArrayRegion, SetLongArrayRegion, + GetLongArrayElements, ReleaseLongArrayElements, jlong, "[J"); } TEST_F(JniInternalTest, ShortArrays) { - EXPECT_PRIMITIVE_ARRAY(NewShortArray, GetShortArrayRegion, SetShortArrayRegion, GetShortArrayElements, ReleaseShortArrayElements, jshort, "[S"); + EXPECT_PRIMITIVE_ARRAY(NewShortArray, GetShortArrayRegion, SetShortArrayRegion, + GetShortArrayElements, ReleaseShortArrayElements, jshort, "[S"); } TEST_F(JniInternalTest, NewObjectArray) { @@ -1437,7 +1474,8 @@ TEST_F(JniInternalTest, DeleteLocalRef) { CheckJniAbortCatcher check_jni_abort_catcher; env_->DeleteLocalRef(s); - std::string expected(StringPrintf("native code passing in reference to invalid local reference: %p", s)); + std::string expected(StringPrintf("native code passing in reference to " + "invalid local reference: %p", s)); check_jni_abort_catcher.Check(expected.c_str()); } @@ -1520,7 +1558,8 @@ TEST_F(JniInternalTest, DeleteGlobalRef) { CheckJniAbortCatcher check_jni_abort_catcher; env_->DeleteGlobalRef(o); - std::string expected(StringPrintf("native code passing in reference to invalid global reference: %p", o)); + std::string expected(StringPrintf("native code passing in reference to " + "invalid global reference: %p", o)); check_jni_abort_catcher.Check(expected.c_str()); } @@ -1564,7 +1603,8 @@ TEST_F(JniInternalTest, DeleteWeakGlobalRef) { CheckJniAbortCatcher check_jni_abort_catcher; env_->DeleteWeakGlobalRef(o); - std::string expected(StringPrintf("native code passing in reference to invalid weak global reference: %p", o)); + std::string expected(StringPrintf("native code passing in reference to " + "invalid weak global reference: %p", o)); check_jni_abort_catcher.Check(expected.c_str()); } @@ -1588,7 +1628,7 @@ TEST_F(JniInternalTest, StaticMainMethod) { mirror::Class* klass = class_linker_->FindClass("LMain;", class_loader.get()); ASSERT_TRUE(klass != NULL); - mirror::AbstractMethod* method = klass->FindDirectMethod("main", "([Ljava/lang/String;)V"); + mirror::ArtMethod* method = klass->FindDirectMethod("main", "([Ljava/lang/String;)V"); ASSERT_TRUE(method != NULL); ArgArray arg_array(NULL, 0); diff --git a/runtime/mirror/abstract_method-inl.h b/runtime/mirror/abstract_method-inl.h deleted file mode 100644 index d47b3ebccc..0000000000 --- a/runtime/mirror/abstract_method-inl.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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_MIRROR_ABSTRACT_METHOD_INL_H_ -#define ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_ - -#include "abstract_method.h" - -#include "dex_file.h" -#include "entrypoints/entrypoint_utils.h" -#include "object_array.h" -#include "runtime.h" - -namespace art { -namespace mirror { - -inline Class* AbstractMethod::GetDeclaringClass() const { - Class* result = GetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, declaring_class_), false); - DCHECK(result != NULL) << this; - DCHECK(result->IsIdxLoaded() || result->IsErroneous()) << this; - return result; -} - -inline void AbstractMethod::SetDeclaringClass(Class *new_declaring_class) { - SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, declaring_class_), new_declaring_class, false); -} - -inline uint32_t AbstractMethod::GetAccessFlags() const { - DCHECK(GetDeclaringClass()->IsIdxLoaded() || GetDeclaringClass()->IsErroneous()); - return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, access_flags_), false); -} - -inline uint16_t AbstractMethod::GetMethodIndex() const { - DCHECK(GetDeclaringClass()->IsResolved() || GetDeclaringClass()->IsErroneous()); - return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_), false); -} - -inline uint32_t AbstractMethod::GetDexMethodIndex() const { - DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); - return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_dex_index_), false); -} - -inline ObjectArray* AbstractMethod::GetDexCacheStrings() const { - return GetFieldObject*>( - OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_strings_), false); -} - -inline ObjectArray* AbstractMethod::GetDexCacheResolvedMethods() const { - return GetFieldObject*>( - OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_methods_), false); -} - -inline ObjectArray* AbstractMethod::GetDexCacheResolvedTypes() const { - return GetFieldObject*>( - OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_types_), false); -} - -inline ObjectArray* AbstractMethod::GetDexCacheInitializedStaticStorage() const { - return GetFieldObject*>( - OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_initialized_static_storage_), - false); -} - -inline uint32_t AbstractMethod::GetCodeSize() const { - DCHECK(!IsRuntimeMethod() && !IsProxyMethod()) << PrettyMethod(this); - uintptr_t code = reinterpret_cast(GetEntryPointFromCompiledCode()); - if (code == 0) { - return 0; - } - // TODO: make this Thumb2 specific - code &= ~0x1; - return reinterpret_cast(code)[-1]; -} - -inline bool AbstractMethod::CheckIncompatibleClassChange(InvokeType type) { - switch (type) { - case kStatic: - return !IsStatic(); - case kDirect: - return !IsDirect() || IsStatic(); - case kVirtual: { - Class* methods_class = GetDeclaringClass(); - return IsDirect() || (methods_class->IsInterface() && !IsMiranda()); - } - case kSuper: - return false; // TODO: appropriate checks for call to super class. - case kInterface: { - Class* methods_class = GetDeclaringClass(); - return IsDirect() || !(methods_class->IsInterface() || methods_class->IsObjectClass()); - } - default: - LOG(FATAL) << "Unreachable - invocation type: " << type; - return true; - } -} - -inline void AbstractMethod::AssertPcIsWithinCode(uintptr_t pc) const { - if (!kIsDebugBuild) { - return; - } - if (IsNative() || IsRuntimeMethod() || IsProxyMethod()) { - return; - } - if (pc == GetQuickInstrumentationExitPc()) { - return; - } - const void* code = GetEntryPointFromCompiledCode(); - if (code == GetCompiledCodeToInterpreterBridge() || code == GetQuickInstrumentationEntryPoint()) { - return; - } - ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); - if (code == GetResolutionTrampoline(class_linker)) { - return; - } - DCHECK(IsWithinCode(pc)) - << PrettyMethod(this) - << " pc=" << std::hex << pc - << " code=" << code - << " size=" << GetCodeSize(); -} - -inline uint32_t AbstractMethod::GetOatCodeOffset() const { - DCHECK(!Runtime::Current()->IsStarted()); - return reinterpret_cast(GetEntryPointFromCompiledCode()); -} - -inline void AbstractMethod::SetOatCodeOffset(uint32_t code_offset) { - DCHECK(!Runtime::Current()->IsStarted()); - SetEntryPointFromCompiledCode(reinterpret_cast(code_offset)); -} - -inline uint32_t AbstractMethod::GetOatMappingTableOffset() const { - DCHECK(!Runtime::Current()->IsStarted()); - return reinterpret_cast(GetMappingTable()); -} - -inline void AbstractMethod::SetOatMappingTableOffset(uint32_t mapping_table_offset) { - DCHECK(!Runtime::Current()->IsStarted()); - SetMappingTable(reinterpret_cast(mapping_table_offset)); -} - -inline uint32_t AbstractMethod::GetOatVmapTableOffset() const { - DCHECK(!Runtime::Current()->IsStarted()); - return reinterpret_cast(GetVmapTable()); -} - -inline void AbstractMethod::SetOatVmapTableOffset(uint32_t vmap_table_offset) { - DCHECK(!Runtime::Current()->IsStarted()); - SetVmapTable(reinterpret_cast(vmap_table_offset)); -} - -inline void AbstractMethod::SetOatNativeGcMapOffset(uint32_t gc_map_offset) { - DCHECK(!Runtime::Current()->IsStarted()); - SetNativeGcMap(reinterpret_cast(gc_map_offset)); -} - -inline uint32_t AbstractMethod::GetOatNativeGcMapOffset() const { - DCHECK(!Runtime::Current()->IsStarted()); - return reinterpret_cast(GetNativeGcMap()); -} - -inline bool AbstractMethod::IsRuntimeMethod() const { - return GetDexMethodIndex() == DexFile::kDexNoIndex16; -} - -inline bool AbstractMethod::IsCalleeSaveMethod() const { - if (!IsRuntimeMethod()) { - return false; - } - Runtime* runtime = Runtime::Current(); - bool result = false; - for (int i = 0; i < Runtime::kLastCalleeSaveType; i++) { - if (this == runtime->GetCalleeSaveMethod(Runtime::CalleeSaveType(i))) { - result = true; - break; - } - } - return result; -} - -inline bool AbstractMethod::IsResolutionMethod() const { - bool result = this == Runtime::Current()->GetResolutionMethod(); - // Check that if we do think it is phony it looks like the resolution method. - DCHECK(!result || IsRuntimeMethod()); - return result; -} -} // namespace mirror -} // namespace art - -#endif // ART_RUNTIME_MIRROR_ABSTRACT_METHOD_INL_H_ diff --git a/runtime/mirror/abstract_method.cc b/runtime/mirror/abstract_method.cc deleted file mode 100644 index b3db5c2721..0000000000 --- a/runtime/mirror/abstract_method.cc +++ /dev/null @@ -1,350 +0,0 @@ -/* - * 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 "abstract_method.h" - -#include "abstract_method-inl.h" -#include "base/stringpiece.h" -#include "class-inl.h" -#include "dex_file-inl.h" -#include "dex_instruction.h" -#include "gc/accounting/card_table-inl.h" -#include "interpreter/interpreter.h" -#include "jni_internal.h" -#include "mapping_table.h" -#include "object-inl.h" -#include "object_array.h" -#include "object_array-inl.h" -#include "string.h" -#include "object_utils.h" - -namespace art { -namespace mirror { - -extern "C" void art_portable_invoke_stub(AbstractMethod*, uint32_t*, uint32_t, Thread*, JValue*, char); -extern "C" void art_quick_invoke_stub(AbstractMethod*, uint32_t*, uint32_t, Thread*, JValue*, char); - -// TODO: get global references for these -Class* AbstractMethod::java_lang_reflect_Constructor_ = NULL; -Class* AbstractMethod::java_lang_reflect_Method_ = NULL; - -InvokeType AbstractMethod::GetInvokeType() const { - // TODO: kSuper? - if (GetDeclaringClass()->IsInterface()) { - return kInterface; - } else if (IsStatic()) { - return kStatic; - } else if (IsDirect()) { - return kDirect; - } else { - return kVirtual; - } -} - -void AbstractMethod::SetClasses(Class* java_lang_reflect_Constructor, Class* java_lang_reflect_Method) { - CHECK(java_lang_reflect_Constructor_ == NULL); - CHECK(java_lang_reflect_Constructor != NULL); - java_lang_reflect_Constructor_ = java_lang_reflect_Constructor; - - CHECK(java_lang_reflect_Method_ == NULL); - CHECK(java_lang_reflect_Method != NULL); - java_lang_reflect_Method_ = java_lang_reflect_Method; -} - -void AbstractMethod::ResetClasses() { - CHECK(java_lang_reflect_Constructor_ != NULL); - java_lang_reflect_Constructor_ = NULL; - - CHECK(java_lang_reflect_Method_ != NULL); - java_lang_reflect_Method_ = NULL; -} - -void AbstractMethod::SetDexCacheStrings(ObjectArray* new_dex_cache_strings) { - SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_strings_), - new_dex_cache_strings, false); -} - -void AbstractMethod::SetDexCacheResolvedMethods(ObjectArray* new_dex_cache_methods) { - SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_methods_), - new_dex_cache_methods, false); -} - -void AbstractMethod::SetDexCacheResolvedTypes(ObjectArray* new_dex_cache_classes) { - SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_types_), - new_dex_cache_classes, false); -} - -void AbstractMethod::SetDexCacheInitializedStaticStorage(ObjectArray* new_value) { - SetFieldObject(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_initialized_static_storage_), - new_value, false); -} - -size_t AbstractMethod::NumArgRegisters(const StringPiece& shorty) { - CHECK_LE(1, shorty.length()); - uint32_t num_registers = 0; - for (int i = 1; i < shorty.length(); ++i) { - char ch = shorty[i]; - if (ch == 'D' || ch == 'J') { - num_registers += 2; - } else { - num_registers += 1; - } - } - return num_registers; -} - -bool AbstractMethod::IsProxyMethod() const { - return GetDeclaringClass()->IsProxyClass(); -} - -AbstractMethod* AbstractMethod::FindOverriddenMethod() const { - if (IsStatic()) { - return NULL; - } - Class* declaring_class = GetDeclaringClass(); - Class* super_class = declaring_class->GetSuperClass(); - uint16_t method_index = GetMethodIndex(); - ObjectArray* super_class_vtable = super_class->GetVTable(); - AbstractMethod* result = NULL; - // Did this method override a super class method? If so load the result from the super class' - // vtable - if (super_class_vtable != NULL && method_index < super_class_vtable->GetLength()) { - result = super_class_vtable->Get(method_index); - } else { - // Method didn't override superclass method so search interfaces - if (IsProxyMethod()) { - result = GetDexCacheResolvedMethods()->Get(GetDexMethodIndex()); - CHECK_EQ(result, - Runtime::Current()->GetClassLinker()->FindMethodForProxy(GetDeclaringClass(), this)); - } else { - MethodHelper mh(this); - MethodHelper interface_mh; - IfTable* iftable = GetDeclaringClass()->GetIfTable(); - for (size_t i = 0; i < iftable->Count() && result == NULL; i++) { - Class* interface = iftable->GetInterface(i); - for (size_t j = 0; j < interface->NumVirtualMethods(); ++j) { - AbstractMethod* interface_method = interface->GetVirtualMethod(j); - interface_mh.ChangeMethod(interface_method); - if (mh.HasSameNameAndSignature(&interface_mh)) { - result = interface_method; - break; - } - } - } - } - } -#ifndef NDEBUG - MethodHelper result_mh(result); - DCHECK(result == NULL || MethodHelper(this).HasSameNameAndSignature(&result_mh)); -#endif - return result; -} - -uintptr_t AbstractMethod::NativePcOffset(const uintptr_t pc) const { - const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); - return pc - reinterpret_cast(code); -} - -uint32_t AbstractMethod::ToDexPc(const uintptr_t pc) const { -#if !defined(ART_USE_PORTABLE_COMPILER) - MappingTable table(GetMappingTable()); - if (table.TotalSize() == 0) { - DCHECK(IsNative() || IsCalleeSaveMethod() || IsProxyMethod()) << PrettyMethod(this); - return DexFile::kDexNoIndex; // Special no mapping case - } - const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); - uint32_t sought_offset = pc - reinterpret_cast(code); - // Assume the caller wants a pc-to-dex mapping so check here first. - typedef MappingTable::PcToDexIterator It; - for (It cur = table.PcToDexBegin(), end = table.PcToDexEnd(); cur != end; ++cur) { - if (cur.NativePcOffset() == sought_offset) { - return cur.DexPc(); - } - } - // Now check dex-to-pc mappings. - typedef MappingTable::DexToPcIterator It2; - for (It2 cur = table.DexToPcBegin(), end = table.DexToPcEnd(); cur != end; ++cur) { - if (cur.NativePcOffset() == sought_offset) { - return cur.DexPc(); - } - } - LOG(FATAL) << "Failed to find Dex offset for PC offset " << reinterpret_cast(sought_offset) - << "(PC " << reinterpret_cast(pc) << ", code=" << code - << ") in " << PrettyMethod(this); - return DexFile::kDexNoIndex; -#else - // Compiler LLVM doesn't use the machine pc, we just use dex pc instead. - return static_cast(pc); -#endif -} - -uintptr_t AbstractMethod::ToNativePc(const uint32_t dex_pc) const { - MappingTable table(GetMappingTable()); - if (table.TotalSize() == 0) { - DCHECK_EQ(dex_pc, 0U); - return 0; // Special no mapping/pc == 0 case - } - // Assume the caller wants a dex-to-pc mapping so check here first. - typedef MappingTable::DexToPcIterator It; - for (It cur = table.DexToPcBegin(), end = table.DexToPcEnd(); cur != end; ++cur) { - if (cur.DexPc() == dex_pc) { - const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); - return reinterpret_cast(code) + cur.NativePcOffset(); - } - } - // Now check pc-to-dex mappings. - typedef MappingTable::PcToDexIterator It2; - for (It2 cur = table.PcToDexBegin(), end = table.PcToDexEnd(); cur != end; ++cur) { - if (cur.DexPc() == dex_pc) { - const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); - return reinterpret_cast(code) + cur.NativePcOffset(); - } - } - LOG(FATAL) << "Failed to find native offset for dex pc 0x" << std::hex << dex_pc - << " in " << PrettyMethod(this); - return 0; -} - -uint32_t AbstractMethod::FindCatchBlock(Class* exception_type, uint32_t dex_pc, - bool* has_no_move_exception) const { - MethodHelper mh(this); - const DexFile::CodeItem* code_item = mh.GetCodeItem(); - // Default to handler not found. - uint32_t found_dex_pc = DexFile::kDexNoIndex; - // Iterate over the catch handlers associated with dex_pc. - for (CatchHandlerIterator it(*code_item, dex_pc); it.HasNext(); it.Next()) { - uint16_t iter_type_idx = it.GetHandlerTypeIndex(); - // Catch all case - if (iter_type_idx == DexFile::kDexNoIndex16) { - found_dex_pc = it.GetHandlerAddress(); - break; - } - // Does this catch exception type apply? - Class* iter_exception_type = mh.GetDexCacheResolvedType(iter_type_idx); - if (iter_exception_type == NULL) { - // The verifier should take care of resolving all exception classes early - LOG(WARNING) << "Unresolved exception class when finding catch block: " - << mh.GetTypeDescriptorFromTypeIdx(iter_type_idx); - } else if (iter_exception_type->IsAssignableFrom(exception_type)) { - found_dex_pc = it.GetHandlerAddress(); - break; - } - } - if (found_dex_pc != DexFile::kDexNoIndex) { - const Instruction* first_catch_instr = - Instruction::At(&mh.GetCodeItem()->insns_[found_dex_pc]); - *has_no_move_exception = (first_catch_instr->Opcode() != Instruction::MOVE_EXCEPTION); - } - return found_dex_pc; -} - -void AbstractMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result, - char result_type) { - if (kIsDebugBuild) { - self->AssertThreadSuspensionIsAllowable(); - CHECK_EQ(kRunnable, self->GetState()); - } - - // Push a transition back into managed code onto the linked list in thread. - ManagedStack fragment; - self->PushManagedStackFragment(&fragment); - - Runtime* runtime = Runtime::Current(); - // Call the invoke stub, passing everything as arguments. - if (UNLIKELY(!runtime->IsStarted())) { - LOG(INFO) << "Not invoking " << PrettyMethod(this) << " for a runtime that isn't started"; - if (result != NULL) { - result->SetJ(0); - } - } else { - const bool kLogInvocationStartAndReturn = false; - if (GetEntryPointFromCompiledCode() != NULL) { - if (kLogInvocationStartAndReturn) { - LOG(INFO) << StringPrintf("Invoking '%s' code=%p", PrettyMethod(this).c_str(), GetEntryPointFromCompiledCode()); - } -#ifdef ART_USE_PORTABLE_COMPILER - (*art_portable_invoke_stub)(this, args, args_size, self, result, result_type); -#else - (*art_quick_invoke_stub)(this, args, args_size, self, result, result_type); -#endif - if (UNLIKELY(reinterpret_cast(self->GetException(NULL)) == -1)) { - // Unusual case where we were running LLVM generated code and an - // exception was thrown to force the activations to be removed from the - // stack. Continue execution in the interpreter. - self->ClearException(); - ShadowFrame* shadow_frame = self->GetAndClearDeoptimizationShadowFrame(result); - self->SetTopOfStack(NULL, 0); - self->SetTopOfShadowStack(shadow_frame); - interpreter::EnterInterpreterFromDeoptimize(self, shadow_frame, result); - } - if (kLogInvocationStartAndReturn) { - LOG(INFO) << StringPrintf("Returned '%s' code=%p", PrettyMethod(this).c_str(), GetEntryPointFromCompiledCode()); - } - } else { - LOG(INFO) << "Not invoking '" << PrettyMethod(this) - << "' code=" << reinterpret_cast(GetEntryPointFromCompiledCode()); - if (result != NULL) { - result->SetJ(0); - } - } - } - - // Pop transition. - self->PopManagedStackFragment(fragment); -} - -bool AbstractMethod::IsRegistered() const { - void* native_method = GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, native_method_), false); - CHECK(native_method != NULL); - void* jni_stub = GetJniDlsymLookupStub(); - return native_method != jni_stub; -} - -extern "C" void art_work_around_app_jni_bugs(JNIEnv*, jobject); -void AbstractMethod::RegisterNative(Thread* self, const void* native_method) { - DCHECK(Thread::Current() == self); - CHECK(IsNative()) << PrettyMethod(this); - CHECK(native_method != NULL) << PrettyMethod(this); - if (!self->GetJniEnv()->vm->work_around_app_jni_bugs) { - SetNativeMethod(native_method); - } else { - // We've been asked to associate this method with the given native method but are working - // around JNI bugs, that include not giving Object** SIRT references to native methods. Direct - // the native method to runtime support and store the target somewhere runtime support will - // find it. -#if defined(__i386__) - UNIMPLEMENTED(FATAL); -#else - SetNativeMethod(reinterpret_cast(art_work_around_app_jni_bugs)); -#endif - SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, gc_map_), - reinterpret_cast(native_method), false); - } -} - -void AbstractMethod::UnregisterNative(Thread* self) { - CHECK(IsNative()) << PrettyMethod(this); - // restore stub to lookup native pointer via dlsym - RegisterNative(self, GetJniDlsymLookupStub()); -} - -void AbstractMethod::SetNativeMethod(const void* native_method) { - SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, native_method_), - native_method, false); -} - -} // namespace mirror -} // namespace art diff --git a/runtime/mirror/abstract_method.h b/runtime/mirror/abstract_method.h deleted file mode 100644 index 5b8c61cd06..0000000000 --- a/runtime/mirror/abstract_method.h +++ /dev/null @@ -1,471 +0,0 @@ -/* - * 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_MIRROR_ABSTRACT_METHOD_H_ -#define ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_ - -#include "class.h" -#include "dex_file.h" -#include "invoke_type.h" -#include "locks.h" -#include "modifiers.h" -#include "object.h" - -namespace art { - -struct AbstractMethodOffsets; -struct ConstructorMethodOffsets; -union JValue; -struct MethodClassOffsets; -class MethodHelper; -struct MethodOffsets; -class StringPiece; -class ShadowFrame; - -namespace mirror { - -class StaticStorageBase; - -typedef void (EntryPointFromInterpreter)(Thread* self, MethodHelper& mh, - const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); - -// C++ mirror of java.lang.reflect.Method and java.lang.reflect.Constructor -class MANAGED AbstractMethod : public Object { - public: - Class* GetDeclaringClass() const; - - void SetDeclaringClass(Class *new_declaring_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - static MemberOffset DeclaringClassOffset() { - return MemberOffset(OFFSETOF_MEMBER(AbstractMethod, declaring_class_)); - } - - static MemberOffset EntryPointFromCompiledCodeOffset() { - return MemberOffset(OFFSETOF_MEMBER(AbstractMethod, entry_point_from_compiled_code_)); - } - - uint32_t GetAccessFlags() const; - - void SetAccessFlags(uint32_t new_access_flags) { - SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, access_flags_), new_access_flags, false); - } - - // Approximate what kind of method call would be used for this method. - InvokeType GetInvokeType() const; - - // Returns true if the method is declared public. - bool IsPublic() const { - return (GetAccessFlags() & kAccPublic) != 0; - } - - // Returns true if the method is declared private. - bool IsPrivate() const { - return (GetAccessFlags() & kAccPrivate) != 0; - } - - // Returns true if the method is declared static. - bool IsStatic() const { - return (GetAccessFlags() & kAccStatic) != 0; - } - - // Returns true if the method is a constructor. - bool IsConstructor() const { - return (GetAccessFlags() & kAccConstructor) != 0; - } - - // Returns true if the method is static, private, or a constructor. - bool IsDirect() const { - return IsDirect(GetAccessFlags()); - } - - static bool IsDirect(uint32_t access_flags) { - return (access_flags & (kAccStatic | kAccPrivate | kAccConstructor)) != 0; - } - - // Returns true if the method is declared synchronized. - bool IsSynchronized() const { - uint32_t synchonized = kAccSynchronized | kAccDeclaredSynchronized; - return (GetAccessFlags() & synchonized) != 0; - } - - bool IsFinal() const { - return (GetAccessFlags() & kAccFinal) != 0; - } - - bool IsMiranda() const { - return (GetAccessFlags() & kAccMiranda) != 0; - } - - bool IsNative() const { - return (GetAccessFlags() & kAccNative) != 0; - } - - bool IsAbstract() const { - return (GetAccessFlags() & kAccAbstract) != 0; - } - - bool IsSynthetic() const { - return (GetAccessFlags() & kAccSynthetic) != 0; - } - - bool IsProxyMethod() const; - - bool IsPreverified() const { - return (GetAccessFlags() & kAccPreverified) != 0; - } - - void SetPreverified() { - SetAccessFlags(GetAccessFlags() | kAccPreverified); - } - - bool CheckIncompatibleClassChange(InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - uint16_t GetMethodIndex() const; - - size_t GetVtableIndex() const { - return GetMethodIndex(); - } - - void SetMethodIndex(uint16_t new_method_index) { - SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_), new_method_index, false); - } - - static MemberOffset MethodIndexOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_); - } - - uint32_t GetCodeItemOffset() const { - return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, code_item_offset_), false); - } - - void SetCodeItemOffset(uint32_t new_code_off) { - SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, code_item_offset_), new_code_off, false); - } - - // Number of 32bit registers that would be required to hold all the arguments - static size_t NumArgRegisters(const StringPiece& shorty); - - uint32_t GetDexMethodIndex() const; - - void SetDexMethodIndex(uint32_t new_idx) { - SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_dex_index_), new_idx, false); - } - - ObjectArray* GetDexCacheStrings() const; - void SetDexCacheStrings(ObjectArray* new_dex_cache_strings) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - static MemberOffset DexCacheStringsOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_strings_); - } - - static MemberOffset DexCacheResolvedMethodsOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_methods_); - } - - static MemberOffset DexCacheResolvedTypesOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, dex_cache_resolved_types_); - } - - static MemberOffset DexCacheInitializedStaticStorageOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, - dex_cache_initialized_static_storage_); - } - - ObjectArray* GetDexCacheResolvedMethods() const; - void SetDexCacheResolvedMethods(ObjectArray* new_dex_cache_methods) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - ObjectArray* GetDexCacheResolvedTypes() const; - void SetDexCacheResolvedTypes(ObjectArray* new_dex_cache_types) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - ObjectArray* GetDexCacheInitializedStaticStorage() const; - void SetDexCacheInitializedStaticStorage(ObjectArray* new_value) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - // Find the method that this method overrides - AbstractMethod* FindOverriddenMethod() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - void Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result, char result_type) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - EntryPointFromInterpreter* GetEntryPointFromInterpreter() const { - return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_interpreter_), false); - } - - void SetEntryPointFromInterpreter(EntryPointFromInterpreter* entry_point_from_interpreter) { - SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_interpreter_), entry_point_from_interpreter, false); - } - - const void* GetEntryPointFromCompiledCode() const { - return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_), false); - } - - void SetEntryPointFromCompiledCode(const void* entry_point_from_compiled_code) { - SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_), entry_point_from_compiled_code, false); - } - - uint32_t GetCodeSize() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - bool IsWithinCode(uintptr_t pc) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - uintptr_t code = reinterpret_cast(GetEntryPointFromCompiledCode()); - if (code == 0) { - return pc == 0; - } - /* - * During a stack walk, a return PC may point to the end of the code + 1 - * (in the case that the last instruction is a call that isn't expected to - * return. Thus, we check <= code + GetCodeSize(). - */ - return (code <= pc && pc <= code + GetCodeSize()); - } - - void AssertPcIsWithinCode(uintptr_t pc) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - uint32_t GetOatCodeOffset() const; - - void SetOatCodeOffset(uint32_t code_offset); - - static MemberOffset GetEntryPointFromCompiledCodeOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, entry_point_from_compiled_code_); - } - - // Callers should wrap the uint8_t* in a MappingTable instance for convenient access. - const uint8_t* GetMappingTable() const { - return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, mapping_table_), false); - } - - void SetMappingTable(const uint8_t* mapping_table) { - SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, mapping_table_), - mapping_table, false); - } - - uint32_t GetOatMappingTableOffset() const; - - void SetOatMappingTableOffset(uint32_t mapping_table_offset); - - // Callers should wrap the uint8_t* in a VmapTable instance for convenient access. - const uint8_t* GetVmapTable() const { - return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, vmap_table_), false); - } - - void SetVmapTable(const uint8_t* vmap_table) { - SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, vmap_table_), vmap_table, false); - } - - uint32_t GetOatVmapTableOffset() const; - - void SetOatVmapTableOffset(uint32_t vmap_table_offset); - - const uint8_t* GetNativeGcMap() const { - return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, gc_map_), false); - } - void SetNativeGcMap(const uint8_t* data) { - SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, gc_map_), data, false); - } - - // When building the oat need a convenient place to stuff the offset of the native GC map. - void SetOatNativeGcMapOffset(uint32_t gc_map_offset); - uint32_t GetOatNativeGcMapOffset() const; - - size_t GetFrameSizeInBytes() const { - DCHECK_EQ(sizeof(size_t), sizeof(uint32_t)); - size_t result = GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, frame_size_in_bytes_), false); - DCHECK_LE(static_cast(kStackAlignment), result); - return result; - } - - void SetFrameSizeInBytes(size_t new_frame_size_in_bytes) { - DCHECK_EQ(sizeof(size_t), sizeof(uint32_t)); - SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, frame_size_in_bytes_), - new_frame_size_in_bytes, false); - } - - size_t GetReturnPcOffsetInBytes() const { - return GetFrameSizeInBytes() - kPointerSize; - } - - size_t GetSirtOffsetInBytes() const { - CHECK(IsNative()); - return kPointerSize; - } - - bool IsRegistered() const; - - void RegisterNative(Thread* self, const void* native_method) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - void UnregisterNative(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - static MemberOffset NativeMethodOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, native_method_); - } - - const void* GetNativeMethod() const { - return reinterpret_cast(GetField32(NativeMethodOffset(), false)); - } - - void SetNativeMethod(const void*); - - static MemberOffset GetMethodIndexOffset() { - return OFFSET_OF_OBJECT_MEMBER(AbstractMethod, method_index_); - } - - uint32_t GetCoreSpillMask() const { - return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, core_spill_mask_), false); - } - - void SetCoreSpillMask(uint32_t core_spill_mask) { - // Computed during compilation - SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, core_spill_mask_), core_spill_mask, false); - } - - uint32_t GetFpSpillMask() const { - return GetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, fp_spill_mask_), false); - } - - void SetFpSpillMask(uint32_t fp_spill_mask) { - // Computed during compilation - SetField32(OFFSET_OF_OBJECT_MEMBER(AbstractMethod, fp_spill_mask_), fp_spill_mask, false); - } - - // Is this a CalleSaveMethod or ResolutionMethod and therefore doesn't adhere to normal - // conventions for a method of managed code. Returns false for Proxy methods. - bool IsRuntimeMethod() const; - - // Is this a hand crafted method used for something like describing callee saves? - bool IsCalleeSaveMethod() const; - - bool IsResolutionMethod() const; - - uintptr_t NativePcOffset(const uintptr_t pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - // Converts a native PC to a dex PC. - uint32_t ToDexPc(const uintptr_t pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - // Converts a dex PC to a native PC. - uintptr_t ToNativePc(const uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - // Find the catch block for the given exception type and dex_pc. When a catch block is found, - // indicates whether the found catch block is responsible for clearing the exception or whether - // a move-exception instruction is present. - uint32_t FindCatchBlock(Class* exception_type, uint32_t dex_pc, bool* has_no_move_exception) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - static void SetClasses(Class* java_lang_reflect_Constructor, Class* java_lang_reflect_Method); - - static Class* GetConstructorClass() { - return java_lang_reflect_Constructor_; - } - - static Class* GetMethodClass() { - return java_lang_reflect_Method_; - } - - static void ResetClasses(); - - protected: - // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses". - // The class we are a part of - Class* declaring_class_; - - // short cuts to declaring_class_->dex_cache_ member for fast compiled code access - ObjectArray* dex_cache_initialized_static_storage_; - - // short cuts to declaring_class_->dex_cache_ member for fast compiled code access - ObjectArray* dex_cache_resolved_methods_; - - // short cuts to declaring_class_->dex_cache_ member for fast compiled code access - ObjectArray* dex_cache_resolved_types_; - - // short cuts to declaring_class_->dex_cache_ member for fast compiled code access - ObjectArray* dex_cache_strings_; - - // Access flags; low 16 bits are defined by spec. - uint32_t access_flags_; - - // Offset to the CodeItem. - uint32_t code_item_offset_; - - // Architecture-dependent register spill mask - uint32_t core_spill_mask_; - - // Compiled code associated with this method for callers from managed code. - // May be compiled managed code or a bridge for invoking a native method. - // TODO: Break apart this into portable and quick. - const void* entry_point_from_compiled_code_; - - // Called by the interpreter to execute this method. - EntryPointFromInterpreter* entry_point_from_interpreter_; - - // Architecture-dependent register spill mask - uint32_t fp_spill_mask_; - - // Total size in bytes of the frame - size_t frame_size_in_bytes_; - - // Garbage collection map of native PC offsets (quick) or dex PCs (portable) to reference bitmaps. - const uint8_t* gc_map_; - - // Mapping from native pc to dex pc - const uint32_t* mapping_table_; - - // Index into method_ids of the dex file associated with this method - uint32_t method_dex_index_; - - // For concrete virtual methods, this is the offset of the method in Class::vtable_. - // - // For abstract methods in an interface class, this is the offset of the method in - // "iftable_->Get(n)->GetMethodArray()". - // - // For static and direct methods this is the index in the direct methods table. - uint32_t method_index_; - - // The target native method registered with this method - const void* native_method_; - - // When a register is promoted into a register, the spill mask holds which registers hold dex - // registers. The first promoted register's corresponding dex register is vmap_table_[1], the Nth - // is vmap_table_[N]. vmap_table_[0] holds the length of the table. - const uint16_t* vmap_table_; - - static Class* java_lang_reflect_Constructor_; - static Class* java_lang_reflect_Method_; - - friend struct art::AbstractMethodOffsets; // for verifying offset information - friend struct art::ConstructorMethodOffsets; // for verifying offset information - friend struct art::MethodOffsets; // for verifying offset information - DISALLOW_IMPLICIT_CONSTRUCTORS(AbstractMethod); -}; - -class MANAGED Method : public AbstractMethod {}; - -class MANAGED Constructor : public AbstractMethod {}; - -class MANAGED AbstractMethodClass : public Class { - private: - Object* ORDER_BY_SIGNATURE_; - friend struct art::MethodClassOffsets; // for verifying offset information - DISALLOW_IMPLICIT_CONSTRUCTORS(AbstractMethodClass); -}; - -} // namespace mirror -} // namespace art - -#endif // ART_RUNTIME_MIRROR_ABSTRACT_METHOD_H_ diff --git a/runtime/mirror/art_field-inl.h b/runtime/mirror/art_field-inl.h new file mode 100644 index 0000000000..d8c278c9ac --- /dev/null +++ b/runtime/mirror/art_field-inl.h @@ -0,0 +1,221 @@ +/* + * 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_MIRROR_ART_FIELD_INL_H_ +#define ART_RUNTIME_MIRROR_ART_FIELD_INL_H_ + +#include "art_field.h" + +#include "base/logging.h" +#include "gc/accounting/card_table-inl.h" +#include "jvalue.h" +#include "object-inl.h" +#include "object_utils.h" +#include "primitive.h" + +namespace art { +namespace mirror { + +inline Class* ArtField::GetDeclaringClass() const { + Class* result = GetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtField, declaring_class_), false); + DCHECK(result != NULL); + DCHECK(result->IsLoaded() || result->IsErroneous()); + return result; +} + +inline void ArtField::SetDeclaringClass(Class *new_declaring_class) { + SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtField, declaring_class_), new_declaring_class, false); +} + +inline uint32_t ArtField::GetAccessFlags() const { + DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, access_flags_), false); +} + +inline MemberOffset ArtField::GetOffset() const { + DCHECK(GetDeclaringClass()->IsResolved() || GetDeclaringClass()->IsErroneous()); + return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, offset_), false)); +} + +inline MemberOffset ArtField::GetOffsetDuringLinking() const { + DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); + return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, offset_), false)); +} + +inline uint32_t ArtField::Get32(const Object* object) const { + DCHECK(object != NULL) << PrettyField(this); + DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); + return object->GetField32(GetOffset(), IsVolatile()); +} + +inline void ArtField::Set32(Object* object, uint32_t new_value) const { + DCHECK(object != NULL) << PrettyField(this); + DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); + object->SetField32(GetOffset(), new_value, IsVolatile()); +} + +inline uint64_t ArtField::Get64(const Object* object) const { + DCHECK(object != NULL) << PrettyField(this); + DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); + return object->GetField64(GetOffset(), IsVolatile()); +} + +inline void ArtField::Set64(Object* object, uint64_t new_value) const { + DCHECK(object != NULL) << PrettyField(this); + DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); + object->SetField64(GetOffset(), new_value, IsVolatile()); +} + +inline Object* ArtField::GetObj(const Object* object) const { + DCHECK(object != NULL) << PrettyField(this); + DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); + return object->GetFieldObject(GetOffset(), IsVolatile()); +} + +inline void ArtField::SetObj(Object* object, const Object* new_value) const { + DCHECK(object != NULL) << PrettyField(this); + DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); + object->SetFieldObject(GetOffset(), new_value, IsVolatile()); +} + +inline bool ArtField::GetBoolean(const Object* object) const { + DCHECK_EQ(Primitive::kPrimBoolean, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + return Get32(object); +} + +inline void ArtField::SetBoolean(Object* object, bool z) const { + DCHECK_EQ(Primitive::kPrimBoolean, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + Set32(object, z); +} + +inline int8_t ArtField::GetByte(const Object* object) const { + DCHECK_EQ(Primitive::kPrimByte, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + return Get32(object); +} + +inline void ArtField::SetByte(Object* object, int8_t b) const { + DCHECK_EQ(Primitive::kPrimByte, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + Set32(object, b); +} + +inline uint16_t ArtField::GetChar(const Object* object) const { + DCHECK_EQ(Primitive::kPrimChar, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + return Get32(object); +} + +inline void ArtField::SetChar(Object* object, uint16_t c) const { + DCHECK_EQ(Primitive::kPrimChar, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + Set32(object, c); +} + +inline int16_t ArtField::GetShort(const Object* object) const { + DCHECK_EQ(Primitive::kPrimShort, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + return Get32(object); +} + +inline void ArtField::SetShort(Object* object, int16_t s) const { + DCHECK_EQ(Primitive::kPrimShort, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + Set32(object, s); +} + +inline int32_t ArtField::GetInt(const Object* object) const { +#ifndef NDEBUG + Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); + CHECK(type == Primitive::kPrimInt || type == Primitive::kPrimFloat) << PrettyField(this); +#endif + return Get32(object); +} + +inline void ArtField::SetInt(Object* object, int32_t i) const { +#ifndef NDEBUG + Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); + CHECK(type == Primitive::kPrimInt || type == Primitive::kPrimFloat) << PrettyField(this); +#endif + Set32(object, i); +} + +inline int64_t ArtField::GetLong(const Object* object) const { +#ifndef NDEBUG + Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); + CHECK(type == Primitive::kPrimLong || type == Primitive::kPrimDouble) << PrettyField(this); +#endif + return Get64(object); +} + +inline void ArtField::SetLong(Object* object, int64_t j) const { +#ifndef NDEBUG + Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); + CHECK(type == Primitive::kPrimLong || type == Primitive::kPrimDouble) << PrettyField(this); +#endif + Set64(object, j); +} + +inline float ArtField::GetFloat(const Object* object) const { + DCHECK_EQ(Primitive::kPrimFloat, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + JValue bits; + bits.SetI(Get32(object)); + return bits.GetF(); +} + +inline void ArtField::SetFloat(Object* object, float f) const { + DCHECK_EQ(Primitive::kPrimFloat, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + JValue bits; + bits.SetF(f); + Set32(object, bits.GetI()); +} + +inline double ArtField::GetDouble(const Object* object) const { + DCHECK_EQ(Primitive::kPrimDouble, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + JValue bits; + bits.SetJ(Get64(object)); + return bits.GetD(); +} + +inline void ArtField::SetDouble(Object* object, double d) const { + DCHECK_EQ(Primitive::kPrimDouble, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + JValue bits; + bits.SetD(d); + Set64(object, bits.GetJ()); +} + +inline Object* ArtField::GetObject(const Object* object) const { + DCHECK_EQ(Primitive::kPrimNot, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + return GetObj(object); +} + +inline void ArtField::SetObject(Object* object, const Object* l) const { + DCHECK_EQ(Primitive::kPrimNot, FieldHelper(this).GetTypeAsPrimitiveType()) + << PrettyField(this); + SetObj(object, l); +} + +} // namespace mirror +} // namespace art + +#endif // ART_RUNTIME_MIRROR_ART_FIELD_INL_H_ diff --git a/runtime/mirror/art_field.cc b/runtime/mirror/art_field.cc new file mode 100644 index 0000000000..a8bbe4bc6a --- /dev/null +++ b/runtime/mirror/art_field.cc @@ -0,0 +1,56 @@ +/* + * 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 "art_field.h" + +#include "art_field-inl.h" +#include "gc/accounting/card_table-inl.h" +#include "object-inl.h" +#include "object_utils.h" +#include "runtime.h" +#include "utils.h" + +namespace art { +namespace mirror { + +// TODO: get global references for these +Class* ArtField::java_lang_reflect_ArtField_ = NULL; + +void ArtField::SetClass(Class* java_lang_reflect_ArtField) { + CHECK(java_lang_reflect_ArtField_ == NULL); + CHECK(java_lang_reflect_ArtField != NULL); + java_lang_reflect_ArtField_ = java_lang_reflect_ArtField; +} + +void ArtField::ResetClass() { + CHECK(java_lang_reflect_ArtField_ != NULL); + java_lang_reflect_ArtField_ = NULL; +} + +void ArtField::SetOffset(MemberOffset num_bytes) { + DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); +#if 0 // TODO enable later in boot and under !NDEBUG + FieldHelper fh(this); + Primitive::Type type = fh.GetTypeAsPrimitiveType(); + if (type == Primitive::kPrimDouble || type == Primitive::kPrimLong) { + DCHECK_ALIGNED(num_bytes.Uint32Value(), 8); + } +#endif + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, offset_), num_bytes.Uint32Value(), false); +} + +} // namespace mirror +} // namespace art diff --git a/runtime/mirror/art_field.h b/runtime/mirror/art_field.h new file mode 100644 index 0000000000..ae34cb1f84 --- /dev/null +++ b/runtime/mirror/art_field.h @@ -0,0 +1,165 @@ +/* + * 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_MIRROR_ART_FIELD_H_ +#define ART_RUNTIME_MIRROR_ART_FIELD_H_ + +#include "class.h" +#include "modifiers.h" +#include "object.h" + +namespace art { + +struct ArtFieldOffsets; + +namespace mirror { + +// C++ mirror of java.lang.reflect.ArtField +class MANAGED ArtField : public Object { + public: + Class* GetDeclaringClass() const; + + void SetDeclaringClass(Class *new_declaring_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + uint32_t GetAccessFlags() const; + + void SetAccessFlags(uint32_t new_access_flags) { + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, access_flags_), new_access_flags, false); + } + + bool IsPublic() const { + return (GetAccessFlags() & kAccPublic) != 0; + } + + bool IsStatic() const { + return (GetAccessFlags() & kAccStatic) != 0; + } + + bool IsFinal() const { + return (GetAccessFlags() & kAccFinal) != 0; + } + + uint32_t GetDexFieldIndex() const { + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, field_dex_idx_), false); + } + + void SetDexFieldIndex(uint32_t new_idx) { + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtField, field_dex_idx_), new_idx, false); + } + + // Offset to field within an Object + MemberOffset GetOffset() const; + + static MemberOffset OffsetOffset() { + return MemberOffset(OFFSETOF_MEMBER(ArtField, offset_)); + } + + MemberOffset GetOffsetDuringLinking() const; + + void SetOffset(MemberOffset num_bytes); + + // field access, null object for static fields + bool GetBoolean(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetBoolean(Object* object, bool z) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + int8_t GetByte(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetByte(Object* object, int8_t b) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + uint16_t GetChar(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetChar(Object* object, uint16_t c) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + int16_t GetShort(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetShort(Object* object, int16_t s) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + int32_t GetInt(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetInt(Object* object, int32_t i) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + int64_t GetLong(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetLong(Object* object, int64_t j) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + float GetFloat(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetFloat(Object* object, float f) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + double GetDouble(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetDouble(Object* object, double d) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + Object* GetObject(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetObject(Object* object, const Object* l) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + // raw field accesses + uint32_t Get32(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void Set32(Object* object, uint32_t new_value) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + uint64_t Get64(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void Set64(Object* object, uint64_t new_value) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + Object* GetObj(const Object* object) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetObj(Object* object, const Object* new_value) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static Class* GetJavaLangReflectArtField() { + DCHECK(java_lang_reflect_ArtField_ != NULL); + return java_lang_reflect_ArtField_; + } + + static void SetClass(Class* java_lang_reflect_ArtField); + static void ResetClass(); + + bool IsVolatile() const { + return (GetAccessFlags() & kAccVolatile) != 0; + } + + private: + // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses". + // The class we are a part of + Class* declaring_class_; + + uint32_t access_flags_; + + // Dex cache index of field id + uint32_t field_dex_idx_; + + // Offset of field within an instance or in the Class' static fields + uint32_t offset_; + + static Class* java_lang_reflect_ArtField_; + + friend struct art::ArtFieldOffsets; // for verifying offset information + DISALLOW_IMPLICIT_CONSTRUCTORS(ArtField); +}; + +class MANAGED ArtFieldClass : public Class { + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(ArtFieldClass); +}; + +} // namespace mirror +} // namespace art + +#endif // ART_RUNTIME_MIRROR_ART_FIELD_H_ diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h new file mode 100644 index 0000000000..4d8aa6f741 --- /dev/null +++ b/runtime/mirror/art_method-inl.h @@ -0,0 +1,203 @@ +/* + * 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_MIRROR_ART_METHOD_INL_H_ +#define ART_RUNTIME_MIRROR_ART_METHOD_INL_H_ + +#include "art_method.h" + +#include "dex_file.h" +#include "entrypoints/entrypoint_utils.h" +#include "object_array.h" +#include "runtime.h" + +namespace art { +namespace mirror { + +inline Class* ArtMethod::GetDeclaringClass() const { + Class* result = GetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, declaring_class_), false); + DCHECK(result != NULL) << this; + DCHECK(result->IsIdxLoaded() || result->IsErroneous()) << this; + return result; +} + +inline void ArtMethod::SetDeclaringClass(Class *new_declaring_class) { + SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, declaring_class_), new_declaring_class, false); +} + +inline uint32_t ArtMethod::GetAccessFlags() const { + DCHECK(GetDeclaringClass()->IsIdxLoaded() || GetDeclaringClass()->IsErroneous()); + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, access_flags_), false); +} + +inline uint16_t ArtMethod::GetMethodIndex() const { + DCHECK(GetDeclaringClass()->IsResolved() || GetDeclaringClass()->IsErroneous()); + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_), false); +} + +inline uint32_t ArtMethod::GetDexMethodIndex() const { + DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_dex_index_), false); +} + +inline ObjectArray* ArtMethod::GetDexCacheStrings() const { + return GetFieldObject*>( + OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_), false); +} + +inline ObjectArray* ArtMethod::GetDexCacheResolvedMethods() const { + return GetFieldObject*>( + OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_), false); +} + +inline ObjectArray* ArtMethod::GetDexCacheResolvedTypes() const { + return GetFieldObject*>( + OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_), false); +} + +inline ObjectArray* ArtMethod::GetDexCacheInitializedStaticStorage() const { + return GetFieldObject*>( + OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_initialized_static_storage_), + false); +} + +inline uint32_t ArtMethod::GetCodeSize() const { + DCHECK(!IsRuntimeMethod() && !IsProxyMethod()) << PrettyMethod(this); + uintptr_t code = reinterpret_cast(GetEntryPointFromCompiledCode()); + if (code == 0) { + return 0; + } + // TODO: make this Thumb2 specific + code &= ~0x1; + return reinterpret_cast(code)[-1]; +} + +inline bool ArtMethod::CheckIncompatibleClassChange(InvokeType type) { + switch (type) { + case kStatic: + return !IsStatic(); + case kDirect: + return !IsDirect() || IsStatic(); + case kVirtual: { + Class* methods_class = GetDeclaringClass(); + return IsDirect() || (methods_class->IsInterface() && !IsMiranda()); + } + case kSuper: + return false; // TODO: appropriate checks for call to super class. + case kInterface: { + Class* methods_class = GetDeclaringClass(); + return IsDirect() || !(methods_class->IsInterface() || methods_class->IsObjectClass()); + } + default: + LOG(FATAL) << "Unreachable - invocation type: " << type; + return true; + } +} + +inline void ArtMethod::AssertPcIsWithinCode(uintptr_t pc) const { + if (!kIsDebugBuild) { + return; + } + if (IsNative() || IsRuntimeMethod() || IsProxyMethod()) { + return; + } + if (pc == GetQuickInstrumentationExitPc()) { + return; + } + const void* code = GetEntryPointFromCompiledCode(); + if (code == GetCompiledCodeToInterpreterBridge() || code == GetQuickInstrumentationEntryPoint()) { + return; + } + ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); + if (code == GetResolutionTrampoline(class_linker)) { + return; + } + DCHECK(IsWithinCode(pc)) + << PrettyMethod(this) + << " pc=" << std::hex << pc + << " code=" << code + << " size=" << GetCodeSize(); +} + +inline uint32_t ArtMethod::GetOatCodeOffset() const { + DCHECK(!Runtime::Current()->IsStarted()); + return reinterpret_cast(GetEntryPointFromCompiledCode()); +} + +inline void ArtMethod::SetOatCodeOffset(uint32_t code_offset) { + DCHECK(!Runtime::Current()->IsStarted()); + SetEntryPointFromCompiledCode(reinterpret_cast(code_offset)); +} + +inline uint32_t ArtMethod::GetOatMappingTableOffset() const { + DCHECK(!Runtime::Current()->IsStarted()); + return reinterpret_cast(GetMappingTable()); +} + +inline void ArtMethod::SetOatMappingTableOffset(uint32_t mapping_table_offset) { + DCHECK(!Runtime::Current()->IsStarted()); + SetMappingTable(reinterpret_cast(mapping_table_offset)); +} + +inline uint32_t ArtMethod::GetOatVmapTableOffset() const { + DCHECK(!Runtime::Current()->IsStarted()); + return reinterpret_cast(GetVmapTable()); +} + +inline void ArtMethod::SetOatVmapTableOffset(uint32_t vmap_table_offset) { + DCHECK(!Runtime::Current()->IsStarted()); + SetVmapTable(reinterpret_cast(vmap_table_offset)); +} + +inline void ArtMethod::SetOatNativeGcMapOffset(uint32_t gc_map_offset) { + DCHECK(!Runtime::Current()->IsStarted()); + SetNativeGcMap(reinterpret_cast(gc_map_offset)); +} + +inline uint32_t ArtMethod::GetOatNativeGcMapOffset() const { + DCHECK(!Runtime::Current()->IsStarted()); + return reinterpret_cast(GetNativeGcMap()); +} + +inline bool ArtMethod::IsRuntimeMethod() const { + return GetDexMethodIndex() == DexFile::kDexNoIndex16; +} + +inline bool ArtMethod::IsCalleeSaveMethod() const { + if (!IsRuntimeMethod()) { + return false; + } + Runtime* runtime = Runtime::Current(); + bool result = false; + for (int i = 0; i < Runtime::kLastCalleeSaveType; i++) { + if (this == runtime->GetCalleeSaveMethod(Runtime::CalleeSaveType(i))) { + result = true; + break; + } + } + return result; +} + +inline bool ArtMethod::IsResolutionMethod() const { + bool result = this == Runtime::Current()->GetResolutionMethod(); + // Check that if we do think it is phony it looks like the resolution method. + DCHECK(!result || IsRuntimeMethod()); + return result; +} +} // namespace mirror +} // namespace art + +#endif // ART_RUNTIME_MIRROR_ART_METHOD_INL_H_ diff --git a/runtime/mirror/art_method.cc b/runtime/mirror/art_method.cc new file mode 100644 index 0000000000..cd05f41cc2 --- /dev/null +++ b/runtime/mirror/art_method.cc @@ -0,0 +1,342 @@ +/* + * 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 "art_method.h" + +#include "art_method-inl.h" +#include "base/stringpiece.h" +#include "class-inl.h" +#include "dex_file-inl.h" +#include "dex_instruction.h" +#include "gc/accounting/card_table-inl.h" +#include "interpreter/interpreter.h" +#include "jni_internal.h" +#include "mapping_table.h" +#include "object-inl.h" +#include "object_array.h" +#include "object_array-inl.h" +#include "string.h" +#include "object_utils.h" + +namespace art { +namespace mirror { + +extern "C" void art_portable_invoke_stub(ArtMethod*, uint32_t*, uint32_t, Thread*, JValue*, char); +extern "C" void art_quick_invoke_stub(ArtMethod*, uint32_t*, uint32_t, Thread*, JValue*, char); + +// TODO: get global references for these +Class* ArtMethod::java_lang_reflect_ArtMethod_ = NULL; + +InvokeType ArtMethod::GetInvokeType() const { + // TODO: kSuper? + if (GetDeclaringClass()->IsInterface()) { + return kInterface; + } else if (IsStatic()) { + return kStatic; + } else if (IsDirect()) { + return kDirect; + } else { + return kVirtual; + } +} + +void ArtMethod::SetClass(Class* java_lang_reflect_ArtMethod) { + CHECK(java_lang_reflect_ArtMethod_ == NULL); + CHECK(java_lang_reflect_ArtMethod != NULL); + java_lang_reflect_ArtMethod_ = java_lang_reflect_ArtMethod; +} + +void ArtMethod::ResetClass() { + CHECK(java_lang_reflect_ArtMethod_ != NULL); + java_lang_reflect_ArtMethod_ = NULL; +} + +void ArtMethod::SetDexCacheStrings(ObjectArray* new_dex_cache_strings) { + SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_), + new_dex_cache_strings, false); +} + +void ArtMethod::SetDexCacheResolvedMethods(ObjectArray* new_dex_cache_methods) { + SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_), + new_dex_cache_methods, false); +} + +void ArtMethod::SetDexCacheResolvedTypes(ObjectArray* new_dex_cache_classes) { + SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_), + new_dex_cache_classes, false); +} + +void ArtMethod::SetDexCacheInitializedStaticStorage(ObjectArray* new_value) { + SetFieldObject(OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_initialized_static_storage_), + new_value, false); +} + +size_t ArtMethod::NumArgRegisters(const StringPiece& shorty) { + CHECK_LE(1, shorty.length()); + uint32_t num_registers = 0; + for (int i = 1; i < shorty.length(); ++i) { + char ch = shorty[i]; + if (ch == 'D' || ch == 'J') { + num_registers += 2; + } else { + num_registers += 1; + } + } + return num_registers; +} + +bool ArtMethod::IsProxyMethod() const { + return GetDeclaringClass()->IsProxyClass(); +} + +ArtMethod* ArtMethod::FindOverriddenMethod() const { + if (IsStatic()) { + return NULL; + } + Class* declaring_class = GetDeclaringClass(); + Class* super_class = declaring_class->GetSuperClass(); + uint16_t method_index = GetMethodIndex(); + ObjectArray* super_class_vtable = super_class->GetVTable(); + ArtMethod* result = NULL; + // Did this method override a super class method? If so load the result from the super class' + // vtable + if (super_class_vtable != NULL && method_index < super_class_vtable->GetLength()) { + result = super_class_vtable->Get(method_index); + } else { + // Method didn't override superclass method so search interfaces + if (IsProxyMethod()) { + result = GetDexCacheResolvedMethods()->Get(GetDexMethodIndex()); + CHECK_EQ(result, + Runtime::Current()->GetClassLinker()->FindMethodForProxy(GetDeclaringClass(), this)); + } else { + MethodHelper mh(this); + MethodHelper interface_mh; + IfTable* iftable = GetDeclaringClass()->GetIfTable(); + for (size_t i = 0; i < iftable->Count() && result == NULL; i++) { + Class* interface = iftable->GetInterface(i); + for (size_t j = 0; j < interface->NumVirtualMethods(); ++j) { + ArtMethod* interface_method = interface->GetVirtualMethod(j); + interface_mh.ChangeMethod(interface_method); + if (mh.HasSameNameAndSignature(&interface_mh)) { + result = interface_method; + break; + } + } + } + } + } +#ifndef NDEBUG + MethodHelper result_mh(result); + DCHECK(result == NULL || MethodHelper(this).HasSameNameAndSignature(&result_mh)); +#endif + return result; +} + +uintptr_t ArtMethod::NativePcOffset(const uintptr_t pc) const { + const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); + return pc - reinterpret_cast(code); +} + +uint32_t ArtMethod::ToDexPc(const uintptr_t pc) const { +#if !defined(ART_USE_PORTABLE_COMPILER) + MappingTable table(GetMappingTable()); + if (table.TotalSize() == 0) { + DCHECK(IsNative() || IsCalleeSaveMethod() || IsProxyMethod()) << PrettyMethod(this); + return DexFile::kDexNoIndex; // Special no mapping case + } + const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); + uint32_t sought_offset = pc - reinterpret_cast(code); + // Assume the caller wants a pc-to-dex mapping so check here first. + typedef MappingTable::PcToDexIterator It; + for (It cur = table.PcToDexBegin(), end = table.PcToDexEnd(); cur != end; ++cur) { + if (cur.NativePcOffset() == sought_offset) { + return cur.DexPc(); + } + } + // Now check dex-to-pc mappings. + typedef MappingTable::DexToPcIterator It2; + for (It2 cur = table.DexToPcBegin(), end = table.DexToPcEnd(); cur != end; ++cur) { + if (cur.NativePcOffset() == sought_offset) { + return cur.DexPc(); + } + } + LOG(FATAL) << "Failed to find Dex offset for PC offset " << reinterpret_cast(sought_offset) + << "(PC " << reinterpret_cast(pc) << ", code=" << code + << ") in " << PrettyMethod(this); + return DexFile::kDexNoIndex; +#else + // Compiler LLVM doesn't use the machine pc, we just use dex pc instead. + return static_cast(pc); +#endif +} + +uintptr_t ArtMethod::ToNativePc(const uint32_t dex_pc) const { + MappingTable table(GetMappingTable()); + if (table.TotalSize() == 0) { + DCHECK_EQ(dex_pc, 0U); + return 0; // Special no mapping/pc == 0 case + } + // Assume the caller wants a dex-to-pc mapping so check here first. + typedef MappingTable::DexToPcIterator It; + for (It cur = table.DexToPcBegin(), end = table.DexToPcEnd(); cur != end; ++cur) { + if (cur.DexPc() == dex_pc) { + const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); + return reinterpret_cast(code) + cur.NativePcOffset(); + } + } + // Now check pc-to-dex mappings. + typedef MappingTable::PcToDexIterator It2; + for (It2 cur = table.PcToDexBegin(), end = table.PcToDexEnd(); cur != end; ++cur) { + if (cur.DexPc() == dex_pc) { + const void* code = Runtime::Current()->GetInstrumentation()->GetQuickCodeFor(this); + return reinterpret_cast(code) + cur.NativePcOffset(); + } + } + LOG(FATAL) << "Failed to find native offset for dex pc 0x" << std::hex << dex_pc + << " in " << PrettyMethod(this); + return 0; +} + +uint32_t ArtMethod::FindCatchBlock(Class* exception_type, uint32_t dex_pc, + bool* has_no_move_exception) const { + MethodHelper mh(this); + const DexFile::CodeItem* code_item = mh.GetCodeItem(); + // Default to handler not found. + uint32_t found_dex_pc = DexFile::kDexNoIndex; + // Iterate over the catch handlers associated with dex_pc. + for (CatchHandlerIterator it(*code_item, dex_pc); it.HasNext(); it.Next()) { + uint16_t iter_type_idx = it.GetHandlerTypeIndex(); + // Catch all case + if (iter_type_idx == DexFile::kDexNoIndex16) { + found_dex_pc = it.GetHandlerAddress(); + break; + } + // Does this catch exception type apply? + Class* iter_exception_type = mh.GetDexCacheResolvedType(iter_type_idx); + if (iter_exception_type == NULL) { + // The verifier should take care of resolving all exception classes early + LOG(WARNING) << "Unresolved exception class when finding catch block: " + << mh.GetTypeDescriptorFromTypeIdx(iter_type_idx); + } else if (iter_exception_type->IsAssignableFrom(exception_type)) { + found_dex_pc = it.GetHandlerAddress(); + break; + } + } + if (found_dex_pc != DexFile::kDexNoIndex) { + const Instruction* first_catch_instr = + Instruction::At(&mh.GetCodeItem()->insns_[found_dex_pc]); + *has_no_move_exception = (first_catch_instr->Opcode() != Instruction::MOVE_EXCEPTION); + } + return found_dex_pc; +} + +void ArtMethod::Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result, + char result_type) { + if (kIsDebugBuild) { + self->AssertThreadSuspensionIsAllowable(); + CHECK_EQ(kRunnable, self->GetState()); + } + + // Push a transition back into managed code onto the linked list in thread. + ManagedStack fragment; + self->PushManagedStackFragment(&fragment); + + Runtime* runtime = Runtime::Current(); + // Call the invoke stub, passing everything as arguments. + if (UNLIKELY(!runtime->IsStarted())) { + LOG(INFO) << "Not invoking " << PrettyMethod(this) << " for a runtime that isn't started"; + if (result != NULL) { + result->SetJ(0); + } + } else { + const bool kLogInvocationStartAndReturn = false; + if (GetEntryPointFromCompiledCode() != NULL) { + if (kLogInvocationStartAndReturn) { + LOG(INFO) << StringPrintf("Invoking '%s' code=%p", PrettyMethod(this).c_str(), GetEntryPointFromCompiledCode()); + } +#ifdef ART_USE_PORTABLE_COMPILER + (*art_portable_invoke_stub)(this, args, args_size, self, result, result_type); +#else + (*art_quick_invoke_stub)(this, args, args_size, self, result, result_type); +#endif + if (UNLIKELY(reinterpret_cast(self->GetException(NULL)) == -1)) { + // Unusual case where we were running LLVM generated code and an + // exception was thrown to force the activations to be removed from the + // stack. Continue execution in the interpreter. + self->ClearException(); + ShadowFrame* shadow_frame = self->GetAndClearDeoptimizationShadowFrame(result); + self->SetTopOfStack(NULL, 0); + self->SetTopOfShadowStack(shadow_frame); + interpreter::EnterInterpreterFromDeoptimize(self, shadow_frame, result); + } + if (kLogInvocationStartAndReturn) { + LOG(INFO) << StringPrintf("Returned '%s' code=%p", PrettyMethod(this).c_str(), GetEntryPointFromCompiledCode()); + } + } else { + LOG(INFO) << "Not invoking '" << PrettyMethod(this) + << "' code=" << reinterpret_cast(GetEntryPointFromCompiledCode()); + if (result != NULL) { + result->SetJ(0); + } + } + } + + // Pop transition. + self->PopManagedStackFragment(fragment); +} + +bool ArtMethod::IsRegistered() const { + void* native_method = GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, native_method_), false); + CHECK(native_method != NULL); + void* jni_stub = GetJniDlsymLookupStub(); + return native_method != jni_stub; +} + +extern "C" void art_work_around_app_jni_bugs(JNIEnv*, jobject); +void ArtMethod::RegisterNative(Thread* self, const void* native_method) { + DCHECK(Thread::Current() == self); + CHECK(IsNative()) << PrettyMethod(this); + CHECK(native_method != NULL) << PrettyMethod(this); + if (!self->GetJniEnv()->vm->work_around_app_jni_bugs) { + SetNativeMethod(native_method); + } else { + // We've been asked to associate this method with the given native method but are working + // around JNI bugs, that include not giving Object** SIRT references to native methods. Direct + // the native method to runtime support and store the target somewhere runtime support will + // find it. +#if defined(__i386__) + UNIMPLEMENTED(FATAL); +#else + SetNativeMethod(reinterpret_cast(art_work_around_app_jni_bugs)); +#endif + SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_), + reinterpret_cast(native_method), false); + } +} + +void ArtMethod::UnregisterNative(Thread* self) { + CHECK(IsNative()) << PrettyMethod(this); + // restore stub to lookup native pointer via dlsym + RegisterNative(self, GetJniDlsymLookupStub()); +} + +void ArtMethod::SetNativeMethod(const void* native_method) { + SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, native_method_), + native_method, false); +} + +} // namespace mirror +} // namespace art diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h new file mode 100644 index 0000000000..7301f23747 --- /dev/null +++ b/runtime/mirror/art_method.h @@ -0,0 +1,457 @@ +/* + * 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_MIRROR_ART_METHOD_H_ +#define ART_RUNTIME_MIRROR_ART_METHOD_H_ + +#include "class.h" +#include "dex_file.h" +#include "invoke_type.h" +#include "locks.h" +#include "modifiers.h" +#include "object.h" + +namespace art { + +struct ArtMethodOffsets; +struct ConstructorMethodOffsets; +union JValue; +struct MethodClassOffsets; +class MethodHelper; +class StringPiece; +class ShadowFrame; + +namespace mirror { + +class StaticStorageBase; + +typedef void (EntryPointFromInterpreter)(Thread* self, MethodHelper& mh, + const DexFile::CodeItem* code_item, ShadowFrame* shadow_frame, JValue* result); + +// C++ mirror of java.lang.reflect.Method and java.lang.reflect.Constructor +class MANAGED ArtMethod : public Object { + public: + Class* GetDeclaringClass() const; + + void SetDeclaringClass(Class *new_declaring_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static MemberOffset DeclaringClassOffset() { + return MemberOffset(OFFSETOF_MEMBER(ArtMethod, declaring_class_)); + } + + static MemberOffset EntryPointFromCompiledCodeOffset() { + return MemberOffset(OFFSETOF_MEMBER(ArtMethod, entry_point_from_compiled_code_)); + } + + uint32_t GetAccessFlags() const; + + void SetAccessFlags(uint32_t new_access_flags) { + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, access_flags_), new_access_flags, false); + } + + // Approximate what kind of method call would be used for this method. + InvokeType GetInvokeType() const; + + // Returns true if the method is declared public. + bool IsPublic() const { + return (GetAccessFlags() & kAccPublic) != 0; + } + + // Returns true if the method is declared private. + bool IsPrivate() const { + return (GetAccessFlags() & kAccPrivate) != 0; + } + + // Returns true if the method is declared static. + bool IsStatic() const { + return (GetAccessFlags() & kAccStatic) != 0; + } + + // Returns true if the method is a constructor. + bool IsConstructor() const { + return (GetAccessFlags() & kAccConstructor) != 0; + } + + // Returns true if the method is static, private, or a constructor. + bool IsDirect() const { + return IsDirect(GetAccessFlags()); + } + + static bool IsDirect(uint32_t access_flags) { + return (access_flags & (kAccStatic | kAccPrivate | kAccConstructor)) != 0; + } + + // Returns true if the method is declared synchronized. + bool IsSynchronized() const { + uint32_t synchonized = kAccSynchronized | kAccDeclaredSynchronized; + return (GetAccessFlags() & synchonized) != 0; + } + + bool IsFinal() const { + return (GetAccessFlags() & kAccFinal) != 0; + } + + bool IsMiranda() const { + return (GetAccessFlags() & kAccMiranda) != 0; + } + + bool IsNative() const { + return (GetAccessFlags() & kAccNative) != 0; + } + + bool IsAbstract() const { + return (GetAccessFlags() & kAccAbstract) != 0; + } + + bool IsSynthetic() const { + return (GetAccessFlags() & kAccSynthetic) != 0; + } + + bool IsProxyMethod() const; + + bool IsPreverified() const { + return (GetAccessFlags() & kAccPreverified) != 0; + } + + void SetPreverified() { + SetAccessFlags(GetAccessFlags() | kAccPreverified); + } + + bool CheckIncompatibleClassChange(InvokeType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + uint16_t GetMethodIndex() const; + + size_t GetVtableIndex() const { + return GetMethodIndex(); + } + + void SetMethodIndex(uint16_t new_method_index) { + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_), new_method_index, false); + } + + static MemberOffset MethodIndexOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_); + } + + uint32_t GetCodeItemOffset() const { + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, code_item_offset_), false); + } + + void SetCodeItemOffset(uint32_t new_code_off) { + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, code_item_offset_), new_code_off, false); + } + + // Number of 32bit registers that would be required to hold all the arguments + static size_t NumArgRegisters(const StringPiece& shorty); + + uint32_t GetDexMethodIndex() const; + + void SetDexMethodIndex(uint32_t new_idx) { + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_dex_index_), new_idx, false); + } + + ObjectArray* GetDexCacheStrings() const; + void SetDexCacheStrings(ObjectArray* new_dex_cache_strings) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static MemberOffset DexCacheStringsOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_strings_); + } + + static MemberOffset DexCacheResolvedMethodsOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_methods_); + } + + static MemberOffset DexCacheResolvedTypesOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, dex_cache_resolved_types_); + } + + static MemberOffset DexCacheInitializedStaticStorageOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, + dex_cache_initialized_static_storage_); + } + + ObjectArray* GetDexCacheResolvedMethods() const; + void SetDexCacheResolvedMethods(ObjectArray* new_dex_cache_methods) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + ObjectArray* GetDexCacheResolvedTypes() const; + void SetDexCacheResolvedTypes(ObjectArray* new_dex_cache_types) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + ObjectArray* GetDexCacheInitializedStaticStorage() const; + void SetDexCacheInitializedStaticStorage(ObjectArray* new_value) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + // Find the method that this method overrides + ArtMethod* FindOverriddenMethod() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + void Invoke(Thread* self, uint32_t* args, uint32_t args_size, JValue* result, char result_type) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + EntryPointFromInterpreter* GetEntryPointFromInterpreter() const { + return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_interpreter_), false); + } + + void SetEntryPointFromInterpreter(EntryPointFromInterpreter* entry_point_from_interpreter) { + SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_interpreter_), entry_point_from_interpreter, false); + } + + const void* GetEntryPointFromCompiledCode() const { + return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_compiled_code_), false); + } + + void SetEntryPointFromCompiledCode(const void* entry_point_from_compiled_code) { + SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_compiled_code_), entry_point_from_compiled_code, false); + } + + uint32_t GetCodeSize() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + bool IsWithinCode(uintptr_t pc) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + uintptr_t code = reinterpret_cast(GetEntryPointFromCompiledCode()); + if (code == 0) { + return pc == 0; + } + /* + * During a stack walk, a return PC may point to the end of the code + 1 + * (in the case that the last instruction is a call that isn't expected to + * return. Thus, we check <= code + GetCodeSize(). + */ + return (code <= pc && pc <= code + GetCodeSize()); + } + + void AssertPcIsWithinCode(uintptr_t pc) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + uint32_t GetOatCodeOffset() const; + + void SetOatCodeOffset(uint32_t code_offset); + + static MemberOffset GetEntryPointFromCompiledCodeOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, entry_point_from_compiled_code_); + } + + // Callers should wrap the uint8_t* in a MappingTable instance for convenient access. + const uint8_t* GetMappingTable() const { + return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, mapping_table_), false); + } + + void SetMappingTable(const uint8_t* mapping_table) { + SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, mapping_table_), + mapping_table, false); + } + + uint32_t GetOatMappingTableOffset() const; + + void SetOatMappingTableOffset(uint32_t mapping_table_offset); + + // Callers should wrap the uint8_t* in a VmapTable instance for convenient access. + const uint8_t* GetVmapTable() const { + return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, vmap_table_), false); + } + + void SetVmapTable(const uint8_t* vmap_table) { + SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, vmap_table_), vmap_table, false); + } + + uint32_t GetOatVmapTableOffset() const; + + void SetOatVmapTableOffset(uint32_t vmap_table_offset); + + const uint8_t* GetNativeGcMap() const { + return GetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_), false); + } + void SetNativeGcMap(const uint8_t* data) { + SetFieldPtr(OFFSET_OF_OBJECT_MEMBER(ArtMethod, gc_map_), data, false); + } + + // When building the oat need a convenient place to stuff the offset of the native GC map. + void SetOatNativeGcMapOffset(uint32_t gc_map_offset); + uint32_t GetOatNativeGcMapOffset() const; + + size_t GetFrameSizeInBytes() const { + DCHECK_EQ(sizeof(size_t), sizeof(uint32_t)); + size_t result = GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, frame_size_in_bytes_), false); + DCHECK_LE(static_cast(kStackAlignment), result); + return result; + } + + void SetFrameSizeInBytes(size_t new_frame_size_in_bytes) { + DCHECK_EQ(sizeof(size_t), sizeof(uint32_t)); + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, frame_size_in_bytes_), + new_frame_size_in_bytes, false); + } + + size_t GetReturnPcOffsetInBytes() const { + return GetFrameSizeInBytes() - kPointerSize; + } + + size_t GetSirtOffsetInBytes() const { + CHECK(IsNative()); + return kPointerSize; + } + + bool IsRegistered() const; + + void RegisterNative(Thread* self, const void* native_method) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + void UnregisterNative(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static MemberOffset NativeMethodOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, native_method_); + } + + const void* GetNativeMethod() const { + return reinterpret_cast(GetField32(NativeMethodOffset(), false)); + } + + void SetNativeMethod(const void*); + + static MemberOffset GetMethodIndexOffset() { + return OFFSET_OF_OBJECT_MEMBER(ArtMethod, method_index_); + } + + uint32_t GetCoreSpillMask() const { + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, core_spill_mask_), false); + } + + void SetCoreSpillMask(uint32_t core_spill_mask) { + // Computed during compilation + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, core_spill_mask_), core_spill_mask, false); + } + + uint32_t GetFpSpillMask() const { + return GetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, fp_spill_mask_), false); + } + + void SetFpSpillMask(uint32_t fp_spill_mask) { + // Computed during compilation + SetField32(OFFSET_OF_OBJECT_MEMBER(ArtMethod, fp_spill_mask_), fp_spill_mask, false); + } + + // Is this a CalleSaveMethod or ResolutionMethod and therefore doesn't adhere to normal + // conventions for a method of managed code. Returns false for Proxy methods. + bool IsRuntimeMethod() const; + + // Is this a hand crafted method used for something like describing callee saves? + bool IsCalleeSaveMethod() const; + + bool IsResolutionMethod() const; + + uintptr_t NativePcOffset(const uintptr_t pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + // Converts a native PC to a dex PC. + uint32_t ToDexPc(const uintptr_t pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + // Converts a dex PC to a native PC. + uintptr_t ToNativePc(const uint32_t dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + // Find the catch block for the given exception type and dex_pc. When a catch block is found, + // indicates whether the found catch block is responsible for clearing the exception or whether + // a move-exception instruction is present. + uint32_t FindCatchBlock(Class* exception_type, uint32_t dex_pc, bool* has_no_move_exception) const + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + + static void SetClass(Class* java_lang_reflect_ArtMethod); + + static Class* GetJavaLangReflectArtMethod() { + return java_lang_reflect_ArtMethod_; + } + + static void ResetClass(); + + protected: + // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses". + // The class we are a part of + Class* declaring_class_; + + // short cuts to declaring_class_->dex_cache_ member for fast compiled code access + ObjectArray* dex_cache_initialized_static_storage_; + + // short cuts to declaring_class_->dex_cache_ member for fast compiled code access + ObjectArray* dex_cache_resolved_methods_; + + // short cuts to declaring_class_->dex_cache_ member for fast compiled code access + ObjectArray* dex_cache_resolved_types_; + + // short cuts to declaring_class_->dex_cache_ member for fast compiled code access + ObjectArray* dex_cache_strings_; + + // Access flags; low 16 bits are defined by spec. + uint32_t access_flags_; + + // Offset to the CodeItem. + uint32_t code_item_offset_; + + // Architecture-dependent register spill mask + uint32_t core_spill_mask_; + + // Compiled code associated with this method for callers from managed code. + // May be compiled managed code or a bridge for invoking a native method. + // TODO: Break apart this into portable and quick. + const void* entry_point_from_compiled_code_; + + // Called by the interpreter to execute this method. + EntryPointFromInterpreter* entry_point_from_interpreter_; + + // Architecture-dependent register spill mask + uint32_t fp_spill_mask_; + + // Total size in bytes of the frame + size_t frame_size_in_bytes_; + + // Garbage collection map of native PC offsets (quick) or dex PCs (portable) to reference bitmaps. + const uint8_t* gc_map_; + + // Mapping from native pc to dex pc + const uint32_t* mapping_table_; + + // Index into method_ids of the dex file associated with this method + uint32_t method_dex_index_; + + // For concrete virtual methods, this is the offset of the method in Class::vtable_. + // + // For abstract methods in an interface class, this is the offset of the method in + // "iftable_->Get(n)->GetMethodArray()". + // + // For static and direct methods this is the index in the direct methods table. + uint32_t method_index_; + + // The target native method registered with this method + const void* native_method_; + + // When a register is promoted into a register, the spill mask holds which registers hold dex + // registers. The first promoted register's corresponding dex register is vmap_table_[1], the Nth + // is vmap_table_[N]. vmap_table_[0] holds the length of the table. + const uint16_t* vmap_table_; + + static Class* java_lang_reflect_ArtMethod_; + + friend struct art::ArtMethodOffsets; // for verifying offset information + DISALLOW_IMPLICIT_CONSTRUCTORS(ArtMethod); +}; + +class MANAGED ArtMethodClass : public Class { + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(ArtMethodClass); +}; + +} // namespace mirror +} // namespace art + +#endif // ART_RUNTIME_MIRROR_ART_METHOD_H_ diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h index 52906a2650..1e1138745d 100644 --- a/runtime/mirror/class-inl.h +++ b/runtime/mirror/class-inl.h @@ -19,10 +19,10 @@ #include "class.h" -#include "abstract_method.h" +#include "art_field.h" +#include "art_method.h" #include "class_loader.h" #include "dex_cache.h" -#include "field.h" #include "iftable.h" #include "object_array-inl.h" #include "runtime.h" @@ -54,30 +54,30 @@ inline DexCache* Class::GetDexCache() const { return GetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_), false); } -inline ObjectArray* Class::GetDirectMethods() const { +inline ObjectArray* Class::GetDirectMethods() const { DCHECK(IsLoaded() || IsErroneous()); - return GetFieldObject*>( + return GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), false); } -inline void Class::SetDirectMethods(ObjectArray* new_direct_methods) +inline void Class::SetDirectMethods(ObjectArray* new_direct_methods) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - DCHECK(NULL == GetFieldObject*>( + DCHECK(NULL == GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), false)); DCHECK_NE(0, new_direct_methods->GetLength()); SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), new_direct_methods, false); } -inline AbstractMethod* Class::GetDirectMethod(int32_t i) const +inline ArtMethod* Class::GetDirectMethod(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return GetDirectMethods()->Get(i); } -inline void Class::SetDirectMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t +inline void Class::SetDirectMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - ObjectArray* direct_methods = - GetFieldObject*>( + ObjectArray* direct_methods = + GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_), false); direct_methods->Set(i, f); } @@ -87,13 +87,13 @@ inline size_t Class::NumDirectMethods() const { return (GetDirectMethods() != NULL) ? GetDirectMethods()->GetLength() : 0; } -inline ObjectArray* Class::GetVirtualMethods() const { +inline ObjectArray* Class::GetVirtualMethods() const { DCHECK(IsLoaded() || IsErroneous()); - return GetFieldObject*>( + return GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_), false); } -inline void Class::SetVirtualMethods(ObjectArray* new_virtual_methods) { +inline void Class::SetVirtualMethods(ObjectArray* new_virtual_methods) { // TODO: we reassign virtual methods to grow the table for miranda // methods.. they should really just be assigned once DCHECK_NE(0, new_virtual_methods->GetLength()); @@ -105,37 +105,37 @@ inline size_t Class::NumVirtualMethods() const { return (GetVirtualMethods() != NULL) ? GetVirtualMethods()->GetLength() : 0; } -inline AbstractMethod* Class::GetVirtualMethod(uint32_t i) const +inline ArtMethod* Class::GetVirtualMethod(uint32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(IsResolved() || IsErroneous()); return GetVirtualMethods()->Get(i); } -inline AbstractMethod* Class::GetVirtualMethodDuringLinking(uint32_t i) const +inline ArtMethod* Class::GetVirtualMethodDuringLinking(uint32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(IsLoaded() || IsErroneous()); return GetVirtualMethods()->Get(i); } -inline void Class::SetVirtualMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t +inline void Class::SetVirtualMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - ObjectArray* virtual_methods = - GetFieldObject*>( + ObjectArray* virtual_methods = + GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_), false); virtual_methods->Set(i, f); } -inline ObjectArray* Class::GetVTable() const { +inline ObjectArray* Class::GetVTable() const { DCHECK(IsResolved() || IsErroneous()); - return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false); + return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false); } -inline ObjectArray* Class::GetVTableDuringLinking() const { +inline ObjectArray* Class::GetVTableDuringLinking() const { DCHECK(IsLoaded() || IsErroneous()); - return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false); + return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), false); } -inline void Class::SetVTable(ObjectArray* new_vtable) +inline void Class::SetVTable(ObjectArray* new_vtable) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, vtable_), new_vtable, false); } @@ -208,7 +208,7 @@ inline bool Class::IsSubClass(const Class* klass) const { return false; } -inline AbstractMethod* Class::FindVirtualMethodForInterface(AbstractMethod* method) const { +inline ArtMethod* Class::FindVirtualMethodForInterface(ArtMethod* method) const { Class* declaring_class = method->GetDeclaringClass(); DCHECK(declaring_class != NULL) << PrettyClass(this); DCHECK(declaring_class->IsInterface()) << PrettyMethod(method); @@ -223,7 +223,7 @@ inline AbstractMethod* Class::FindVirtualMethodForInterface(AbstractMethod* meth return NULL; } -inline AbstractMethod* Class::FindVirtualMethodForVirtual(AbstractMethod* method) const +inline ArtMethod* Class::FindVirtualMethodForVirtual(ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(!method->GetDeclaringClass()->IsInterface() || method->IsMiranda()); // The argument method may from a super class. @@ -231,13 +231,13 @@ inline AbstractMethod* Class::FindVirtualMethodForVirtual(AbstractMethod* method return GetVTable()->Get(method->GetMethodIndex()); } -inline AbstractMethod* Class::FindVirtualMethodForSuper(AbstractMethod* method) const +inline ArtMethod* Class::FindVirtualMethodForSuper(ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(!method->GetDeclaringClass()->IsInterface()); return GetSuperClass()->GetVTable()->Get(method->GetMethodIndex()); } -inline AbstractMethod* Class::FindVirtualMethodForVirtualOrInterface(AbstractMethod* method) const { +inline ArtMethod* Class::FindVirtualMethodForVirtualOrInterface(ArtMethod* method) const { if (method->IsDirect()) { return method; } @@ -263,26 +263,26 @@ inline void Class::SetIfTable(IfTable* new_iftable) { SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, iftable_), new_iftable, false); } -inline ObjectArray* Class::GetIFields() const { +inline ObjectArray* Class::GetIFields() const { DCHECK(IsLoaded() || IsErroneous()); - return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false); + return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false); } -inline void Class::SetIFields(ObjectArray* new_ifields) +inline void Class::SetIFields(ObjectArray* new_ifields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - DCHECK(NULL == GetFieldObject*>( + DCHECK(NULL == GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false)); SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, ifields_), new_ifields, false); } -inline ObjectArray* Class::GetSFields() const { +inline ObjectArray* Class::GetSFields() const { DCHECK(IsLoaded() || IsErroneous()); - return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false); + return GetFieldObject*>(OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false); } -inline void Class::SetSFields(ObjectArray* new_sfields) +inline void Class::SetSFields(ObjectArray* new_sfields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - DCHECK(NULL == GetFieldObject*>( + DCHECK(NULL == GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false)); SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, sfields_), new_sfields, false); } @@ -291,14 +291,14 @@ inline size_t Class::NumStaticFields() const { return (GetSFields() != NULL) ? GetSFields()->GetLength() : 0; } -inline Field* Class::GetStaticField(uint32_t i) const // TODO: uint16_t +inline ArtField* Class::GetStaticField(uint32_t i) const // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return GetSFields()->Get(i); } -inline void Class::SetStaticField(uint32_t i, Field* f) // TODO: uint16_t +inline void Class::SetStaticField(uint32_t i, ArtField* f) // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - ObjectArray* sfields= GetFieldObject*>( + ObjectArray* sfields= GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, sfields_), false); sfields->Set(i, f); } @@ -307,15 +307,15 @@ inline size_t Class::NumInstanceFields() const { return (GetIFields() != NULL) ? GetIFields()->GetLength() : 0; } -inline Field* Class::GetInstanceField(uint32_t i) const // TODO: uint16_t +inline ArtField* Class::GetInstanceField(uint32_t i) const // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK_NE(NumInstanceFields(), 0U); return GetIFields()->Get(i); } -inline void Class::SetInstanceField(uint32_t i, Field* f) // TODO: uint16_t +inline void Class::SetInstanceField(uint32_t i, ArtField* f) // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - ObjectArray* ifields= GetFieldObject*>( + ObjectArray* ifields= GetFieldObject*>( OFFSET_OF_OBJECT_MEMBER(Class, ifields_), false); ifields->Set(i, f); } @@ -330,9 +330,8 @@ inline uint32_t Class::GetAccessFlags() const { // circularity issue during loading the names of its members DCHECK(IsLoaded() || IsErroneous() || this == String::GetJavaLangString() || - this == Field::GetJavaLangReflectField() || - this == AbstractMethod::GetConstructorClass() || - this == AbstractMethod::GetMethodClass()); + this == ArtField::GetJavaLangReflectArtField() || + this == ArtMethod::GetJavaLangReflectArtMethod()); return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), false); } diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc index e490d97f80..29025f26c8 100644 --- a/runtime/mirror/class.cc +++ b/runtime/mirror/class.cc @@ -16,13 +16,13 @@ #include "class.h" -#include "abstract_method-inl.h" +#include "art_field-inl.h" +#include "art_method-inl.h" #include "class-inl.h" #include "class_linker.h" #include "class_loader.h" #include "dex_cache.h" #include "dex_file-inl.h" -#include "field-inl.h" #include "gc/accounting/card_table-inl.h" #include "object-inl.h" #include "object_array-inl.h" @@ -63,7 +63,7 @@ void Class::SetStatus(Status new_status) { // Stash current exception. Thread* self = Thread::Current(); SirtRef old_throw_this_object(self, NULL); - SirtRef old_throw_method(self, NULL); + SirtRef old_throw_method(self, NULL); SirtRef old_exception(self, NULL); uint32_t old_throw_dex_pc; { @@ -316,24 +316,23 @@ bool Class::IsThrowableClass() const { return WellKnownClasses::ToClass(WellKnownClasses::java_lang_Throwable)->IsAssignableFrom(this); } -bool Class::IsFieldClass() const { +bool Class::IsArtFieldClass() const { Class* java_lang_Class = GetClass(); - Class* java_lang_reflect_Field = java_lang_Class->GetInstanceField(0)->GetClass(); - return this == java_lang_reflect_Field; + Class* java_lang_reflect_ArtField = java_lang_Class->GetInstanceField(0)->GetClass(); + return this == java_lang_reflect_ArtField; } -bool Class::IsMethodClass() const { - return (this == AbstractMethod::GetMethodClass()) || - (this == AbstractMethod::GetConstructorClass()); +bool Class::IsArtMethodClass() const { + return this == ArtMethod::GetJavaLangReflectArtMethod(); } void Class::SetClassLoader(ClassLoader* new_class_loader) { SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, class_loader_), new_class_loader, false); } -AbstractMethod* Class::FindInterfaceMethod(const StringPiece& name, const StringPiece& signature) const { +ArtMethod* Class::FindInterfaceMethod(const StringPiece& name, const StringPiece& signature) const { // Check the current class before checking the interfaces. - AbstractMethod* method = FindDeclaredVirtualMethod(name, signature); + ArtMethod* method = FindDeclaredVirtualMethod(name, signature); if (method != NULL) { return method; } @@ -349,9 +348,9 @@ AbstractMethod* Class::FindInterfaceMethod(const StringPiece& name, const String return NULL; } -AbstractMethod* Class::FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { +ArtMethod* Class::FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { // Check the current class before checking the interfaces. - AbstractMethod* method = FindDeclaredVirtualMethod(dex_cache, dex_method_idx); + ArtMethod* method = FindDeclaredVirtualMethod(dex_cache, dex_method_idx); if (method != NULL) { return method; } @@ -368,10 +367,10 @@ AbstractMethod* Class::FindInterfaceMethod(const DexCache* dex_cache, uint32_t d } -AbstractMethod* Class::FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const { +ArtMethod* Class::FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const { MethodHelper mh; for (size_t i = 0; i < NumDirectMethods(); ++i) { - AbstractMethod* method = GetDirectMethod(i); + ArtMethod* method = GetDirectMethod(i); mh.ChangeMethod(method); if (name == mh.GetName() && signature == mh.GetSignature()) { return method; @@ -380,10 +379,10 @@ AbstractMethod* Class::FindDeclaredDirectMethod(const StringPiece& name, const S return NULL; } -AbstractMethod* Class::FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { +ArtMethod* Class::FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { if (GetDexCache() == dex_cache) { for (size_t i = 0; i < NumDirectMethods(); ++i) { - AbstractMethod* method = GetDirectMethod(i); + ArtMethod* method = GetDirectMethod(i); if (method->GetDexMethodIndex() == dex_method_idx) { return method; } @@ -392,9 +391,9 @@ AbstractMethod* Class::FindDeclaredDirectMethod(const DexCache* dex_cache, uint3 return NULL; } -AbstractMethod* Class::FindDirectMethod(const StringPiece& name, const StringPiece& signature) const { +ArtMethod* Class::FindDirectMethod(const StringPiece& name, const StringPiece& signature) const { for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) { - AbstractMethod* method = klass->FindDeclaredDirectMethod(name, signature); + ArtMethod* method = klass->FindDeclaredDirectMethod(name, signature); if (method != NULL) { return method; } @@ -402,9 +401,9 @@ AbstractMethod* Class::FindDirectMethod(const StringPiece& name, const StringPie return NULL; } -AbstractMethod* Class::FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { +ArtMethod* Class::FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) { - AbstractMethod* method = klass->FindDeclaredDirectMethod(dex_cache, dex_method_idx); + ArtMethod* method = klass->FindDeclaredDirectMethod(dex_cache, dex_method_idx); if (method != NULL) { return method; } @@ -412,11 +411,11 @@ AbstractMethod* Class::FindDirectMethod(const DexCache* dex_cache, uint32_t dex_ return NULL; } -AbstractMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name, +ArtMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature) const { MethodHelper mh; for (size_t i = 0; i < NumVirtualMethods(); ++i) { - AbstractMethod* method = GetVirtualMethod(i); + ArtMethod* method = GetVirtualMethod(i); mh.ChangeMethod(method); if (name == mh.GetName() && signature == mh.GetSignature()) { return method; @@ -425,10 +424,10 @@ AbstractMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name, return NULL; } -AbstractMethod* Class::FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { +ArtMethod* Class::FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { if (GetDexCache() == dex_cache) { for (size_t i = 0; i < NumVirtualMethods(); ++i) { - AbstractMethod* method = GetVirtualMethod(i); + ArtMethod* method = GetVirtualMethod(i); if (method->GetDexMethodIndex() == dex_method_idx) { return method; } @@ -437,9 +436,9 @@ AbstractMethod* Class::FindDeclaredVirtualMethod(const DexCache* dex_cache, uint return NULL; } -AbstractMethod* Class::FindVirtualMethod(const StringPiece& name, const StringPiece& signature) const { +ArtMethod* Class::FindVirtualMethod(const StringPiece& name, const StringPiece& signature) const { for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) { - AbstractMethod* method = klass->FindDeclaredVirtualMethod(name, signature); + ArtMethod* method = klass->FindDeclaredVirtualMethod(name, signature); if (method != NULL) { return method; } @@ -447,9 +446,9 @@ AbstractMethod* Class::FindVirtualMethod(const StringPiece& name, const StringPi return NULL; } -AbstractMethod* Class::FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { +ArtMethod* Class::FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const { for (const Class* klass = this; klass != NULL; klass = klass->GetSuperClass()) { - AbstractMethod* method = klass->FindDeclaredVirtualMethod(dex_cache, dex_method_idx); + ArtMethod* method = klass->FindDeclaredVirtualMethod(dex_cache, dex_method_idx); if (method != NULL) { return method; } @@ -457,12 +456,12 @@ AbstractMethod* Class::FindVirtualMethod(const DexCache* dex_cache, uint32_t dex return NULL; } -Field* Class::FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type) { +ArtField* Class::FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type) { // Is the field in this class? // Interfaces are not relevant because they can't contain instance fields. FieldHelper fh; for (size_t i = 0; i < NumInstanceFields(); ++i) { - Field* f = GetInstanceField(i); + ArtField* f = GetInstanceField(i); fh.ChangeField(f); if (name == fh.GetName() && type == fh.GetTypeDescriptor()) { return f; @@ -471,10 +470,10 @@ Field* Class::FindDeclaredInstanceField(const StringPiece& name, const StringPie return NULL; } -Field* Class::FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) { +ArtField* Class::FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) { if (GetDexCache() == dex_cache) { for (size_t i = 0; i < NumInstanceFields(); ++i) { - Field* f = GetInstanceField(i); + ArtField* f = GetInstanceField(i); if (f->GetDexFieldIndex() == dex_field_idx) { return f; } @@ -483,11 +482,11 @@ Field* Class::FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_ return NULL; } -Field* Class::FindInstanceField(const StringPiece& name, const StringPiece& type) { +ArtField* Class::FindInstanceField(const StringPiece& name, const StringPiece& type) { // Is the field in this class, or any of its superclasses? // Interfaces are not relevant because they can't contain instance fields. for (Class* c = this; c != NULL; c = c->GetSuperClass()) { - Field* f = c->FindDeclaredInstanceField(name, type); + ArtField* f = c->FindDeclaredInstanceField(name, type); if (f != NULL) { return f; } @@ -495,11 +494,11 @@ Field* Class::FindInstanceField(const StringPiece& name, const StringPiece& type return NULL; } -Field* Class::FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) { +ArtField* Class::FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) { // Is the field in this class, or any of its superclasses? // Interfaces are not relevant because they can't contain instance fields. for (Class* c = this; c != NULL; c = c->GetSuperClass()) { - Field* f = c->FindDeclaredInstanceField(dex_cache, dex_field_idx); + ArtField* f = c->FindDeclaredInstanceField(dex_cache, dex_field_idx); if (f != NULL) { return f; } @@ -507,11 +506,11 @@ Field* Class::FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_id return NULL; } -Field* Class::FindDeclaredStaticField(const StringPiece& name, const StringPiece& type) { +ArtField* Class::FindDeclaredStaticField(const StringPiece& name, const StringPiece& type) { DCHECK(type != NULL); FieldHelper fh; for (size_t i = 0; i < NumStaticFields(); ++i) { - Field* f = GetStaticField(i); + ArtField* f = GetStaticField(i); fh.ChangeField(f); if (name == fh.GetName() && type == fh.GetTypeDescriptor()) { return f; @@ -520,10 +519,10 @@ Field* Class::FindDeclaredStaticField(const StringPiece& name, const StringPiece return NULL; } -Field* Class::FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) { +ArtField* Class::FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) { if (dex_cache == GetDexCache()) { for (size_t i = 0; i < NumStaticFields(); ++i) { - Field* f = GetStaticField(i); + ArtField* f = GetStaticField(i); if (f->GetDexFieldIndex() == dex_field_idx) { return f; } @@ -532,13 +531,13 @@ Field* Class::FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_fi return NULL; } -Field* Class::FindStaticField(const StringPiece& name, const StringPiece& type) { +ArtField* Class::FindStaticField(const StringPiece& name, const StringPiece& type) { // Is the field in this class (or its interfaces), or any of its // superclasses (or their interfaces)? ClassHelper kh; for (Class* k = this; k != NULL; k = k->GetSuperClass()) { // Is the field in this class? - Field* f = k->FindDeclaredStaticField(name, type); + ArtField* f = k->FindDeclaredStaticField(name, type); if (f != NULL) { return f; } @@ -555,11 +554,11 @@ Field* Class::FindStaticField(const StringPiece& name, const StringPiece& type) return NULL; } -Field* Class::FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) { +ArtField* Class::FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) { ClassHelper kh; for (Class* k = this; k != NULL; k = k->GetSuperClass()) { // Is the field in this class? - Field* f = k->FindDeclaredStaticField(dex_cache, dex_field_idx); + ArtField* f = k->FindDeclaredStaticField(dex_cache, dex_field_idx); if (f != NULL) { return f; } @@ -576,12 +575,12 @@ Field* Class::FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) return NULL; } -Field* Class::FindField(const StringPiece& name, const StringPiece& type) { +ArtField* Class::FindField(const StringPiece& name, const StringPiece& type) { // Find a field using the JLS field resolution order ClassHelper kh; for (Class* k = this; k != NULL; k = k->GetSuperClass()) { // Is the field in this class? - Field* f = k->FindDeclaredInstanceField(name, type); + ArtField* f = k->FindDeclaredInstanceField(name, type); if (f != NULL) { return f; } @@ -602,11 +601,11 @@ Field* Class::FindField(const StringPiece& name, const StringPiece& type) { return NULL; } -static void SetPreverifiedFlagOnMethods(mirror::ObjectArray* methods) +static void SetPreverifiedFlagOnMethods(mirror::ObjectArray* methods) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (methods != NULL) { for (int32_t index = 0, end = methods->GetLength(); index < end; ++index) { - mirror::AbstractMethod* method = methods->GetWithoutChecks(index); + mirror::ArtMethod* method = methods->GetWithoutChecks(index); DCHECK(method != NULL); method->SetPreverified(); } diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h index 1dd02c0256..638b67f485 100644 --- a/runtime/mirror/class.h +++ b/runtime/mirror/class.h @@ -63,9 +63,9 @@ class StringPiece; namespace mirror { +class ArtField; class ClassLoader; class DexCache; -class Field; class IfTable; // Type for the InitializedStaticStorage table. Currently the Class @@ -341,9 +341,9 @@ class MANAGED Class : public StaticStorageBase { bool IsThrowableClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - bool IsFieldClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + bool IsArtFieldClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - bool IsMethodClass() const; + bool IsArtMethodClass() const; Class* GetComponentType() const { return GetFieldObject(OFFSET_OF_OBJECT_MEMBER(Class, component_type_), false); @@ -502,42 +502,42 @@ class MANAGED Class : public StaticStorageBase { void SetDexCache(DexCache* new_dex_cache) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - ObjectArray* GetDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + ObjectArray* GetDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetDirectMethods(ObjectArray* new_direct_methods) + void SetDirectMethods(ObjectArray* new_direct_methods) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* GetDirectMethod(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + ArtMethod* GetDirectMethod(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetDirectMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t + void SetDirectMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns the number of static, private, and constructor methods. size_t NumDirectMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - ObjectArray* GetVirtualMethods() const + ObjectArray* GetVirtualMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetVirtualMethods(ObjectArray* new_virtual_methods) + void SetVirtualMethods(ObjectArray* new_virtual_methods) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns the number of non-inherited virtual methods. size_t NumVirtualMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* GetVirtualMethod(uint32_t i) const + ArtMethod* GetVirtualMethod(uint32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* GetVirtualMethodDuringLinking(uint32_t i) const + ArtMethod* GetVirtualMethodDuringLinking(uint32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetVirtualMethod(uint32_t i, AbstractMethod* f) // TODO: uint16_t + void SetVirtualMethod(uint32_t i, ArtMethod* f) // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - ObjectArray* GetVTable() const; + ObjectArray* GetVTable() const; - ObjectArray* GetVTableDuringLinking() const; + ObjectArray* GetVTableDuringLinking() const; - void SetVTable(ObjectArray* new_vtable) + void SetVTable(ObjectArray* new_vtable) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static MemberOffset VTableOffset() { @@ -546,51 +546,51 @@ class MANAGED Class : public StaticStorageBase { // Given a method implemented by this class but potentially from a super class, return the // specific implementation method for this class. - AbstractMethod* FindVirtualMethodForVirtual(AbstractMethod* method) const + ArtMethod* FindVirtualMethodForVirtual(ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Given a method implemented by this class' super class, return the specific implementation // method for this class. - AbstractMethod* FindVirtualMethodForSuper(AbstractMethod* method) const + ArtMethod* FindVirtualMethodForSuper(ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Given a method implemented by this class, but potentially from a // super class or interface, return the specific implementation // method for this class. - AbstractMethod* FindVirtualMethodForInterface(AbstractMethod* method) const + ArtMethod* FindVirtualMethodForInterface(ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE; - AbstractMethod* FindInterfaceMethod(const StringPiece& name, const StringPiece& descriptor) const + ArtMethod* FindInterfaceMethod(const StringPiece& name, const StringPiece& descriptor) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const + ArtMethod* FindInterfaceMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindVirtualMethodForVirtualOrInterface(AbstractMethod* method) const + ArtMethod* FindVirtualMethodForVirtualOrInterface(ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature) const + ArtMethod* FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const + ArtMethod* FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindVirtualMethod(const StringPiece& name, const StringPiece& descriptor) const + ArtMethod* FindVirtualMethod(const StringPiece& name, const StringPiece& descriptor) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const + ArtMethod* FindVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const + ArtMethod* FindDeclaredDirectMethod(const StringPiece& name, const StringPiece& signature) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const + ArtMethod* FindDeclaredDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindDirectMethod(const StringPiece& name, const StringPiece& signature) const + ArtMethod* FindDirectMethod(const StringPiece& name, const StringPiece& signature) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - AbstractMethod* FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const + ArtMethod* FindDirectMethod(const DexCache* dex_cache, uint32_t dex_method_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); int32_t GetIfTableCount() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -600,16 +600,16 @@ class MANAGED Class : public StaticStorageBase { void SetIfTable(IfTable* new_iftable) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Get instance fields of the class (See also GetSFields). - ObjectArray* GetIFields() const; + ObjectArray* GetIFields() const; - void SetIFields(ObjectArray* new_ifields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetIFields(ObjectArray* new_ifields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); size_t NumInstanceFields() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Field* GetInstanceField(uint32_t i) const // TODO: uint16_t + ArtField* GetInstanceField(uint32_t i) const // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetInstanceField(uint32_t i, Field* f) // TODO: uint16_t + void SetInstanceField(uint32_t i, ArtField* f) // TODO: uint16_t SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns the number of instance fields containing reference types. @@ -662,15 +662,15 @@ class MANAGED Class : public StaticStorageBase { } // Gets the static fields of the class. - ObjectArray* GetSFields() const; + ObjectArray* GetSFields() const; - void SetSFields(ObjectArray* new_sfields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void SetSFields(ObjectArray* new_sfields) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); size_t NumStaticFields() const; - Field* GetStaticField(uint32_t i) const; // TODO: uint16_t + ArtField* GetStaticField(uint32_t i) const; // TODO: uint16_t - void SetStaticField(uint32_t i, Field* f); // TODO: uint16_t + void SetStaticField(uint32_t i, ArtField* f); // TODO: uint16_t uint32_t GetReferenceStaticOffsets() const { return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, reference_static_offsets_), false); @@ -679,37 +679,37 @@ class MANAGED Class : public StaticStorageBase { void SetReferenceStaticOffsets(uint32_t new_reference_offsets); // Find a static or instance field using the JLS resolution order - Field* FindField(const StringPiece& name, const StringPiece& type) + ArtField* FindField(const StringPiece& name, const StringPiece& type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Finds the given instance field in this class or a superclass. - Field* FindInstanceField(const StringPiece& name, const StringPiece& type) + ArtField* FindInstanceField(const StringPiece& name, const StringPiece& type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Finds the given instance field in this class or a superclass, only searches classes that // have the same dex cache. - Field* FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) + ArtField* FindInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Field* FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type) + ArtField* FindDeclaredInstanceField(const StringPiece& name, const StringPiece& type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Field* FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) + ArtField* FindDeclaredInstanceField(const DexCache* dex_cache, uint32_t dex_field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Finds the given static field in this class or a superclass. - Field* FindStaticField(const StringPiece& name, const StringPiece& type) + ArtField* FindStaticField(const StringPiece& name, const StringPiece& type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Finds the given static field in this class or superclass, only searches classes that // have the same dex cache. - Field* FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) + ArtField* FindStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Field* FindDeclaredStaticField(const StringPiece& name, const StringPiece& type) + ArtField* FindDeclaredStaticField(const StringPiece& name, const StringPiece& type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Field* FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) + ArtField* FindDeclaredStaticField(const DexCache* dex_cache, uint32_t dex_field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); pid_t GetClinitThreadId() const { @@ -768,7 +768,7 @@ class MANAGED Class : public StaticStorageBase { DexCache* dex_cache_; // static, private, and methods - ObjectArray* direct_methods_; + ObjectArray* direct_methods_; // instance fields // @@ -780,7 +780,7 @@ class MANAGED Class : public StaticStorageBase { // All instance fields that refer to objects are guaranteed to be at // the beginning of the field list. num_reference_instance_fields_ // specifies the number of reference fields. - ObjectArray* ifields_; + ObjectArray* ifields_; // The interface table (iftable_) contains pairs of a interface class and an array of the // interface methods. There is one pair per interface supported by this class. That means one @@ -799,7 +799,7 @@ class MANAGED Class : public StaticStorageBase { String* name_; // Static fields - ObjectArray* sfields_; + ObjectArray* sfields_; // The superclass, or NULL if this is java.lang.Object, an interface or primitive type. Class* super_class_; @@ -808,13 +808,13 @@ class MANAGED Class : public StaticStorageBase { Class* verify_error_class_; // virtual methods defined in this class; invoked through vtable - ObjectArray* virtual_methods_; + ObjectArray* virtual_methods_; // Virtual method table (vtable), for use by "invoke-virtual". The vtable from the superclass is // copied in, and virtual methods from our class either replace those from the super or are // appended. For abstract classes, methods may be created in the vtable that aren't in // virtual_ methods_ for miranda methods. - ObjectArray* vtable_; + ObjectArray* vtable_; // access flags; low 16 bits are defined by VM spec uint32_t access_flags_; diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h index 369dc49ed0..da26be59b9 100644 --- a/runtime/mirror/dex_cache-inl.h +++ b/runtime/mirror/dex_cache-inl.h @@ -22,9 +22,9 @@ namespace art { namespace mirror { -inline AbstractMethod* DexCache::GetResolvedMethod(uint32_t method_idx) const +inline ArtMethod* DexCache::GetResolvedMethod(uint32_t method_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - AbstractMethod* method = GetResolvedMethods()->Get(method_idx); + ArtMethod* method = GetResolvedMethods()->Get(method_idx); // Hide resolution trampoline methods from the caller if (method != NULL && method->IsRuntimeMethod()) { DCHECK(method == Runtime::Current()->GetResolutionMethod()); diff --git a/runtime/mirror/dex_cache.cc b/runtime/mirror/dex_cache.cc index 239dc5e0c3..00531e3076 100644 --- a/runtime/mirror/dex_cache.cc +++ b/runtime/mirror/dex_cache.cc @@ -16,7 +16,7 @@ #include "dex_cache.h" -#include "abstract_method-inl.h" +#include "art_method-inl.h" #include "base/logging.h" #include "class_linker.h" #include "gc/accounting/card_table-inl.h" @@ -35,8 +35,8 @@ void DexCache::Init(const DexFile* dex_file, String* location, ObjectArray* strings, ObjectArray* resolved_types, - ObjectArray* resolved_methods, - ObjectArray* resolved_fields, + ObjectArray* resolved_methods, + ObjectArray* resolved_fields, ObjectArray* initialized_static_storage) { CHECK(dex_file != NULL); CHECK(location != NULL); @@ -58,7 +58,7 @@ void DexCache::Init(const DexFile* dex_file, Runtime* runtime = Runtime::Current(); if (runtime->HasResolutionMethod()) { // Initialize the resolve methods array to contain trampolines for resolution. - AbstractMethod* trampoline = runtime->GetResolutionMethod(); + ArtMethod* trampoline = runtime->GetResolutionMethod(); size_t length = resolved_methods->GetLength(); for (size_t i = 0; i < length; i++) { resolved_methods->SetWithoutChecks(i, trampoline); @@ -66,10 +66,10 @@ void DexCache::Init(const DexFile* dex_file, } } -void DexCache::Fixup(AbstractMethod* trampoline) { +void DexCache::Fixup(ArtMethod* trampoline) { // Fixup the resolve methods array to contain trampoline for resolution. CHECK(trampoline != NULL); - ObjectArray* resolved_methods = GetResolvedMethods(); + ObjectArray* resolved_methods = GetResolvedMethods(); size_t length = resolved_methods->GetLength(); for (size_t i = 0; i < length; i++) { if (resolved_methods->GetWithoutChecks(i) == NULL) { diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h index 9c0f09ba21..6cfab9e425 100644 --- a/runtime/mirror/dex_cache.h +++ b/runtime/mirror/dex_cache.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_MIRROR_DEX_CACHE_H_ #define ART_RUNTIME_MIRROR_DEX_CACHE_H_ -#include "abstract_method.h" +#include "art_method.h" #include "class.h" #include "object.h" #include "object_array.h" @@ -32,8 +32,8 @@ union JValue; namespace mirror { +class ArtField; class Class; -class Field; class MANAGED DexCacheClass : public Class { private: @@ -46,12 +46,12 @@ class MANAGED DexCache : public Object { String* location, ObjectArray* strings, ObjectArray* types, - ObjectArray* methods, - ObjectArray* fields, + ObjectArray* methods, + ObjectArray* fields, ObjectArray* initialized_static_storage) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void Fixup(AbstractMethod* trampoline) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void Fixup(ArtMethod* trampoline) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); String* GetLocation() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return GetFieldObject(OFFSET_OF_OBJECT_MEMBER(DexCache, location_), false); @@ -110,20 +110,20 @@ class MANAGED DexCache : public Object { GetResolvedTypes()->Set(type_idx, resolved); } - AbstractMethod* GetResolvedMethod(uint32_t method_idx) const + ArtMethod* GetResolvedMethod(uint32_t method_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetResolvedMethod(uint32_t method_idx, AbstractMethod* resolved) + void SetResolvedMethod(uint32_t method_idx, ArtMethod* resolved) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { GetResolvedMethods()->Set(method_idx, resolved); } - Field* GetResolvedField(uint32_t field_idx) const + ArtField* GetResolvedField(uint32_t field_idx) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { return GetResolvedFields()->Get(field_idx); } - void SetResolvedField(uint32_t field_idx, Field* resolved) + void SetResolvedField(uint32_t field_idx, ArtField* resolved) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { GetResolvedFields()->Set(field_idx, resolved); } @@ -139,14 +139,14 @@ class MANAGED DexCache : public Object { OFFSET_OF_OBJECT_MEMBER(DexCache, resolved_types_), false); } - ObjectArray* GetResolvedMethods() const + ObjectArray* GetResolvedMethods() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - return GetFieldObject< ObjectArray* >(ResolvedMethodsOffset(), false); + return GetFieldObject< ObjectArray* >(ResolvedMethodsOffset(), false); } - ObjectArray* GetResolvedFields() const + ObjectArray* GetResolvedFields() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - return GetFieldObject< ObjectArray* >(ResolvedFieldsOffset(), false); + return GetFieldObject< ObjectArray* >(ResolvedFieldsOffset(), false); } ObjectArray* GetInitializedStaticStorage() const @@ -166,8 +166,8 @@ class MANAGED DexCache : public Object { private: ObjectArray* initialized_static_storage_; String* location_; - ObjectArray* resolved_fields_; - ObjectArray* resolved_methods_; + ObjectArray* resolved_fields_; + ObjectArray* resolved_methods_; ObjectArray* resolved_types_; ObjectArray* strings_; uint32_t dex_file_; diff --git a/runtime/mirror/field-inl.h b/runtime/mirror/field-inl.h deleted file mode 100644 index 3e3d6db4a6..0000000000 --- a/runtime/mirror/field-inl.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * 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_MIRROR_FIELD_INL_H_ -#define ART_RUNTIME_MIRROR_FIELD_INL_H_ - -#include "field.h" - -#include "base/logging.h" -#include "gc/accounting/card_table-inl.h" -#include "jvalue.h" -#include "object-inl.h" -#include "object_utils.h" -#include "primitive.h" - -namespace art { -namespace mirror { - -inline Class* Field::GetDeclaringClass() const { - Class* result = GetFieldObject(OFFSET_OF_OBJECT_MEMBER(Field, declaring_class_), false); - DCHECK(result != NULL); - DCHECK(result->IsLoaded() || result->IsErroneous()); - return result; -} - -inline void Field::SetDeclaringClass(Class *new_declaring_class) { - SetFieldObject(OFFSET_OF_OBJECT_MEMBER(Field, declaring_class_), new_declaring_class, false); -} - -inline uint32_t Field::GetAccessFlags() const { - DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); - return GetField32(OFFSET_OF_OBJECT_MEMBER(Field, access_flags_), false); -} - -inline MemberOffset Field::GetOffset() const { - DCHECK(GetDeclaringClass()->IsResolved() || GetDeclaringClass()->IsErroneous()); - return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), false)); -} - -inline MemberOffset Field::GetOffsetDuringLinking() const { - DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); - return MemberOffset(GetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), false)); -} - -inline uint32_t Field::Get32(const Object* object) const { - DCHECK(object != NULL) << PrettyField(this); - DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); - return object->GetField32(GetOffset(), IsVolatile()); -} - -inline void Field::Set32(Object* object, uint32_t new_value) const { - DCHECK(object != NULL) << PrettyField(this); - DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); - object->SetField32(GetOffset(), new_value, IsVolatile()); -} - -inline uint64_t Field::Get64(const Object* object) const { - DCHECK(object != NULL) << PrettyField(this); - DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); - return object->GetField64(GetOffset(), IsVolatile()); -} - -inline void Field::Set64(Object* object, uint64_t new_value) const { - DCHECK(object != NULL) << PrettyField(this); - DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); - object->SetField64(GetOffset(), new_value, IsVolatile()); -} - -inline Object* Field::GetObj(const Object* object) const { - DCHECK(object != NULL) << PrettyField(this); - DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); - return object->GetFieldObject(GetOffset(), IsVolatile()); -} - -inline void Field::SetObj(Object* object, const Object* new_value) const { - DCHECK(object != NULL) << PrettyField(this); - DCHECK(!IsStatic() || (object == GetDeclaringClass()) || !Runtime::Current()->IsStarted()); - object->SetFieldObject(GetOffset(), new_value, IsVolatile()); -} - -inline bool Field::GetBoolean(const Object* object) const { - DCHECK_EQ(Primitive::kPrimBoolean, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - return Get32(object); -} - -inline void Field::SetBoolean(Object* object, bool z) const { - DCHECK_EQ(Primitive::kPrimBoolean, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - Set32(object, z); -} - -inline int8_t Field::GetByte(const Object* object) const { - DCHECK_EQ(Primitive::kPrimByte, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - return Get32(object); -} - -inline void Field::SetByte(Object* object, int8_t b) const { - DCHECK_EQ(Primitive::kPrimByte, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - Set32(object, b); -} - -inline uint16_t Field::GetChar(const Object* object) const { - DCHECK_EQ(Primitive::kPrimChar, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - return Get32(object); -} - -inline void Field::SetChar(Object* object, uint16_t c) const { - DCHECK_EQ(Primitive::kPrimChar, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - Set32(object, c); -} - -inline int16_t Field::GetShort(const Object* object) const { - DCHECK_EQ(Primitive::kPrimShort, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - return Get32(object); -} - -inline void Field::SetShort(Object* object, int16_t s) const { - DCHECK_EQ(Primitive::kPrimShort, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - Set32(object, s); -} - -inline int32_t Field::GetInt(const Object* object) const { -#ifndef NDEBUG - Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); - CHECK(type == Primitive::kPrimInt || type == Primitive::kPrimFloat) << PrettyField(this); -#endif - return Get32(object); -} - -inline void Field::SetInt(Object* object, int32_t i) const { -#ifndef NDEBUG - Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); - CHECK(type == Primitive::kPrimInt || type == Primitive::kPrimFloat) << PrettyField(this); -#endif - Set32(object, i); -} - -inline int64_t Field::GetLong(const Object* object) const { -#ifndef NDEBUG - Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); - CHECK(type == Primitive::kPrimLong || type == Primitive::kPrimDouble) << PrettyField(this); -#endif - return Get64(object); -} - -inline void Field::SetLong(Object* object, int64_t j) const { -#ifndef NDEBUG - Primitive::Type type = FieldHelper(this).GetTypeAsPrimitiveType(); - CHECK(type == Primitive::kPrimLong || type == Primitive::kPrimDouble) << PrettyField(this); -#endif - Set64(object, j); -} - -inline float Field::GetFloat(const Object* object) const { - DCHECK_EQ(Primitive::kPrimFloat, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - JValue bits; - bits.SetI(Get32(object)); - return bits.GetF(); -} - -inline void Field::SetFloat(Object* object, float f) const { - DCHECK_EQ(Primitive::kPrimFloat, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - JValue bits; - bits.SetF(f); - Set32(object, bits.GetI()); -} - -inline double Field::GetDouble(const Object* object) const { - DCHECK_EQ(Primitive::kPrimDouble, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - JValue bits; - bits.SetJ(Get64(object)); - return bits.GetD(); -} - -inline void Field::SetDouble(Object* object, double d) const { - DCHECK_EQ(Primitive::kPrimDouble, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - JValue bits; - bits.SetD(d); - Set64(object, bits.GetJ()); -} - -inline Object* Field::GetObject(const Object* object) const { - DCHECK_EQ(Primitive::kPrimNot, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - return GetObj(object); -} - -inline void Field::SetObject(Object* object, const Object* l) const { - DCHECK_EQ(Primitive::kPrimNot, FieldHelper(this).GetTypeAsPrimitiveType()) - << PrettyField(this); - SetObj(object, l); -} - -} // namespace mirror -} // namespace art - -#endif // ART_RUNTIME_MIRROR_FIELD_INL_H_ diff --git a/runtime/mirror/field.cc b/runtime/mirror/field.cc deleted file mode 100644 index 12f395f6b6..0000000000 --- a/runtime/mirror/field.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 "field.h" - -#include "field-inl.h" -#include "gc/accounting/card_table-inl.h" -#include "object-inl.h" -#include "object_utils.h" -#include "runtime.h" -#include "utils.h" - -namespace art { -namespace mirror { - -// TODO: get global references for these -Class* Field::java_lang_reflect_Field_ = NULL; - -void Field::SetClass(Class* java_lang_reflect_Field) { - CHECK(java_lang_reflect_Field_ == NULL); - CHECK(java_lang_reflect_Field != NULL); - java_lang_reflect_Field_ = java_lang_reflect_Field; -} - -void Field::ResetClass() { - CHECK(java_lang_reflect_Field_ != NULL); - java_lang_reflect_Field_ = NULL; -} - -void Field::SetOffset(MemberOffset num_bytes) { - DCHECK(GetDeclaringClass()->IsLoaded() || GetDeclaringClass()->IsErroneous()); -#if 0 // TODO enable later in boot and under !NDEBUG - FieldHelper fh(this); - Primitive::Type type = fh.GetTypeAsPrimitiveType(); - if (type == Primitive::kPrimDouble || type == Primitive::kPrimLong) { - DCHECK_ALIGNED(num_bytes.Uint32Value(), 8); - } -#endif - SetField32(OFFSET_OF_OBJECT_MEMBER(Field, offset_), num_bytes.Uint32Value(), false); -} - -} // namespace mirror -} // namespace art diff --git a/runtime/mirror/field.h b/runtime/mirror/field.h deleted file mode 100644 index 6e508a362f..0000000000 --- a/runtime/mirror/field.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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_MIRROR_FIELD_H_ -#define ART_RUNTIME_MIRROR_FIELD_H_ - -#include "class.h" -#include "modifiers.h" -#include "object.h" - -namespace art { - -struct FieldClassOffsets; -struct FieldOffsets; - -namespace mirror { - -// C++ mirror of java.lang.reflect.Field -class MANAGED Field : public Object { - public: - Class* GetDeclaringClass() const; - - void SetDeclaringClass(Class *new_declaring_class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - uint32_t GetAccessFlags() const; - - void SetAccessFlags(uint32_t new_access_flags) { - SetField32(OFFSET_OF_OBJECT_MEMBER(Field, access_flags_), new_access_flags, false); - } - - bool IsPublic() const { - return (GetAccessFlags() & kAccPublic) != 0; - } - - bool IsStatic() const { - return (GetAccessFlags() & kAccStatic) != 0; - } - - bool IsFinal() const { - return (GetAccessFlags() & kAccFinal) != 0; - } - - uint32_t GetDexFieldIndex() const { - return GetField32(OFFSET_OF_OBJECT_MEMBER(Field, field_dex_idx_), false); - } - - void SetDexFieldIndex(uint32_t new_idx) { - SetField32(OFFSET_OF_OBJECT_MEMBER(Field, field_dex_idx_), new_idx, false); - } - - // Offset to field within an Object - MemberOffset GetOffset() const; - - static MemberOffset OffsetOffset() { - return MemberOffset(OFFSETOF_MEMBER(Field, offset_)); - } - - MemberOffset GetOffsetDuringLinking() const; - - void SetOffset(MemberOffset num_bytes); - - // field access, null object for static fields - bool GetBoolean(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetBoolean(Object* object, bool z) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - int8_t GetByte(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetByte(Object* object, int8_t b) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - uint16_t GetChar(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetChar(Object* object, uint16_t c) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - int16_t GetShort(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetShort(Object* object, int16_t s) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - int32_t GetInt(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetInt(Object* object, int32_t i) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - int64_t GetLong(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetLong(Object* object, int64_t j) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - float GetFloat(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetFloat(Object* object, float f) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - double GetDouble(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetDouble(Object* object, double d) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Object* GetObject(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetObject(Object* object, const Object* l) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - // raw field accesses - uint32_t Get32(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void Set32(Object* object, uint32_t new_value) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - uint64_t Get64(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void Set64(Object* object, uint64_t new_value) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Object* GetObj(const Object* object) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetObj(Object* object, const Object* new_value) const - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - - static Class* GetJavaLangReflectField() { - DCHECK(java_lang_reflect_Field_ != NULL); - return java_lang_reflect_Field_; - } - - static void SetClass(Class* java_lang_reflect_Field); - static void ResetClass(); - - bool IsVolatile() const { - return (GetAccessFlags() & kAccVolatile) != 0; - } - - private: - // Field order required by test "ValidateFieldOrderOfJavaCppUnionClasses". - // The class we are a part of - Class* declaring_class_; - - uint32_t access_flags_; - - // Dex cache index of field id - uint32_t field_dex_idx_; - - // Offset of field within an instance or in the Class' static fields - uint32_t offset_; - - static Class* java_lang_reflect_Field_; - - friend struct art::FieldOffsets; // for verifying offset information - DISALLOW_IMPLICIT_CONSTRUCTORS(Field); -}; - -class MANAGED FieldClass : public Class { - private: - Object* ORDER_BY_NAME_AND_DECLARING_CLASS_; - friend struct art::FieldClassOffsets; // for verifying offset information - DISALLOW_IMPLICIT_CONSTRUCTORS(FieldClass); -}; - -} // namespace mirror -} // namespace art - -#endif // ART_RUNTIME_MIRROR_FIELD_H_ diff --git a/runtime/mirror/iftable.h b/runtime/mirror/iftable.h index aea8fddafe..421893d3db 100644 --- a/runtime/mirror/iftable.h +++ b/runtime/mirror/iftable.h @@ -32,24 +32,24 @@ class MANAGED IfTable : public ObjectArray { void SetInterface(int32_t i, Class* interface) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - ObjectArray* GetMethodArray(int32_t i) const + ObjectArray* GetMethodArray(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - ObjectArray* method_array = - down_cast*>(Get((i * kMax) + kMethodArray)); + ObjectArray* method_array = + down_cast*>(Get((i * kMax) + kMethodArray)); DCHECK(method_array != NULL); return method_array; } size_t GetMethodArrayCount(int32_t i) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - ObjectArray* method_array = - down_cast*>(Get((i * kMax) + kMethodArray)); + ObjectArray* method_array = + down_cast*>(Get((i * kMax) + kMethodArray)); if (method_array == NULL) { return 0; } return method_array->GetLength(); } - void SetMethodArray(int32_t i, ObjectArray* new_ma) + void SetMethodArray(int32_t i, ObjectArray* new_ma) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(new_ma != NULL); DCHECK(Get((i * kMax) + kMethodArray) == NULL); diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h index 5818a800bf..63396d2f59 100644 --- a/runtime/mirror/object-inl.h +++ b/runtime/mirror/object-inl.h @@ -19,10 +19,10 @@ #include "object.h" -#include "abstract_method.h" +#include "art_field.h" +#include "art_method.h" #include "atomic.h" #include "array-inl.h" -#include "field.h" #include "class.h" #include "monitor.h" #include "runtime.h" @@ -112,32 +112,32 @@ inline bool Object::IsArrayInstance() const { return GetClass()->IsArrayClass(); } -inline bool Object::IsField() const { - return GetClass()->IsFieldClass(); +inline bool Object::IsArtField() const { + return GetClass()->IsArtFieldClass(); } -inline Field* Object::AsField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - DCHECK(IsField()); - return down_cast(this); +inline ArtField* Object::AsArtField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + DCHECK(IsArtField()); + return down_cast(this); } -inline const Field* Object::AsField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - DCHECK(IsField()); - return down_cast(this); +inline const ArtField* Object::AsArtField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + DCHECK(IsArtField()); + return down_cast(this); } -inline bool Object::IsMethod() const { - return GetClass()->IsMethodClass(); +inline bool Object::IsArtMethod() const { + return GetClass()->IsArtMethodClass(); } -inline AbstractMethod* Object::AsMethod() { - DCHECK(IsMethod()); - return down_cast(this); +inline ArtMethod* Object::AsArtMethod() { + DCHECK(IsArtMethod()); + return down_cast(this); } -inline const AbstractMethod* Object::AsMethod() const { - DCHECK(IsMethod()); - return down_cast(this); +inline const ArtMethod* Object::AsArtMethod() const { + DCHECK(IsArtMethod()); + return down_cast(this); } inline bool Object::IsReferenceInstance() const { @@ -227,8 +227,8 @@ inline size_t Object::SizeOf() const { } else { result = GetClass()->GetObjectSize(); } - DCHECK(!IsField() || result == sizeof(Field)); - DCHECK(!IsMethod() || result == sizeof(AbstractMethod)); + DCHECK(!IsArtField() || result == sizeof(ArtField)); + DCHECK(!IsArtMethod() || result == sizeof(ArtMethod)); return result; } diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc index b2d6e71478..92c05b26ca 100644 --- a/runtime/mirror/object.cc +++ b/runtime/mirror/object.cc @@ -16,12 +16,12 @@ #include "object.h" +#include "art_field.h" +#include "art_field-inl.h" #include "array-inl.h" #include "class.h" #include "class-inl.h" #include "class_linker-inl.h" -#include "field.h" -#include "field-inl.h" #include "gc/accounting/card_table-inl.h" #include "gc/heap.h" #include "iftable-inl.h" @@ -67,7 +67,7 @@ Object* Object::Clone(Thread* self) { for (const Class* klass = c; klass != NULL; klass = klass->GetSuperClass()) { size_t num_reference_fields = klass->NumReferenceInstanceFields(); for (size_t i = 0; i < num_reference_fields; ++i) { - Field* field = klass->GetInstanceField(i); + ArtField* field = klass->GetInstanceField(i); MemberOffset field_offset = field->GetOffset(); const Object* ref = copy->GetFieldObject(field_offset, false); heap->WriteBarrierField(copy.get(), field_offset, ref); @@ -90,11 +90,11 @@ void Object::CheckFieldAssignmentImpl(MemberOffset field_offset, const Object* n return; } for (const Class* cur = c; cur != NULL; cur = cur->GetSuperClass()) { - ObjectArray* fields = cur->GetIFields(); + ObjectArray* fields = cur->GetIFields(); if (fields != NULL) { size_t num_ref_ifields = cur->NumReferenceInstanceFields(); for (size_t i = 0; i < num_ref_ifields; ++i) { - Field* field = fields->Get(i); + ArtField* field = fields->Get(i); if (field->GetOffset().Int32Value() == field_offset.Int32Value()) { FieldHelper fh(field); CHECK(fh.GetType()->IsAssignableFrom(new_value->GetClass())); @@ -108,11 +108,11 @@ void Object::CheckFieldAssignmentImpl(MemberOffset field_offset, const Object* n return; } if (IsClass()) { - ObjectArray* fields = AsClass()->GetSFields(); + ObjectArray* fields = AsClass()->GetSFields(); if (fields != NULL) { size_t num_ref_sfields = AsClass()->NumReferenceStaticFields(); for (size_t i = 0; i < num_ref_sfields; ++i) { - Field* field = fields->Get(i); + ArtField* field = fields->Get(i); if (field->GetOffset().Int32Value() == field_offset.Int32Value()) { FieldHelper fh(field); CHECK(fh.GetType()->IsAssignableFrom(new_value->GetClass())); diff --git a/runtime/mirror/object.h b/runtime/mirror/object.h index a40c906eb0..28a91dd8e5 100644 --- a/runtime/mirror/object.h +++ b/runtime/mirror/object.h @@ -31,10 +31,10 @@ class Thread; namespace mirror { -class AbstractMethod; +class ArtField; +class ArtMethod; class Array; class Class; -class Field; template class ObjectArray; template class PrimitiveArray; typedef PrimitiveArray BooleanArray; @@ -144,17 +144,17 @@ class MANAGED Object { Throwable* AsThrowable() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - bool IsMethod() const; + bool IsArtMethod() const; - AbstractMethod* AsMethod(); + ArtMethod* AsArtMethod(); - const AbstractMethod* AsMethod() const; + const ArtMethod* AsArtMethod() const; - bool IsField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + bool IsArtField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - Field* AsField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + ArtField* AsArtField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - const Field* AsField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + const ArtField* AsArtField() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool IsReferenceInstance() const; diff --git a/runtime/mirror/object_array-inl.h b/runtime/mirror/object_array-inl.h index 8675c31b37..6f22618340 100644 --- a/runtime/mirror/object_array-inl.h +++ b/runtime/mirror/object_array-inl.h @@ -20,8 +20,8 @@ #include "object_array.h" #include "gc/heap.h" +#include "mirror/art_field.h" #include "mirror/class.h" -#include "mirror/field.h" #include "runtime.h" #include "thread.h" diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc index 540ff9f68e..814305c3af 100644 --- a/runtime/mirror/object_test.cc +++ b/runtime/mirror/object_test.cc @@ -20,6 +20,7 @@ #include #include "array-inl.h" +#include "art_field-inl.h" #include "asm_support.h" #include "class-inl.h" #include "class_linker.h" @@ -27,11 +28,10 @@ #include "common_test.h" #include "dex_file.h" #include "entrypoints/entrypoint_utils.h" -#include "field-inl.h" #include "gc/accounting/card_table-inl.h" #include "gc/heap.h" #include "iftable-inl.h" -#include "abstract_method-inl.h" +#include "art_method-inl.h" #include "object-inl.h" #include "object_array-inl.h" #include "sirt_ref.h" @@ -75,7 +75,7 @@ TEST_F(ObjectTest, AsmConstants) { ASSERT_EQ(STRING_OFFSET_OFFSET, String::OffsetOffset().Int32Value()); ASSERT_EQ(STRING_DATA_OFFSET, Array::DataOffset(sizeof(uint16_t)).Int32Value()); - ASSERT_EQ(METHOD_CODE_OFFSET, AbstractMethod::EntryPointFromCompiledCodeOffset().Int32Value()); + ASSERT_EQ(METHOD_CODE_OFFSET, ArtMethod::EntryPointFromCompiledCodeOffset().Int32Value()); } TEST_F(ObjectTest, IsInSamePackage) { @@ -204,7 +204,7 @@ TEST_F(ObjectTest, CheckAndAllocArrayFromCode) { // pretend we are trying to call 'new char[3]' from String.toCharArray ScopedObjectAccess soa(Thread::Current()); Class* java_util_Arrays = class_linker_->FindSystemClass("Ljava/util/Arrays;"); - AbstractMethod* sort = java_util_Arrays->FindDirectMethod("sort", "([I)V"); + ArtMethod* sort = java_util_Arrays->FindDirectMethod("sort", "([I)V"); const DexFile::StringId* string_id = java_lang_dex_file_->FindStringId("[I"); ASSERT_TRUE(string_id != NULL); const DexFile::TypeId* type_id = java_lang_dex_file_->FindTypeId( @@ -261,7 +261,7 @@ TEST_F(ObjectTest, StaticFieldFromCode) { Class* klass = class_linker_->FindClass("LStaticsFromCode;", soa.Decode(class_loader)); - AbstractMethod* clinit = klass->FindDirectMethod("", "()V"); + ArtMethod* clinit = klass->FindDirectMethod("", "()V"); const DexFile::StringId* klass_string_id = dex_file->FindStringId("LStaticsFromCode;"); ASSERT_TRUE(klass_string_id != NULL); const DexFile::TypeId* klass_type_id = dex_file->FindTypeId( @@ -282,8 +282,8 @@ TEST_F(ObjectTest, StaticFieldFromCode) { ASSERT_TRUE(field_id != NULL); uint32_t field_idx = dex_file->GetIndexForFieldId(*field_id); - Field* field = FindFieldFromCode(field_idx, clinit, Thread::Current(), StaticObjectRead, - sizeof(Object*), true); + ArtField* field = FindFieldFromCode(field_idx, clinit, Thread::Current(), StaticObjectRead, + sizeof(Object*), true); Object* s0 = field->GetObj(klass); EXPECT_TRUE(s0 != NULL); @@ -294,7 +294,7 @@ TEST_F(ObjectTest, StaticFieldFromCode) { field->SetObj(field->GetDeclaringClass(), NULL); EXPECT_EQ(NULL, field->GetObj(klass)); - // TODO: more exhaustive tests of all 6 cases of Field::*FromCode + // TODO: more exhaustive tests of all 6 cases of ArtField::*FromCode } TEST_F(ObjectTest, String) { @@ -395,29 +395,29 @@ TEST_F(ObjectTest, DescriptorCompare) { Class* klass2 = linker->FindClass("LProtoCompare2;", class_loader_2.get()); ASSERT_TRUE(klass2 != NULL); - AbstractMethod* m1_1 = klass1->GetVirtualMethod(0); + ArtMethod* m1_1 = klass1->GetVirtualMethod(0); MethodHelper mh(m1_1); EXPECT_STREQ(mh.GetName(), "m1"); - AbstractMethod* m2_1 = klass1->GetVirtualMethod(1); + ArtMethod* m2_1 = klass1->GetVirtualMethod(1); mh.ChangeMethod(m2_1); EXPECT_STREQ(mh.GetName(), "m2"); - AbstractMethod* m3_1 = klass1->GetVirtualMethod(2); + ArtMethod* m3_1 = klass1->GetVirtualMethod(2); mh.ChangeMethod(m3_1); EXPECT_STREQ(mh.GetName(), "m3"); - AbstractMethod* m4_1 = klass1->GetVirtualMethod(3); + ArtMethod* m4_1 = klass1->GetVirtualMethod(3); mh.ChangeMethod(m4_1); EXPECT_STREQ(mh.GetName(), "m4"); - AbstractMethod* m1_2 = klass2->GetVirtualMethod(0); + ArtMethod* m1_2 = klass2->GetVirtualMethod(0); mh.ChangeMethod(m1_2); EXPECT_STREQ(mh.GetName(), "m1"); - AbstractMethod* m2_2 = klass2->GetVirtualMethod(1); + ArtMethod* m2_2 = klass2->GetVirtualMethod(1); mh.ChangeMethod(m2_2); EXPECT_STREQ(mh.GetName(), "m2"); - AbstractMethod* m3_2 = klass2->GetVirtualMethod(2); + ArtMethod* m3_2 = klass2->GetVirtualMethod(2); mh.ChangeMethod(m3_2); EXPECT_STREQ(mh.GetName(), "m3"); - AbstractMethod* m4_2 = klass2->GetVirtualMethod(3); + ArtMethod* m4_2 = klass2->GetVirtualMethod(3); mh.ChangeMethod(m4_2); EXPECT_STREQ(mh.GetName(), "m4"); @@ -593,8 +593,8 @@ TEST_F(ObjectTest, FindInstanceField) { EXPECT_TRUE(c->FindInstanceField("Count", "I") == NULL); // Right name and type. - Field* f1 = c->FindDeclaredInstanceField("count", "I"); - Field* f2 = c->FindInstanceField("count", "I"); + ArtField* f1 = c->FindDeclaredInstanceField("count", "I"); + ArtField* f2 = c->FindInstanceField("count", "I"); EXPECT_TRUE(f1 != NULL); EXPECT_TRUE(f2 != NULL); EXPECT_EQ(f1, f2); @@ -626,8 +626,8 @@ TEST_F(ObjectTest, FindStaticField) { EXPECT_TRUE(c->FindStaticField("cASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;") == NULL); // Right name and type. - Field* f1 = c->FindDeclaredStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); - Field* f2 = c->FindStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); + ArtField* f1 = c->FindDeclaredStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); + ArtField* f2 = c->FindStaticField("CASE_INSENSITIVE_ORDER", "Ljava/util/Comparator;"); EXPECT_TRUE(f1 != NULL); EXPECT_TRUE(f2 != NULL); EXPECT_EQ(f1, f2); diff --git a/runtime/mirror/throwable.cc b/runtime/mirror/throwable.cc index 78b76dc6ef..961f6deed3 100644 --- a/runtime/mirror/throwable.cc +++ b/runtime/mirror/throwable.cc @@ -16,7 +16,7 @@ #include "throwable.h" -#include "abstract_method-inl.h" +#include "art_method-inl.h" #include "class-inl.h" #include "dex_file-inl.h" #include "gc/accounting/card_table-inl.h" @@ -65,7 +65,7 @@ std::string Throwable::Dump() const { IntArray* pc_trace = down_cast(method_trace->Get(depth)); MethodHelper mh; for (int32_t i = 0; i < depth; ++i) { - AbstractMethod* method = down_cast(method_trace->Get(i)); + ArtMethod* method = down_cast(method_trace->Get(i)); mh.ChangeMethod(method); uint32_t dex_pc = pc_trace->Get(i); int32_t line_number = mh.GetLineNumFromDexPC(dex_pc); diff --git a/runtime/monitor.cc b/runtime/monitor.cc index 09a952b3cf..48c05692b4 100644 --- a/runtime/monitor.cc +++ b/runtime/monitor.cc @@ -23,7 +23,7 @@ #include "class_linker.h" #include "dex_file-inl.h" #include "dex_instruction.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" @@ -204,7 +204,7 @@ void Monitor::Lock(Thread* self) { uint64_t waitStart = 0; uint64_t waitEnd = 0; uint32_t wait_threshold = lock_profiling_threshold_; - const mirror::AbstractMethod* current_locking_method = NULL; + const mirror::ArtMethod* current_locking_method = NULL; uint32_t current_locking_dex_pc = 0; { ScopedThreadStateChange tsc(self, kBlocked); @@ -433,7 +433,7 @@ void Monitor::WaitWithLock(Thread* self, int64_t ms, int32_t ns, int prev_lock_count = lock_count_; lock_count_ = 0; owner_ = NULL; - const mirror::AbstractMethod* saved_method = locking_method_; + const mirror::ArtMethod* saved_method = locking_method_; locking_method_ = NULL; uintptr_t saved_dex_pc = locking_dex_pc_; locking_dex_pc_ = 0; @@ -888,7 +888,7 @@ mirror::Object* Monitor::GetContendedMonitor(Thread* thread) { void Monitor::VisitLocks(StackVisitor* stack_visitor, void (*callback)(mirror::Object*, void*), void* callback_context) { - mirror::AbstractMethod* m = stack_visitor->GetMethod(); + mirror::ArtMethod* m = stack_visitor->GetMethod(); CHECK(m != NULL); // Native methods are an easy special case. @@ -948,7 +948,7 @@ void Monitor::VisitLocks(StackVisitor* stack_visitor, void (*callback)(mirror::O } } -void Monitor::TranslateLocation(const mirror::AbstractMethod* method, uint32_t dex_pc, +void Monitor::TranslateLocation(const mirror::ArtMethod* method, uint32_t dex_pc, const char*& source_file, uint32_t& line_number) const { // If method is null, location is unknown if (method == NULL) { diff --git a/runtime/monitor.h b/runtime/monitor.h index 3b06217374..02c10a7a10 100644 --- a/runtime/monitor.h +++ b/runtime/monitor.h @@ -56,8 +56,8 @@ namespace art { #define LW_LOCK_OWNER(x) (((x) >> LW_LOCK_OWNER_SHIFT) & LW_LOCK_OWNER_MASK) namespace mirror { -class AbstractMethod; -class Object; + class ArtMethod; + class Object; } // namespace mirror class Thread; class StackVisitor; @@ -141,7 +141,7 @@ class Monitor { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Translates the provided method and pc into its declaring class' source file and line number. - void TranslateLocation(const mirror::AbstractMethod* method, uint32_t pc, + void TranslateLocation(const mirror::ArtMethod* method, uint32_t pc, const char*& source_file, uint32_t& line_number) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -165,7 +165,7 @@ class Monitor { // Method and dex pc where the lock owner acquired the lock, used when lock // sampling is enabled. locking_method_ may be null if the lock is currently // unlocked, or if the lock is acquired by the system when the stack is empty. - const mirror::AbstractMethod* locking_method_ GUARDED_BY(monitor_lock_); + const mirror::ArtMethod* locking_method_ GUARDED_BY(monitor_lock_); uint32_t locking_dex_pc_ GUARDED_BY(monitor_lock_); friend class MonitorInfo; diff --git a/runtime/monitor_android.cc b/runtime/monitor_android.cc index 9265cd649d..8efa0721e8 100644 --- a/runtime/monitor_android.cc +++ b/runtime/monitor_android.cc @@ -78,7 +78,7 @@ void Monitor::LogContentionEvent(Thread* self, uint32_t wait_ms, uint32_t sample // Emit the source code file name, <= 37 bytes. uint32_t pc; - mirror::AbstractMethod* m = self->GetCurrentMethod(&pc); + mirror::ArtMethod* m = self->GetCurrentMethod(&pc); const char* filename; uint32_t line_number; TranslateLocation(m, pc, filename, line_number); diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc index 1a80d6286b..eaf67b8f02 100644 --- a/runtime/native/dalvik_system_VMStack.cc +++ b/runtime/native/dalvik_system_VMStack.cc @@ -16,7 +16,7 @@ #include "jni_internal.h" #include "nth_caller_visitor.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" #include "mirror/object-inl.h" diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc index 918021748b..85556ac16e 100644 --- a/runtime/native/java_lang_reflect_Constructor.cc +++ b/runtime/native/java_lang_reflect_Constructor.cc @@ -16,13 +16,14 @@ #include "class_linker.h" #include "jni_internal.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "object_utils.h" #include "reflection.h" #include "scoped_thread_state_change.h" +#include "well_known_classes.h" namespace art { @@ -35,7 +36,10 @@ namespace art { */ static jobject Constructor_newInstance(JNIEnv* env, jobject javaMethod, jobjectArray javaArgs) { ScopedObjectAccess soa(env); - mirror::AbstractMethod* m = soa.Decode(javaMethod)->AsMethod(); + jobject art_method = soa.Env()->GetObjectField( + javaMethod, WellKnownClasses::java_lang_reflect_AbstractMethod_artMethod); + + mirror::ArtMethod* m = soa.Decode(art_method)->AsArtMethod(); mirror::Class* c = m->GetDeclaringClass(); if (UNLIKELY(c->IsAbstract())) { ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow(); diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc index b0daa916c6..00f89b65ea 100644 --- a/runtime/native/java_lang_reflect_Field.cc +++ b/runtime/native/java_lang_reflect_Field.cc @@ -19,16 +19,15 @@ #include "common_throws.h" #include "dex_file-inl.h" #include "jni_internal.h" +#include "mirror/art_field-inl.h" #include "mirror/class-inl.h" -#include "mirror/field.h" -#include "mirror/field-inl.h" #include "object_utils.h" #include "reflection.h" #include "scoped_thread_state_change.h" namespace art { -static bool GetFieldValue(const ScopedObjectAccess& soa, mirror::Object* o, mirror::Field* f, +static bool GetFieldValue(const ScopedObjectAccess& soa, mirror::Object* o, mirror::ArtField* f, JValue& value, bool allow_references) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK_EQ(value.GetJ(), 0LL); @@ -78,7 +77,7 @@ static bool GetFieldValue(const ScopedObjectAccess& soa, mirror::Object* o, mirr return false; } -static bool CheckReceiver(const ScopedObjectAccess& soa, jobject j_rcvr, mirror::Field* f, +static bool CheckReceiver(const ScopedObjectAccess& soa, jobject j_rcvr, mirror::ArtField* f, mirror::Object*& class_or_rcvr) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (f->IsStatic()) { @@ -96,7 +95,7 @@ static bool CheckReceiver(const ScopedObjectAccess& soa, jobject j_rcvr, mirror: static jobject Field_get(JNIEnv* env, jobject javaField, jobject javaObj) { ScopedObjectAccess soa(env); - mirror::Field* f = soa.DecodeField(env->FromReflectedField(javaField)); + mirror::ArtField* f = soa.DecodeField(env->FromReflectedField(javaField)); mirror::Object* o = NULL; if (!CheckReceiver(soa, javaObj, f, o)) { return NULL; @@ -111,9 +110,10 @@ static jobject Field_get(JNIEnv* env, jobject javaField, jobject javaObj) { soa.AddLocalReference(BoxPrimitive(FieldHelper(f).GetTypeAsPrimitiveType(), value)); } -static JValue GetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char dst_descriptor) { +static JValue GetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, + char dst_descriptor) { ScopedObjectAccess soa(env); - mirror::Field* f = soa.DecodeField(env->FromReflectedField(javaField)); + mirror::ArtField* f = soa.DecodeField(env->FromReflectedField(javaField)); mirror::Object* o = NULL; if (!CheckReceiver(soa, javaObj, f, o)) { return JValue(); @@ -127,7 +127,8 @@ static JValue GetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, // Widen it if necessary (and possible). JValue wide_value; - mirror::Class* dst_type = Runtime::Current()->GetClassLinker()->FindPrimitiveClass(dst_descriptor); + mirror::Class* dst_type = + Runtime::Current()->GetClassLinker()->FindPrimitiveClass(dst_descriptor); if (!ConvertPrimitiveValue(NULL, false, FieldHelper(f).GetTypeAsPrimitiveType(), dst_type->GetPrimitiveType(), field_value, wide_value)) { return JValue(); @@ -167,7 +168,7 @@ static jshort Field_getShort(JNIEnv* env, jobject javaField, jobject javaObj) { return GetPrimitiveField(env, javaField, javaObj, 'S').GetS(); } -static void SetFieldValue(mirror::Object* o, mirror::Field* f, const JValue& new_value, +static void SetFieldValue(mirror::Object* o, mirror::ArtField* f, const JValue& new_value, bool allow_references) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(f->GetDeclaringClass(), @@ -221,7 +222,7 @@ static void SetFieldValue(mirror::Object* o, mirror::Field* f, const JValue& new static void Field_set(JNIEnv* env, jobject javaField, jobject javaObj, jobject javaValue) { ScopedObjectAccess soa(env); - mirror::Field* f = soa.DecodeField(env->FromReflectedField(javaField)); + mirror::ArtField* f = soa.DecodeField(env->FromReflectedField(javaField)); // Unbox the value, if necessary. mirror::Object* boxed_value = soa.Decode(javaValue); @@ -242,7 +243,7 @@ static void Field_set(JNIEnv* env, jobject javaField, jobject javaObj, jobject j static void SetPrimitiveField(JNIEnv* env, jobject javaField, jobject javaObj, char src_descriptor, const JValue& new_value) { ScopedObjectAccess soa(env); - mirror::Field* f = soa.DecodeField(env->FromReflectedField(javaField)); + mirror::ArtField* f = soa.DecodeField(env->FromReflectedField(javaField)); mirror::Object* o = NULL; if (!CheckReceiver(soa, javaObj, f, o)) { return; diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc index 14dc6a44ee..d29de3debe 100644 --- a/runtime/native/java_lang_reflect_Method.cc +++ b/runtime/native/java_lang_reflect_Method.cc @@ -16,26 +16,31 @@ #include "class_linker.h" #include "jni_internal.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/proxy.h" #include "object_utils.h" #include "reflection.h" #include "scoped_thread_state_change.h" +#include "well_known_classes.h" namespace art { -static jobject Method_invoke(JNIEnv* env, jobject javaMethod, jobject javaReceiver, jobject javaArgs) { +static jobject Method_invoke(JNIEnv* env, + jobject javaMethod, jobject javaReceiver, jobject javaArgs) { ScopedObjectAccess soa(env); return InvokeMethod(soa, javaMethod, javaReceiver, javaArgs); } static jobject Method_getExceptionTypesNative(JNIEnv* env, jobject javaMethod) { ScopedObjectAccess soa(env); - mirror::AbstractMethod* proxy_method = soa.Decode(javaMethod)->AsMethod(); + jobject art_method = soa.Env()->GetObjectField( + javaMethod, WellKnownClasses::java_lang_reflect_AbstractMethod_artMethod); + + mirror::ArtMethod* proxy_method = soa.Decode(art_method)->AsArtMethod(); CHECK(proxy_method->GetDeclaringClass()->IsProxyClass()); mirror::SynthesizedProxyClass* proxy_class = down_cast(proxy_method->GetDeclaringClass()); @@ -48,20 +53,14 @@ static jobject Method_getExceptionTypesNative(JNIEnv* env, jobject javaMethod) { } } CHECK_NE(throws_index, -1); - mirror::ObjectArray* declared_exceptions = proxy_class->GetThrows()->Get(throws_index); + mirror::ObjectArray* declared_exceptions = + proxy_class->GetThrows()->Get(throws_index); return soa.AddLocalReference(declared_exceptions->Clone(soa.Self())); } -static jobject Method_findOverriddenMethodNative(JNIEnv* env, jobject javaMethod) { - ScopedObjectAccess soa(env); - mirror::AbstractMethod* method = soa.Decode(javaMethod)->AsMethod(); - return soa.AddLocalReference(method->FindOverriddenMethod()); -} - static JNINativeMethod gMethods[] = { NATIVE_METHOD(Method, invoke, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"), NATIVE_METHOD(Method, getExceptionTypesNative, "()[Ljava/lang/Class;"), - NATIVE_METHOD(Method, findOverriddenMethodNative, "()Ljava/lang/reflect/Method;"), }; void register_java_lang_reflect_Method(JNIEnv* env) { diff --git a/runtime/native/java_lang_reflect_Proxy.cc b/runtime/native/java_lang_reflect_Proxy.cc index 547ce7b38d..a92823a85d 100644 --- a/runtime/native/java_lang_reflect_Proxy.cc +++ b/runtime/native/java_lang_reflect_Proxy.cc @@ -31,8 +31,8 @@ static jclass Proxy_generateProxy(JNIEnv* env, jclass, jstring javaName, mirror::ObjectArray* interfaces = soa.Decode*>(javaInterfaces); mirror::ClassLoader* loader = soa.Decode(javaLoader); - mirror::ObjectArray* methods = - soa.Decode*>(javaMethods); + mirror::ObjectArray* methods = + soa.Decode*>(javaMethods); mirror::ObjectArray >* throws = soa.Decode >*>(javaThrows); ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); @@ -41,7 +41,7 @@ static jclass Proxy_generateProxy(JNIEnv* env, jclass, jstring javaName, } static JNINativeMethod gMethods[] = { - NATIVE_METHOD(Proxy, generateProxy, "(Ljava/lang/String;[Ljava/lang/Class;Ljava/lang/ClassLoader;[Ljava/lang/reflect/Method;[[Ljava/lang/Class;)Ljava/lang/Class;"), + NATIVE_METHOD(Proxy, generateProxy, "(Ljava/lang/String;[Ljava/lang/Class;Ljava/lang/ClassLoader;[Ljava/lang/reflect/ArtMethod;[[Ljava/lang/Class;)Ljava/lang/Class;"), }; void register_java_lang_reflect_Proxy(JNIEnv* env) { diff --git a/runtime/nth_caller_visitor.h b/runtime/nth_caller_visitor.h index e3593d805d..794878a08e 100644 --- a/runtime/nth_caller_visitor.h +++ b/runtime/nth_caller_visitor.h @@ -17,7 +17,7 @@ #ifndef ART_RUNTIME_NTH_CALLER_VISITOR_H_ #define ART_RUNTIME_NTH_CALLER_VISITOR_H_ -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "locks.h" #include "stack.h" @@ -31,7 +31,7 @@ struct NthCallerVisitor : public StackVisitor { count(0), caller(NULL) {} bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); bool do_count = false; if (m == NULL || m->IsRuntimeMethod()) { // Upcall. @@ -53,7 +53,7 @@ struct NthCallerVisitor : public StackVisitor { const size_t n; const bool include_runtime_and_upcalls_; size_t count; - mirror::AbstractMethod* caller; + mirror::ArtMethod* caller; }; } // namespace art diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index 93e98ad894..1f34317d26 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -22,9 +22,9 @@ #include "base/unix_file/fd_file.h" #include "elf_file.h" #include "oat.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/class.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" #include "mirror/object-inl.h" #include "os.h" #include "utils.h" @@ -453,7 +453,7 @@ uint32_t OatFile::OatMethod::GetCodeSize() const { #endif } -void OatFile::OatMethod::LinkMethod(mirror::AbstractMethod* method) const { +void OatFile::OatMethod::LinkMethod(mirror::ArtMethod* method) const { CHECK(method != NULL); method->SetEntryPointFromCompiledCode(GetCode()); method->SetFrameSizeInBytes(frame_size_in_bytes_); diff --git a/runtime/oat_file.h b/runtime/oat_file.h index 650301465b..325ebb2914 100644 --- a/runtime/oat_file.h +++ b/runtime/oat_file.h @@ -23,7 +23,7 @@ #include "dex_file.h" #include "invoke_type.h" #include "mem_map.h" -#include "mirror/abstract_method.h" +#include "mirror/art_method.h" #include "oat.h" #include "os.h" @@ -70,7 +70,7 @@ class OatFile { class OatMethod { public: - void LinkMethod(mirror::AbstractMethod* method) const; + void LinkMethod(mirror::ArtMethod* method) const; uint32_t GetCodeOffset() const { return code_offset_; diff --git a/runtime/oat_test.cc b/runtime/oat_test.cc index 68595c896d..74b5da9eff 100644 --- a/runtime/oat_test.cc +++ b/runtime/oat_test.cc @@ -15,7 +15,7 @@ */ #include "compiler/oat_writer.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" @@ -28,7 +28,7 @@ namespace art { class OatTest : public CommonTest { protected: - void CheckMethod(mirror::AbstractMethod* method, + void CheckMethod(mirror::ArtMethod* method, const OatFile::OatMethod& oat_method, const DexFile* dex_file) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { diff --git a/runtime/object_utils.h b/runtime/object_utils.h index 3639a80e77..29102437a2 100644 --- a/runtime/object_utils.h +++ b/runtime/object_utils.h @@ -20,10 +20,10 @@ #include "class_linker-inl.h" #include "dex_file.h" #include "monitor.h" -#include "mirror/abstract_method.h" +#include "mirror/art_field.h" +#include "mirror/art_method.h" #include "mirror/class.h" #include "mirror/dex_cache.h" -#include "mirror/field.h" #include "mirror/iftable.h" #include "mirror/string.h" @@ -256,11 +256,11 @@ class ClassHelper { class FieldHelper { public: FieldHelper() : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(NULL) {} - explicit FieldHelper(const mirror::Field* f) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(f) {} - FieldHelper(const mirror::Field* f, ClassLinker* l) + explicit FieldHelper(const mirror::ArtField* f) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), field_(f) {} + FieldHelper(const mirror::ArtField* f, ClassLinker* l) : class_linker_(l), dex_cache_(NULL), dex_file_(NULL), field_(f) {} - void ChangeField(const mirror::Field* new_f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + void ChangeField(const mirror::ArtField* new_f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(new_f != NULL); if (dex_cache_ != NULL) { mirror::DexCache* new_f_dex_cache = new_f->GetDeclaringClass()->GetDexCache(); @@ -366,7 +366,7 @@ class FieldHelper { ClassLinker* class_linker_; mirror::DexCache* dex_cache_; const DexFile* dex_file_; - const mirror::Field* field_; + const mirror::ArtField* field_; std::string declaring_class_descriptor_; DISALLOW_COPY_AND_ASSIGN(FieldHelper); @@ -378,21 +378,21 @@ class MethodHelper { : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), method_(NULL), shorty_(NULL), shorty_len_(0) {} - explicit MethodHelper(const mirror::AbstractMethod* m) + explicit MethodHelper(const mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : class_linker_(NULL), dex_cache_(NULL), dex_file_(NULL), method_(NULL), shorty_(NULL), shorty_len_(0) { SetMethod(m); } - MethodHelper(const mirror::AbstractMethod* m, ClassLinker* l) + MethodHelper(const mirror::ArtMethod* m, ClassLinker* l) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : class_linker_(l), dex_cache_(NULL), dex_file_(NULL), method_(NULL), shorty_(NULL), shorty_len_(0) { SetMethod(m); } - void ChangeMethod(mirror::AbstractMethod* new_m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + void ChangeMethod(mirror::ArtMethod* new_m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { DCHECK(new_m != NULL); if (dex_cache_ != NULL) { mirror::Class* klass = new_m->GetDeclaringClass(); @@ -411,7 +411,7 @@ class MethodHelper { shorty_ = NULL; } - const mirror::AbstractMethod* GetMethod() const { + const mirror::ArtMethod* GetMethod() const { return method_; } @@ -653,11 +653,11 @@ class MethodHelper { private: // Set the method_ field, for proxy methods looking up the interface method via the resolved // methods table. - void SetMethod(const mirror::AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + void SetMethod(const mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (method != NULL) { mirror::Class* klass = method->GetDeclaringClass(); if (UNLIKELY(klass->IsProxyClass())) { - mirror::AbstractMethod* interface_method = + mirror::ArtMethod* interface_method = method->GetDexCacheResolvedMethods()->Get(method->GetDexMethodIndex()); DCHECK(interface_method != NULL); DCHECK(interface_method == GetClassLinker()->FindMethodForProxy(klass, method)); @@ -679,7 +679,7 @@ class MethodHelper { ClassLinker* class_linker_; mirror::DexCache* dex_cache_; const DexFile* dex_file_; - const mirror::AbstractMethod* method_; + const mirror::ArtMethod* method_; const char* shorty_; uint32_t shorty_len_; diff --git a/runtime/reflection.cc b/runtime/reflection.cc index 8e478ff969..3e58b4bd94 100644 --- a/runtime/reflection.cc +++ b/runtime/reflection.cc @@ -21,11 +21,10 @@ #include "dex_file-inl.h" #include "invoke_arg_array_builder.h" #include "jni_internal.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" -#include "mirror/field-inl.h" #include "mirror/object_array.h" #include "mirror/object_array-inl.h" #include "object_utils.h" @@ -37,7 +36,7 @@ namespace art { jobject InvokeMethod(const ScopedObjectAccess& soa, jobject javaMethod, jobject javaReceiver, jobject javaArgs) { jmethodID mid = soa.Env()->FromReflectedMethod(javaMethod); - mirror::AbstractMethod* m = soa.DecodeMethod(mid); + mirror::ArtMethod* m = soa.DecodeMethod(mid); mirror::Class* declaring_class = m->GetDeclaringClass(); if (!Runtime::Current()->GetClassLinker()->EnsureInitialized(declaring_class, true, true)) { @@ -267,7 +266,7 @@ mirror::Object* BoxPrimitive(Primitive::Type src_class, const JValue& value) { return result.GetL(); } -static std::string UnboxingFailureKind(mirror::AbstractMethod* m, int index, mirror::Field* f) +static std::string UnboxingFailureKind(mirror::ArtMethod* m, int index, mirror::ArtField* f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { if (m != NULL && index != -1) { ++index; // Humans count from 1. @@ -281,7 +280,7 @@ static std::string UnboxingFailureKind(mirror::AbstractMethod* m, int index, mir static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value, - mirror::AbstractMethod* m, int index, mirror::Field* f) + mirror::ArtMethod* m, int index, mirror::ArtField* f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { bool unbox_for_result = (f == NULL) && (index == -1); if (!dst_class->IsPrimitive()) { @@ -327,7 +326,7 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object* std::string src_descriptor(ClassHelper(o->GetClass()).GetDescriptor()); mirror::Class* src_class = NULL; ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); - mirror::Field* primitive_field = o->GetClass()->GetIFields()->Get(0); + mirror::ArtField* primitive_field = o->GetClass()->GetIFields()->Get(0); if (src_descriptor == "Ljava/lang/Boolean;") { src_class = class_linker->FindPrimitiveClass('Z'); boxed_value.SetZ(primitive_field->GetBoolean(o)); @@ -367,13 +366,13 @@ static bool UnboxPrimitive(const ThrowLocation* throw_location, mirror::Object* } bool UnboxPrimitiveForArgument(mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value, - mirror::AbstractMethod* m, size_t index) { + mirror::ArtMethod* m, size_t index) { CHECK(m != NULL); return UnboxPrimitive(NULL, o, dst_class, unboxed_value, m, index, NULL); } bool UnboxPrimitiveForField(mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value, - mirror::Field* f) { + mirror::ArtField* f) { CHECK(f != NULL); return UnboxPrimitive(NULL, o, dst_class, unboxed_value, NULL, -1, f); } diff --git a/runtime/reflection.h b/runtime/reflection.h index 56ab4712db..13c90af895 100644 --- a/runtime/reflection.h +++ b/runtime/reflection.h @@ -22,10 +22,10 @@ namespace art { namespace mirror { -class AbstractMethod; -class Class; -class Field; -class Object; + class ArtField; + class ArtMethod; + class Class; + class Object; } // namespace mirror union JValue; class ScopedObjectAccess; @@ -34,10 +34,10 @@ class ThrowLocation; mirror::Object* BoxPrimitive(Primitive::Type src_class, const JValue& value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool UnboxPrimitiveForArgument(mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value, - mirror::AbstractMethod* m, size_t index) + mirror::ArtMethod* m, size_t index) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool UnboxPrimitiveForField(mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value, - mirror::Field* f) + mirror::ArtField* f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool UnboxPrimitiveForResult(const ThrowLocation& throw_location, mirror::Object* o, mirror::Class* dst_class, JValue& unboxed_value) diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 70d8816401..7b12870872 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -42,12 +42,11 @@ #include "intern_table.h" #include "invoke_arg_array_builder.h" #include "jni_internal.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/array.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" -#include "mirror/field.h" -#include "mirror/field-inl.h" #include "mirror/throwable.h" #include "monitor.h" #include "oat_file.h" @@ -654,7 +653,7 @@ static void CreateSystemClassLoader() { soa.Decode(WellKnownClasses::java_lang_ClassLoader); CHECK(Runtime::Current()->GetClassLinker()->EnsureInitialized(class_loader_class, true, true)); - mirror::AbstractMethod* getSystemClassLoader = + mirror::ArtMethod* getSystemClassLoader = class_loader_class->FindDirectMethod("getSystemClassLoader", "()Ljava/lang/ClassLoader;"); CHECK(getSystemClassLoader != NULL); @@ -669,8 +668,8 @@ static void CreateSystemClassLoader() { mirror::Class* thread_class = soa.Decode(WellKnownClasses::java_lang_Thread); CHECK(Runtime::Current()->GetClassLinker()->EnsureInitialized(thread_class, true, true)); - mirror::Field* contextClassLoader = thread_class->FindDeclaredInstanceField("contextClassLoader", - "Ljava/lang/ClassLoader;"); + mirror::ArtField* contextClassLoader = thread_class->FindDeclaredInstanceField("contextClassLoader", + "Ljava/lang/ClassLoader;"); CHECK(contextClassLoader != NULL); contextClassLoader->SetObject(soa.Self()->GetPeer(), class_loader); @@ -1125,11 +1124,11 @@ void Runtime::VisitRoots(RootVisitor* visitor, void* arg, bool only_dirty, bool VisitNonConcurrentRoots(visitor, arg); } -mirror::AbstractMethod* Runtime::CreateResolutionMethod() { - mirror::Class* method_class = mirror::AbstractMethod::GetMethodClass(); +mirror::ArtMethod* Runtime::CreateResolutionMethod() { + mirror::Class* method_class = mirror::ArtMethod::GetJavaLangReflectArtMethod(); Thread* self = Thread::Current(); - SirtRef - method(self, down_cast(method_class->AllocObject(self))); + SirtRef + method(self, down_cast(method_class->AllocObject(self))); method->SetDeclaringClass(method_class); // TODO: use a special method for resolution method saves method->SetDexMethodIndex(DexFile::kDexNoIndex16); @@ -1140,12 +1139,12 @@ mirror::AbstractMethod* Runtime::CreateResolutionMethod() { return method.get(); } -mirror::AbstractMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instruction_set, +mirror::ArtMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instruction_set, CalleeSaveType type) { - mirror::Class* method_class = mirror::AbstractMethod::GetMethodClass(); + mirror::Class* method_class = mirror::ArtMethod::GetJavaLangReflectArtMethod(); Thread* self = Thread::Current(); - SirtRef - method(self, down_cast(method_class->AllocObject(self))); + SirtRef + method(self, down_cast(method_class->AllocObject(self))); method->SetDeclaringClass(method_class); // TODO: use a special method for callee saves method->SetDexMethodIndex(DexFile::kDexNoIndex16); @@ -1205,7 +1204,7 @@ mirror::AbstractMethod* Runtime::CreateCalleeSaveMethod(InstructionSet instructi return method.get(); } -void Runtime::SetCalleeSaveMethod(mirror::AbstractMethod* method, CalleeSaveType type) { +void Runtime::SetCalleeSaveMethod(mirror::ArtMethod* method, CalleeSaveType type) { DCHECK_LT(static_cast(type), static_cast(kLastCalleeSaveType)); callee_save_methods_[type] = method; } diff --git a/runtime/runtime.h b/runtime/runtime.h index d67265a42d..b93ae9daeb 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -43,7 +43,7 @@ namespace gc { class Heap; } namespace mirror { - class AbstractMethod; + class ArtMethod; class ClassLoader; template class PrimitiveArray; typedef PrimitiveArray ByteArray; @@ -310,7 +310,7 @@ class Runtime { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns a special method that calls into a trampoline for runtime method resolution - mirror::AbstractMethod* GetResolutionMethod() const { + mirror::ArtMethod* GetResolutionMethod() const { CHECK(HasResolutionMethod()); return resolution_method_; } @@ -319,11 +319,11 @@ class Runtime { return resolution_method_ != NULL; } - void SetResolutionMethod(mirror::AbstractMethod* method) { + void SetResolutionMethod(mirror::ArtMethod* method) { resolution_method_ = method; } - mirror::AbstractMethod* CreateResolutionMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + mirror::ArtMethod* CreateResolutionMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns a special method that describes all callee saves being spilled to the stack. enum CalleeSaveType { @@ -337,21 +337,21 @@ class Runtime { return callee_save_methods_[type] != NULL; } - mirror::AbstractMethod* GetCalleeSaveMethod(CalleeSaveType type) const { + mirror::ArtMethod* GetCalleeSaveMethod(CalleeSaveType type) const { DCHECK(HasCalleeSaveMethod(type)); return callee_save_methods_[type]; } - void SetCalleeSaveMethod(mirror::AbstractMethod* method, CalleeSaveType type); + void SetCalleeSaveMethod(mirror::ArtMethod* method, CalleeSaveType type); - mirror::AbstractMethod* CreateCalleeSaveMethod(InstructionSet instruction_set, + mirror::ArtMethod* CreateCalleeSaveMethod(InstructionSet instruction_set, CalleeSaveType type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* CreateRefOnlyCalleeSaveMethod(InstructionSet instruction_set) + mirror::ArtMethod* CreateRefOnlyCalleeSaveMethod(InstructionSet instruction_set) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* CreateRefAndArgsCalleeSaveMethod(InstructionSet instruction_set) + mirror::ArtMethod* CreateRefAndArgsCalleeSaveMethod(InstructionSet instruction_set) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); int32_t GetStat(int kind); @@ -451,9 +451,9 @@ class Runtime { mirror::Throwable* pre_allocated_OutOfMemoryError_; - mirror::AbstractMethod* callee_save_methods_[kLastCalleeSaveType]; + mirror::ArtMethod* callee_save_methods_[kLastCalleeSaveType]; - mirror::AbstractMethod* resolution_method_; + mirror::ArtMethod* resolution_method_; // As returned by ClassLoader.getSystemClassLoader() mirror::ClassLoader* system_class_loader_; diff --git a/runtime/scoped_thread_state_change.h b/runtime/scoped_thread_state_change.h index 965e6b85ac..5f649b117b 100644 --- a/runtime/scoped_thread_state_change.h +++ b/runtime/scoped_thread_state_change.h @@ -204,7 +204,7 @@ class ScopedObjectAccessUnchecked : public ScopedThreadStateChange { return down_cast(Self()->DecodeJObject(obj)); } - mirror::Field* DecodeField(jfieldID fid) const + mirror::ArtField* DecodeField(jfieldID fid) const LOCKS_EXCLUDED(JavaVMExt::globals_lock, JavaVMExt::weak_globals_lock) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -214,10 +214,10 @@ class ScopedObjectAccessUnchecked : public ScopedThreadStateChange { // TODO: we should make these unique weak globals if Field instances can ever move. UNIMPLEMENTED(WARNING); #endif - return reinterpret_cast(fid); + return reinterpret_cast(fid); } - jfieldID EncodeField(mirror::Field* field) const + jfieldID EncodeField(mirror::ArtField* field) const LOCKS_EXCLUDED(JavaVMExt::globals_lock, JavaVMExt::weak_globals_lock) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -229,7 +229,7 @@ class ScopedObjectAccessUnchecked : public ScopedThreadStateChange { return reinterpret_cast(field); } - mirror::AbstractMethod* DecodeMethod(jmethodID mid) const + mirror::ArtMethod* DecodeMethod(jmethodID mid) const LOCKS_EXCLUDED(JavaVMExt::globals_lock, JavaVMExt::weak_globals_lock) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { @@ -239,10 +239,10 @@ class ScopedObjectAccessUnchecked : public ScopedThreadStateChange { // TODO: we should make these unique weak globals if Method instances can ever move. UNIMPLEMENTED(WARNING); #endif - return reinterpret_cast(mid); + return reinterpret_cast(mid); } - jmethodID EncodeMethod(mirror::AbstractMethod* method) const + jmethodID EncodeMethod(mirror::ArtMethod* method) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { Locks::mutator_lock_->AssertSharedHeld(Self()); DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. diff --git a/runtime/stack.cc b/runtime/stack.cc index e1a752adb9..206bff3425 100644 --- a/runtime/stack.cc +++ b/runtime/stack.cc @@ -16,7 +16,7 @@ #include "stack.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object.h" #include "mirror/object-inl.h" @@ -29,7 +29,7 @@ namespace art { mirror::Object* ShadowFrame::GetThisObject() const { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (m->IsStatic()) { return NULL; } else if (m->IsNative()) { @@ -43,7 +43,7 @@ mirror::Object* ShadowFrame::GetThisObject() const { } mirror::Object* ShadowFrame::GetThisObject(uint16_t num_ins) const { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (m->IsStatic()) { return NULL; } else { @@ -101,7 +101,7 @@ uint32_t StackVisitor::GetDexPc() const { } mirror::Object* StackVisitor::GetThisObject() const { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (m->IsStatic()) { return NULL; } else if (m->IsNative()) { @@ -132,7 +132,7 @@ size_t StackVisitor::GetNativePcOffset() const { return GetMethod()->NativePcOffset(cur_quick_frame_pc_); } -uint32_t StackVisitor::GetVReg(mirror::AbstractMethod* m, uint16_t vreg, VRegKind kind) const { +uint32_t StackVisitor::GetVReg(mirror::ArtMethod* m, uint16_t vreg, VRegKind kind) const { if (cur_quick_frame_ != NULL) { DCHECK(context_ != NULL); // You can't reliably read registers without a context. DCHECK(m == GetMethod()); @@ -156,7 +156,7 @@ uint32_t StackVisitor::GetVReg(mirror::AbstractMethod* m, uint16_t vreg, VRegKin } } -void StackVisitor::SetVReg(mirror::AbstractMethod* m, uint16_t vreg, uint32_t new_value, +void StackVisitor::SetVReg(mirror::ArtMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind) { if (cur_quick_frame_ != NULL) { DCHECK(context_ != NULL); // You can't reliably write registers without a context. @@ -195,14 +195,14 @@ void StackVisitor::SetGPR(uint32_t reg, uintptr_t value) { } uintptr_t StackVisitor::GetReturnPc() const { - mirror::AbstractMethod** sp = GetCurrentQuickFrame(); + mirror::ArtMethod** sp = GetCurrentQuickFrame(); DCHECK(sp != NULL); byte* pc_addr = reinterpret_cast(sp) + GetMethod()->GetReturnPcOffsetInBytes(); return *reinterpret_cast(pc_addr); } void StackVisitor::SetReturnPc(uintptr_t new_ret_pc) { - mirror::AbstractMethod** sp = GetCurrentQuickFrame(); + mirror::ArtMethod** sp = GetCurrentQuickFrame(); CHECK(sp != NULL); byte* pc_addr = reinterpret_cast(sp) + GetMethod()->GetReturnPcOffsetInBytes(); *reinterpret_cast(pc_addr) = new_ret_pc; @@ -241,7 +241,7 @@ void StackVisitor::DescribeStack(Thread* thread) { std::string StackVisitor::DescribeLocation() const { std::string result("Visiting method '"); - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (m == NULL) { return "upcall"; } @@ -259,9 +259,8 @@ instrumentation::InstrumentationStackFrame StackVisitor::GetInstrumentationStack void StackVisitor::SanityCheckFrame() const { #ifndef NDEBUG - mirror::AbstractMethod* method = GetMethod(); - CHECK(method->GetClass() == mirror::AbstractMethod::GetMethodClass() || - method->GetClass() == mirror::AbstractMethod::GetConstructorClass()); + mirror::ArtMethod* method = GetMethod(); + CHECK(method->GetClass() == mirror::ArtMethod::GetJavaLangReflectArtMethod()); if (cur_quick_frame_ != NULL) { method->AssertPcIsWithinCode(cur_quick_frame_pc_); // Frame sanity. @@ -291,7 +290,7 @@ void StackVisitor::WalkStack(bool include_transitions) { if (cur_quick_frame_ != NULL) { // Handle quick stack frames. // Can't be both a shadow and a quick fragment. DCHECK(current_fragment->GetTopShadowFrame() == NULL); - mirror::AbstractMethod* method = *cur_quick_frame_; + mirror::ArtMethod* method = *cur_quick_frame_; while (method != NULL) { SanityCheckFrame(); bool should_continue = VisitFrame(); @@ -316,7 +315,7 @@ void StackVisitor::WalkStack(bool include_transitions) { if (GetMethod() == Runtime::Current()->GetCalleeSaveMethod(Runtime::kSaveAll)) { // Skip runtime save all callee frames which are used to deliver exceptions. } else if (instrumentation_frame.interpreter_entry_) { - mirror::AbstractMethod* callee = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsAndArgs); + mirror::ArtMethod* callee = Runtime::Current()->GetCalleeSaveMethod(Runtime::kRefsAndArgs); CHECK_EQ(GetMethod(), callee) << "Expected: " << PrettyMethod(callee) << " Found: " << PrettyMethod(GetMethod()); } else if (instrumentation_frame.method_ != GetMethod()) { @@ -335,7 +334,7 @@ void StackVisitor::WalkStack(bool include_transitions) { } cur_quick_frame_pc_ = return_pc; byte* next_frame = reinterpret_cast(cur_quick_frame_) + frame_size; - cur_quick_frame_ = reinterpret_cast(next_frame); + cur_quick_frame_ = reinterpret_cast(next_frame); cur_depth_++; method = *cur_quick_frame_; } diff --git a/runtime/stack.h b/runtime/stack.h index 388e4014c1..8ecf8f0571 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -28,8 +28,8 @@ namespace art { namespace mirror { -class AbstractMethod; -class Object; + class ArtMethod; + class Object; } // namespace mirror class Context; @@ -66,7 +66,7 @@ class ShadowFrame { // Create ShadowFrame in heap for deoptimization. static ShadowFrame* Create(uint32_t num_vregs, ShadowFrame* link, - mirror::AbstractMethod* method, uint32_t dex_pc) { + mirror::ArtMethod* method, uint32_t dex_pc) { uint8_t* memory = new uint8_t[ComputeSize(num_vregs)]; ShadowFrame* sf = new (memory) ShadowFrame(num_vregs, link, method, dex_pc, true); return sf; @@ -74,7 +74,7 @@ class ShadowFrame { // Create ShadowFrame for interpreter using provided memory. static ShadowFrame* Create(uint32_t num_vregs, ShadowFrame* link, - mirror::AbstractMethod* method, uint32_t dex_pc, void* memory) { + mirror::ArtMethod* method, uint32_t dex_pc, void* memory) { ShadowFrame* sf = new (memory) ShadowFrame(num_vregs, link, method, dex_pc, true); return sf; } @@ -195,7 +195,7 @@ class ShadowFrame { } } - mirror::AbstractMethod* GetMethod() const { + mirror::ArtMethod* GetMethod() const { DCHECK_NE(method_, static_cast(NULL)); return method_; } @@ -206,7 +206,7 @@ class ShadowFrame { ThrowLocation GetCurrentLocationForThrow() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetMethod(mirror::AbstractMethod* method) { + void SetMethod(mirror::ArtMethod* method) { #if defined(ART_USE_PORTABLE_COMPILER) DCHECK_NE(method, static_cast(NULL)); method_ = method; @@ -248,7 +248,7 @@ class ShadowFrame { } private: - ShadowFrame(uint32_t num_vregs, ShadowFrame* link, mirror::AbstractMethod* method, + ShadowFrame(uint32_t num_vregs, ShadowFrame* link, mirror::ArtMethod* method, uint32_t dex_pc, bool has_reference_array) : number_of_vregs_(num_vregs), link_(link), method_(method), dex_pc_(dex_pc) { if (has_reference_array) { @@ -285,9 +285,9 @@ class ShadowFrame { ShadowFrame* link_; #if defined(ART_USE_PORTABLE_COMPILER) // TODO: make const in the portable case. - mirror::AbstractMethod* method_; + mirror::ArtMethod* method_; #else - mirror::AbstractMethod* const method_; + mirror::ArtMethod* const method_; #endif uint32_t dex_pc_; uint32_t vregs_[0]; @@ -323,11 +323,11 @@ class PACKED(4) ManagedStack { return link_; } - mirror::AbstractMethod** GetTopQuickFrame() const { + mirror::ArtMethod** GetTopQuickFrame() const { return top_quick_frame_; } - void SetTopQuickFrame(mirror::AbstractMethod** top) { + void SetTopQuickFrame(mirror::ArtMethod** top) { DCHECK(top_shadow_frame_ == NULL); top_quick_frame_ = top; } @@ -385,7 +385,7 @@ class PACKED(4) ManagedStack { private: ManagedStack* link_; ShadowFrame* top_shadow_frame_; - mirror::AbstractMethod** top_quick_frame_; + mirror::ArtMethod** top_quick_frame_; uintptr_t top_quick_frame_pc_; }; @@ -402,7 +402,7 @@ class StackVisitor { void WalkStack(bool include_transitions = false) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* GetMethod() const { + mirror::ArtMethod* GetMethod() const { if (cur_shadow_frame_ != NULL) { return cur_shadow_frame_->GetMethod(); } else if (cur_quick_frame_ != NULL) { @@ -450,16 +450,16 @@ class StackVisitor { return num_frames_; } - uint32_t GetVReg(mirror::AbstractMethod* m, uint16_t vreg, VRegKind kind) const + uint32_t GetVReg(mirror::ArtMethod* m, uint16_t vreg, VRegKind kind) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void SetVReg(mirror::AbstractMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind) + void SetVReg(mirror::ArtMethod* m, uint16_t vreg, uint32_t new_value, VRegKind kind) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); uintptr_t GetGPR(uint32_t reg) const; void SetGPR(uint32_t reg, uintptr_t value); - uint32_t GetVReg(mirror::AbstractMethod** cur_quick_frame, const DexFile::CodeItem* code_item, + uint32_t GetVReg(mirror::ArtMethod** cur_quick_frame, const DexFile::CodeItem* code_item, uint32_t core_spills, uint32_t fp_spills, size_t frame_size, uint16_t vreg) const { int offset = GetVRegOffset(code_item, core_spills, fp_spills, frame_size, vreg); @@ -533,7 +533,7 @@ class StackVisitor { return cur_quick_frame_pc_; } - mirror::AbstractMethod** GetCurrentQuickFrame() const { + mirror::ArtMethod** GetCurrentQuickFrame() const { return cur_quick_frame_; } @@ -542,7 +542,7 @@ class StackVisitor { } StackIndirectReferenceTable* GetCurrentSirt() const { - mirror::AbstractMethod** sp = GetCurrentQuickFrame(); + mirror::ArtMethod** sp = GetCurrentQuickFrame(); ++sp; // Skip Method*; SIRT comes next; return reinterpret_cast(sp); } @@ -560,7 +560,7 @@ class StackVisitor { Thread* const thread_; ShadowFrame* cur_shadow_frame_; - mirror::AbstractMethod** cur_quick_frame_; + mirror::ArtMethod** cur_quick_frame_; uintptr_t cur_quick_frame_pc_; // Lazily computed, number of frames in the stack. size_t num_frames_; diff --git a/runtime/thread.cc b/runtime/thread.cc index 07a003d330..7e3afb59a5 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -45,10 +45,10 @@ #include "gc/space/space.h" #include "invoke_arg_array_builder.h" #include "jni_internal.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" -#include "mirror/field-inl.h" #include "mirror/object_array-inl.h" #include "mirror/stack_trace_element.h" #include "monitor.h" @@ -168,7 +168,7 @@ void* Thread::CreateCallback(void* arg) { // Invoke the 'run' method of our java.lang.Thread. mirror::Object* receiver = self->opeer_; jmethodID mid = WellKnownClasses::java_lang_Thread_run; - mirror::AbstractMethod* m = + mirror::ArtMethod* m = receiver->GetClass()->FindVirtualMethodForVirtualOrInterface(soa.DecodeMethod(mid)); JValue result; ArgArray arg_array(NULL, 0); @@ -183,7 +183,7 @@ void* Thread::CreateCallback(void* arg) { Thread* Thread::FromManagedThread(const ScopedObjectAccessUnchecked& soa, mirror::Object* thread_peer) { - mirror::Field* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_nativePeer); + mirror::ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_nativePeer); Thread* result = reinterpret_cast(static_cast(f->GetInt(thread_peer))); // Sanity check that if we have a result it is either suspended or we hold the thread_list_lock_ // to stop it from going away. @@ -488,7 +488,7 @@ void Thread::Dump(std::ostream& os) const { } mirror::String* Thread::GetThreadName(const ScopedObjectAccessUnchecked& soa) const { - mirror::Field* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_name); + mirror::ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_name); return (opeer_ != NULL) ? reinterpret_cast(f->GetObject(opeer_)) : NULL; } @@ -678,7 +678,7 @@ void Thread::DumpState(std::ostream& os, const Thread* thread, pid_t tid) { soa.DecodeField(WellKnownClasses::java_lang_Thread_group)->GetObject(thread->opeer_); if (thread_group != NULL) { - mirror::Field* group_name_field = + mirror::ArtField* group_name_field = soa.DecodeField(WellKnownClasses::java_lang_ThreadGroup_name); mirror::String* group_name_string = reinterpret_cast(group_name_field->GetObject(thread_group)); @@ -776,7 +776,7 @@ struct StackDumpVisitor : public StackVisitor { } bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (m->IsRuntimeMethod()) { return true; } @@ -831,7 +831,7 @@ struct StackDumpVisitor : public StackVisitor { const Thread* thread; const bool can_allocate; MethodHelper mh; - mirror::AbstractMethod* last_method; + mirror::ArtMethod* last_method; int last_line_number; int repetition_count; int frame_count; @@ -855,7 +855,7 @@ static bool ShouldShowNativeStack(const Thread* thread) // We don't just check kNative because native methods will be in state kSuspended if they're // calling back into the VM, or kBlocked if they're blocked on a monitor, or one of the // thread-startup states if it's early enough in their life cycle (http://b/7432159). - mirror::AbstractMethod* current_method = thread->GetCurrentMethod(NULL); + mirror::ArtMethod* current_method = thread->GetCurrentMethod(NULL); return current_method != NULL && current_method->IsNative(); } @@ -1238,7 +1238,7 @@ class CountStackDepthVisitor : public StackVisitor { // We want to skip frames up to and including the exception's constructor. // Note we also skip the frame if it doesn't have a method (namely the callee // save frame) - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (skipping_ && !m->IsRuntimeMethod() && !mirror::Throwable::GetJavaLangThrowable()->IsAssignableFrom(m->GetDeclaringClass())) { skipping_ = false; @@ -1313,7 +1313,7 @@ class BuildInternalStackTraceVisitor : public StackVisitor { skip_depth_--; return true; } - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (m->IsRuntimeMethod()) { return true; // Ignore runtime frames (in particular callee save). } @@ -1398,7 +1398,7 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray(JNIEnv* env, job MethodHelper mh; for (int32_t i = 0; i < depth; ++i) { // Prepare parameters for StackTraceElement(String cls, String method, String file, int line) - mirror::AbstractMethod* method = down_cast(method_trace->Get(i)); + mirror::ArtMethod* method = down_cast(method_trace->Get(i)); mh.ChangeMethod(method); uint32_t dex_pc = pc_trace->Get(i); int32_t line_number = mh.GetLineNumFromDexPC(dex_pc); @@ -1472,7 +1472,7 @@ void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location, DCHECK_EQ(this, Thread::Current()); // Ensure we don't forget arguments over object allocation. SirtRef saved_throw_this(this, throw_location.GetThis()); - SirtRef saved_throw_method(this, throw_location.GetMethod()); + SirtRef saved_throw_method(this, throw_location.GetMethod()); // Ignore the cause throw location. TODO: should we report this as a re-throw? SirtRef cause(this, GetException(NULL)); ClearException(); @@ -1520,7 +1520,7 @@ void Thread::ThrowNewWrappedException(const ThrowLocation& throw_location, signature = "(Ljava/lang/Throwable;)V"; } } - mirror::AbstractMethod* exception_init_method = + mirror::ArtMethod* exception_init_method = exception_class->FindDeclaredDirectMethod("", signature); CHECK(exception_init_method != NULL) << "No " << signature << " in " @@ -1740,7 +1740,7 @@ class CatchBlockStackVisitor : public StackVisitor { } bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* method = GetMethod(); + mirror::ArtMethod* method = GetMethod(); if (method == NULL) { // This is the upcall, we remember the frame and last pc so that we may long jump to them. handler_quick_frame_pc_ = GetCurrentQuickFramePc(); @@ -1764,7 +1764,7 @@ class CatchBlockStackVisitor : public StackVisitor { } } - bool HandleTryItems(mirror::AbstractMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + bool HandleTryItems(mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { uint32_t dex_pc = DexFile::kDexNoIndex; if (method->IsNative()) { native_method_count_++; @@ -1783,7 +1783,7 @@ class CatchBlockStackVisitor : public StackVisitor { return true; // Continue stack walk. } - bool HandleDeoptimization(mirror::AbstractMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + bool HandleDeoptimization(mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { MethodHelper mh(m); const DexFile::CodeItem* code_item = mh.GetCodeItem(); CHECK(code_item != NULL); @@ -1825,7 +1825,7 @@ class CatchBlockStackVisitor : public StackVisitor { } void DoLongJump() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* catch_method = *handler_quick_frame_; + mirror::ArtMethod* catch_method = *handler_quick_frame_; if (catch_method == NULL) { if (kDebugExceptionDelivery) { LOG(INFO) << "Handler is upcall"; @@ -1880,7 +1880,7 @@ class CatchBlockStackVisitor : public StackVisitor { // Location of the throw. const ThrowLocation& throw_location_; // Quick frame with found handler or last frame if no handler found. - mirror::AbstractMethod** handler_quick_frame_; + mirror::ArtMethod** handler_quick_frame_; // PC to branch to for the handler. uintptr_t handler_quick_frame_pc_; // Associated dex PC. @@ -1940,7 +1940,7 @@ struct CurrentMethodVisitor : public StackVisitor { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) : StackVisitor(thread, context), this_object_(NULL), method_(NULL), dex_pc_(0) {} virtual bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (m->IsRuntimeMethod()) { // Continue if this is a runtime method. return true; @@ -1953,11 +1953,11 @@ struct CurrentMethodVisitor : public StackVisitor { return false; } mirror::Object* this_object_; - mirror::AbstractMethod* method_; + mirror::ArtMethod* method_; uint32_t dex_pc_; }; -mirror::AbstractMethod* Thread::GetCurrentMethod(uint32_t* dex_pc) const { +mirror::ArtMethod* Thread::GetCurrentMethod(uint32_t* dex_pc) const { CurrentMethodVisitor visitor(const_cast(this), NULL); visitor.WalkStack(false); if (dex_pc != NULL) { @@ -1996,7 +1996,7 @@ class ReferenceMapVisitor : public StackVisitor { } ShadowFrame* shadow_frame = GetCurrentShadowFrame(); if (shadow_frame != NULL) { - mirror::AbstractMethod* m = shadow_frame->GetMethod(); + mirror::ArtMethod* m = shadow_frame->GetMethod(); size_t num_regs = shadow_frame->NumberOfVRegs(); if (m->IsNative() || shadow_frame->HasReferenceArray()) { // SIRT for JNI or References for interpreter. @@ -2030,7 +2030,7 @@ class ReferenceMapVisitor : public StackVisitor { } } } else { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); // Process register map (which native and runtime methods don't have) if (!m->IsNative() && !m->IsRuntimeMethod() && !m->IsProxyMethod()) { const uint8_t* native_gc_map = m->GetNativeGcMap(); @@ -2049,7 +2049,7 @@ class ReferenceMapVisitor : public StackVisitor { uint32_t fp_spills = m->GetFpSpillMask(); size_t frame_size = m->GetFrameSizeInBytes(); // For all dex registers in the bitmap - mirror::AbstractMethod** cur_quick_frame = GetCurrentQuickFrame(); + mirror::ArtMethod** cur_quick_frame = GetCurrentQuickFrame(); DCHECK(cur_quick_frame != NULL); for (size_t reg = 0; reg < num_regs; ++reg) { // Does this register hold a reference? @@ -2164,7 +2164,7 @@ void Thread::VerifyRoots(VerifyRootVisitor* visitor, void* arg) { if (this_object != NULL) { VerifyRootWrapperCallback(this_object, &wrapperArg); } - mirror::AbstractMethod* method = (*it).method_; + mirror::ArtMethod* method = (*it).method_; VerifyRootWrapperCallback(method, &wrapperArg); } } @@ -2199,7 +2199,7 @@ void Thread::VisitRoots(RootVisitor* visitor, void* arg) { if (this_object != NULL) { visitor(this_object, arg); } - mirror::AbstractMethod* method = (*it).method_; + mirror::ArtMethod* method = (*it).method_; visitor(method, arg); } } diff --git a/runtime/thread.h b/runtime/thread.h index 8b6771e60c..b9b93dd8f1 100644 --- a/runtime/thread.h +++ b/runtime/thread.h @@ -45,7 +45,7 @@ namespace art { namespace mirror { - class AbstractMethod; + class ArtMethod; class Array; class Class; class ClassLoader; @@ -318,13 +318,13 @@ class PACKED(4) Thread { long_jump_context_ = context; } - mirror::AbstractMethod* GetCurrentMethod(uint32_t* dex_pc) const + mirror::ArtMethod* GetCurrentMethod(uint32_t* dex_pc) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); ThrowLocation GetCurrentLocationForThrow() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void SetTopOfStack(void* stack, uintptr_t pc) { - mirror::AbstractMethod** top_method = reinterpret_cast(stack); + mirror::ArtMethod** top_method = reinterpret_cast(stack); managed_stack_.SetTopQuickFrame(top_method); managed_stack_.SetTopQuickFramePc(pc); } diff --git a/runtime/throw_location.cc b/runtime/throw_location.cc index 84d2c9b446..6d1ca1b4f0 100644 --- a/runtime/throw_location.cc +++ b/runtime/throw_location.cc @@ -16,7 +16,7 @@ #include "throw_location.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object-inl.h" #include "object_utils.h" diff --git a/runtime/throw_location.h b/runtime/throw_location.h index b2cd4d5803..5da446e9c5 100644 --- a/runtime/throw_location.h +++ b/runtime/throw_location.h @@ -26,7 +26,7 @@ namespace art { namespace mirror { -class AbstractMethod; +class ArtMethod; class Object; } // mirror @@ -36,7 +36,7 @@ class PACKED(4) ThrowLocation { Clear(); } - ThrowLocation(mirror::Object* throw_this_object, mirror::AbstractMethod* throw_method, + ThrowLocation(mirror::Object* throw_this_object, mirror::ArtMethod* throw_method, uint32_t throw_dex_pc) : this_object_(throw_this_object), method_(throw_method), @@ -46,7 +46,7 @@ class PACKED(4) ThrowLocation { return this_object_; } - mirror::AbstractMethod* GetMethod() const { + mirror::ArtMethod* GetMethod() const { return method_; } @@ -68,7 +68,7 @@ class PACKED(4) ThrowLocation { // The 'this' reference of the throwing method. mirror::Object* this_object_; // The throwing method. - mirror::AbstractMethod* method_; + mirror::ArtMethod* method_; // The instruction within the throwing method. uint32_t dex_pc_; }; diff --git a/runtime/trace.cc b/runtime/trace.cc index 2bce70f7c1..84df6a9e8b 100644 --- a/runtime/trace.cc +++ b/runtime/trace.cc @@ -24,7 +24,7 @@ #include "debugger.h" #include "dex_file-inl.h" #include "instrumentation.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/dex_cache.h" #include "mirror/object_array-inl.h" @@ -98,15 +98,15 @@ ProfilerClockSource Trace::default_clock_source_ = kProfilerClockSourceWall; Trace* Trace::the_trace_ = NULL; -static mirror::AbstractMethod* DecodeTraceMethodId(uint32_t tmid) { - return reinterpret_cast(tmid & ~kTraceMethodActionMask); +static mirror::ArtMethod* DecodeTraceMethodId(uint32_t tmid) { + return reinterpret_cast(tmid & ~kTraceMethodActionMask); } static TraceAction DecodeTraceAction(uint32_t tmid) { return static_cast(tmid & kTraceMethodActionMask); } -static uint32_t EncodeTraceMethodAndAction(const mirror::AbstractMethod* method, +static uint32_t EncodeTraceMethodAndAction(const mirror::ArtMethod* method, TraceAction action) { uint32_t tmid = reinterpret_cast(method) | action; DCHECK_EQ(method, DecodeTraceMethodId(tmid)); @@ -311,7 +311,7 @@ static void DumpBuf(uint8_t* buf, size_t buf_size, ProfilerClockSource clock_sou while (ptr < end) { uint32_t tmid = ptr[2] | (ptr[3] << 8) | (ptr[4] << 16) | (ptr[5] << 24); - mirror::AbstractMethod* method = DecodeTraceMethodId(tmid); + mirror::ArtMethod* method = DecodeTraceMethodId(tmid); TraceAction action = DecodeTraceAction(tmid); LOG(INFO) << PrettyMethod(method) << " " << static_cast(action); ptr += GetRecordSize(clock_source); @@ -329,7 +329,7 @@ void Trace::FinishTracing() { Runtime::Current()->SetStatsEnabled(false); } - std::set visited_methods; + std::set visited_methods; GetVisitedMethods(final_offset, &visited_methods); std::ostringstream os; @@ -386,35 +386,35 @@ void Trace::FinishTracing() { } void Trace::DexPcMoved(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t new_dex_pc) { + const mirror::ArtMethod* method, uint32_t new_dex_pc) { // We're not recorded to listen to this kind of event, so complain. LOG(ERROR) << "Unexpected dex PC event in tracing " << PrettyMethod(method) << " " << new_dex_pc; }; void Trace::MethodEntered(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) { + const mirror::ArtMethod* method, uint32_t dex_pc) { LogMethodTraceEvent(thread, method, instrumentation::Instrumentation::kMethodEntered); } void Trace::MethodExited(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc, + const mirror::ArtMethod* method, uint32_t dex_pc, const JValue& return_value) { UNUSED(return_value); LogMethodTraceEvent(thread, method, instrumentation::Instrumentation::kMethodExited); } -void Trace::MethodUnwind(Thread* thread, const mirror::AbstractMethod* method, uint32_t dex_pc) { +void Trace::MethodUnwind(Thread* thread, const mirror::ArtMethod* method, uint32_t dex_pc) { LogMethodTraceEvent(thread, method, instrumentation::Instrumentation::kMethodUnwind); } void Trace::ExceptionCaught(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, uint32_t catch_dex_pc, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception_object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { LOG(ERROR) << "Unexpected exception caught event in tracing"; } -void Trace::LogMethodTraceEvent(Thread* thread, const mirror::AbstractMethod* method, +void Trace::LogMethodTraceEvent(Thread* thread, const mirror::ArtMethod* method, instrumentation::Instrumentation::InstrumentationEvent event) { // Advance cur_offset_ atomically. int32_t new_offset; @@ -473,24 +473,24 @@ void Trace::LogMethodTraceEvent(Thread* thread, const mirror::AbstractMethod* me } void Trace::GetVisitedMethods(size_t buf_size, - std::set* visited_methods) { + std::set* visited_methods) { uint8_t* ptr = buf_.get() + kTraceHeaderLength; uint8_t* end = buf_.get() + buf_size; while (ptr < end) { uint32_t tmid = ptr[2] | (ptr[3] << 8) | (ptr[4] << 16) | (ptr[5] << 24); - mirror::AbstractMethod* method = DecodeTraceMethodId(tmid); + mirror::ArtMethod* method = DecodeTraceMethodId(tmid); visited_methods->insert(method); ptr += GetRecordSize(clock_source_); } } void Trace::DumpMethodList(std::ostream& os, - const std::set& visited_methods) { - typedef std::set::const_iterator It; // TODO: C++0x auto + const std::set& visited_methods) { + typedef std::set::const_iterator It; // TODO: C++0x auto MethodHelper mh; for (It it = visited_methods.begin(); it != visited_methods.end(); ++it) { - mirror::AbstractMethod* method = *it; + mirror::ArtMethod* method = *it; mh.ChangeMethod(method); os << StringPrintf("%p\t%s\t%s\t%s\t%s\n", method, PrettyDescriptor(mh.GetDeclaringClassDescriptor()).c_str(), mh.GetName(), diff --git a/runtime/trace.h b/runtime/trace.h index bd9c140d26..ae583cae2d 100644 --- a/runtime/trace.h +++ b/runtime/trace.h @@ -31,7 +31,7 @@ namespace art { namespace mirror { -class AbstractMethod; + class ArtMethod; } // namespace mirror class Thread; @@ -63,19 +63,19 @@ class Trace : public instrumentation::InstrumentationListener { bool UseThreadCpuClock(); virtual void MethodEntered(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc) + const mirror::ArtMethod* method, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); virtual void MethodExited(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t dex_pc, + const mirror::ArtMethod* method, uint32_t dex_pc, const JValue& return_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - virtual void MethodUnwind(Thread* thread, const mirror::AbstractMethod* method, uint32_t dex_pc) + virtual void MethodUnwind(Thread* thread, const mirror::ArtMethod* method, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); virtual void DexPcMoved(Thread* thread, mirror::Object* this_object, - const mirror::AbstractMethod* method, uint32_t new_dex_pc) + const mirror::ArtMethod* method, uint32_t new_dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); virtual void ExceptionCaught(Thread* thread, const ThrowLocation& throw_location, - mirror::AbstractMethod* catch_method, uint32_t catch_dex_pc, + mirror::ArtMethod* catch_method, uint32_t catch_dex_pc, mirror::Throwable* exception_object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -84,12 +84,12 @@ class Trace : public instrumentation::InstrumentationListener { void FinishTracing() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - void LogMethodTraceEvent(Thread* thread, const mirror::AbstractMethod* method, + void LogMethodTraceEvent(Thread* thread, const mirror::ArtMethod* method, instrumentation::Instrumentation::InstrumentationEvent event); // Methods to output traced methods and threads. - void GetVisitedMethods(size_t end_offset, std::set* visited_methods); - void DumpMethodList(std::ostream& os, const std::set& visited_methods) + void GetVisitedMethods(size_t end_offset, std::set* visited_methods); + void DumpMethodList(std::ostream& os, const std::set& visited_methods) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void DumpThreadList(std::ostream& os) LOCKS_EXCLUDED(Locks::thread_list_lock_); diff --git a/runtime/utils.cc b/runtime/utils.cc index 71e502df29..87cd21c478 100644 --- a/runtime/utils.cc +++ b/runtime/utils.cc @@ -25,11 +25,10 @@ #include "UniquePtr.h" #include "base/unix_file/fd_file.h" #include "dex_file-inl.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/class_loader.h" -#include "mirror/field.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "mirror/string.h" @@ -295,7 +294,7 @@ std::string PrettyDescriptor(Primitive::Type type) { return PrettyDescriptor(descriptor_string); } -std::string PrettyField(const mirror::Field* f, bool with_type) { +std::string PrettyField(const mirror::ArtField* f, bool with_type) { if (f == NULL) { return "null"; } @@ -370,7 +369,7 @@ std::string PrettyReturnType(const char* signature) { return PrettyDescriptor(return_type); } -std::string PrettyMethod(const mirror::AbstractMethod* m, bool with_signature) { +std::string PrettyMethod(const mirror::ArtMethod* m, bool with_signature) { if (m == NULL) { return "null"; } @@ -629,7 +628,7 @@ std::string DescriptorToName(const char* descriptor) { return descriptor; } -std::string JniShortName(const mirror::AbstractMethod* m) { +std::string JniShortName(const mirror::ArtMethod* m) { MethodHelper mh(m); std::string class_name(mh.GetDeclaringClassDescriptor()); // Remove the leading 'L' and trailing ';'... @@ -648,7 +647,7 @@ std::string JniShortName(const mirror::AbstractMethod* m) { return short_name; } -std::string JniLongName(const mirror::AbstractMethod* m) { +std::string JniLongName(const mirror::ArtMethod* m) { std::string long_name; long_name += JniShortName(m); long_name += "__"; diff --git a/runtime/utils.h b/runtime/utils.h index 1c45048c13..9e724d0ac4 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -33,9 +33,9 @@ namespace art { class DexFile; namespace mirror { +class ArtField; +class ArtMethod; class Class; -class Field; -class AbstractMethod; class Object; class String; } // namespace mirror @@ -195,13 +195,13 @@ std::string PrettyDescriptor(const mirror::Class* klass) // Returns a human-readable signature for 'f'. Something like "a.b.C.f" or // "int a.b.C.f" (depending on the value of 'with_type'). -std::string PrettyField(const mirror::Field* f, bool with_type = true) +std::string PrettyField(const mirror::ArtField* f, bool with_type = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); std::string PrettyField(uint32_t field_idx, const DexFile& dex_file, bool with_type = true); // Returns a human-readable signature for 'm'. Something like "a.b.C.m" or // "a.b.C.m(II)V" (depending on the value of 'with_signature'). -std::string PrettyMethod(const mirror::AbstractMethod* m, bool with_signature = true) +std::string PrettyMethod(const mirror::ArtMethod* m, bool with_signature = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); std::string PrettyMethod(uint32_t method_idx, const DexFile& dex_file, bool with_signature = true); @@ -265,10 +265,10 @@ bool IsValidDescriptor(const char* s); // "Ljava/lang/String;" bool IsValidMemberName(const char* s); // Returns the JNI native function name for the non-overloaded method 'm'. -std::string JniShortName(const mirror::AbstractMethod* m) +std::string JniShortName(const mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns the JNI native function name for the overloaded method 'm'. -std::string JniLongName(const mirror::AbstractMethod* m) +std::string JniLongName(const mirror::ArtMethod* m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool ReadFileToString(const std::string& file_name, std::string* result); diff --git a/runtime/utils_test.cc b/runtime/utils_test.cc index 0966e717ca..2633964b57 100644 --- a/runtime/utils_test.cc +++ b/runtime/utils_test.cc @@ -130,7 +130,7 @@ TEST_F(UtilsTest, PrettyField) { mirror::Class* java_lang_String = class_linker_->FindSystemClass("Ljava/lang/String;"); - mirror::Field* f; + mirror::ArtField* f; f = java_lang_String->FindDeclaredInstanceField("count", "I"); EXPECT_EQ("int java.lang.String.count", PrettyField(f)); EXPECT_EQ("java.lang.String.count", PrettyField(f, false)); @@ -199,7 +199,7 @@ TEST_F(UtilsTest, JniShortName_JniLongName) { ScopedObjectAccess soa(Thread::Current()); mirror::Class* c = class_linker_->FindSystemClass("Ljava/lang/String;"); ASSERT_TRUE(c != NULL); - mirror::AbstractMethod* m; + mirror::ArtMethod* m; m = c->FindVirtualMethod("charAt", "(I)C"); ASSERT_TRUE(m != NULL); diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index fc595d90d9..02168446b1 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -29,11 +29,11 @@ #include "indenter.h" #include "intern_table.h" #include "leb128.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_field-inl.h" +#include "mirror/art_method-inl.h" #include "mirror/class.h" #include "mirror/class-inl.h" #include "mirror/dex_cache-inl.h" -#include "mirror/field-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" #include "object_utils.h" @@ -139,7 +139,7 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(const DexFile* dex_file, } previous_direct_method_idx = method_idx; InvokeType type = it.GetMethodInvokeType(class_def); - mirror::AbstractMethod* method = + mirror::ArtMethod* method = linker->ResolveMethod(*dex_file, method_idx, dex_cache, class_loader, NULL, type); if (method == NULL) { DCHECK(Thread::Current()->IsExceptionPending()); @@ -181,7 +181,7 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(const DexFile* dex_file, } previous_virtual_method_idx = method_idx; InvokeType type = it.GetMethodInvokeType(class_def); - mirror::AbstractMethod* method = + mirror::ArtMethod* method = linker->ResolveMethod(*dex_file, method_idx, dex_cache, class_loader, NULL, type); if (method == NULL) { DCHECK(Thread::Current()->IsExceptionPending()); @@ -225,7 +225,7 @@ MethodVerifier::FailureKind MethodVerifier::VerifyMethod(uint32_t method_idx, mirror::ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, uint32_t method_access_flags, bool allow_soft_failures) { MethodVerifier::FailureKind result = kNoFailure; @@ -266,7 +266,7 @@ void MethodVerifier::VerifyMethodAndDump(std::ostream& os, uint32_t dex_method_i const DexFile* dex_file, mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item, - mirror::AbstractMethod* method, + mirror::ArtMethod* method, uint32_t method_access_flags) { MethodVerifier verifier(dex_file, dex_cache, class_loader, class_def_idx, code_item, dex_method_idx, method, method_access_flags, true, true); @@ -279,7 +279,7 @@ void MethodVerifier::VerifyMethodAndDump(std::ostream& os, uint32_t dex_method_i MethodVerifier::MethodVerifier(const DexFile* dex_file, mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item, - uint32_t dex_method_idx, mirror::AbstractMethod* method, + uint32_t dex_method_idx, mirror::ArtMethod* method, uint32_t method_access_flags, bool can_load_classes, bool allow_soft_failures) : reg_types_(can_load_classes), @@ -305,7 +305,7 @@ MethodVerifier::MethodVerifier(const DexFile* dex_file, mirror::DexCache* dex_ca has_virtual_or_interface_invokes_(false) { } -void MethodVerifier::FindLocksAtDexPc(mirror::AbstractMethod* m, uint32_t dex_pc, +void MethodVerifier::FindLocksAtDexPc(mirror::ArtMethod* m, uint32_t dex_pc, std::vector& monitor_enter_dex_pcs) { MethodHelper mh(m); MethodVerifier verifier(&mh.GetDexFile(), mh.GetDexCache(), mh.GetClassLoader(), @@ -327,7 +327,7 @@ void MethodVerifier::FindLocksAtDexPc() { Verify(); } -mirror::Field* MethodVerifier::FindAccessedFieldAtDexPc(mirror::AbstractMethod* m, +mirror::ArtField* MethodVerifier::FindAccessedFieldAtDexPc(mirror::ArtMethod* m, uint32_t dex_pc) { MethodHelper mh(m); MethodVerifier verifier(&mh.GetDexFile(), mh.GetDexCache(), mh.GetClassLoader(), @@ -336,7 +336,7 @@ mirror::Field* MethodVerifier::FindAccessedFieldAtDexPc(mirror::AbstractMethod* return verifier.FindAccessedFieldAtDexPc(dex_pc); } -mirror::Field* MethodVerifier::FindAccessedFieldAtDexPc(uint32_t dex_pc) { +mirror::ArtField* MethodVerifier::FindAccessedFieldAtDexPc(uint32_t dex_pc) { CHECK(code_item_ != NULL); // This only makes sense for methods with code. // Strictly speaking, we ought to be able to get away with doing a subset of the full method @@ -355,7 +355,7 @@ mirror::Field* MethodVerifier::FindAccessedFieldAtDexPc(uint32_t dex_pc) { return GetQuickFieldAccess(inst, register_line); } -mirror::AbstractMethod* MethodVerifier::FindInvokedMethodAtDexPc(mirror::AbstractMethod* m, +mirror::ArtMethod* MethodVerifier::FindInvokedMethodAtDexPc(mirror::ArtMethod* m, uint32_t dex_pc) { MethodHelper mh(m); MethodVerifier verifier(&mh.GetDexFile(), mh.GetDexCache(), mh.GetClassLoader(), @@ -364,7 +364,7 @@ mirror::AbstractMethod* MethodVerifier::FindInvokedMethodAtDexPc(mirror::Abstrac return verifier.FindInvokedMethodAtDexPc(dex_pc); } -mirror::AbstractMethod* MethodVerifier::FindInvokedMethodAtDexPc(uint32_t dex_pc) { +mirror::ArtMethod* MethodVerifier::FindInvokedMethodAtDexPc(uint32_t dex_pc) { CHECK(code_item_ != NULL); // This only makes sense for methods with code. // Strictly speaking, we ought to be able to get away with doing a subset of the full method @@ -2113,7 +2113,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { inst->Opcode() == Instruction::INVOKE_SUPER_RANGE); bool is_super = (inst->Opcode() == Instruction::INVOKE_SUPER || inst->Opcode() == Instruction::INVOKE_SUPER_RANGE); - mirror::AbstractMethod* called_method = VerifyInvocationArgs(inst, METHOD_VIRTUAL, + mirror::ArtMethod* called_method = VerifyInvocationArgs(inst, METHOD_VIRTUAL, is_range, is_super); const char* descriptor; if (called_method == NULL) { @@ -2136,7 +2136,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { case Instruction::INVOKE_DIRECT: case Instruction::INVOKE_DIRECT_RANGE: { bool is_range = (inst->Opcode() == Instruction::INVOKE_DIRECT_RANGE); - mirror::AbstractMethod* called_method = VerifyInvocationArgs(inst, METHOD_DIRECT, + mirror::ArtMethod* called_method = VerifyInvocationArgs(inst, METHOD_DIRECT, is_range, false); const char* return_type_descriptor; bool is_constructor; @@ -2203,7 +2203,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { case Instruction::INVOKE_STATIC: case Instruction::INVOKE_STATIC_RANGE: { bool is_range = (inst->Opcode() == Instruction::INVOKE_STATIC_RANGE); - mirror::AbstractMethod* called_method = VerifyInvocationArgs(inst, + mirror::ArtMethod* called_method = VerifyInvocationArgs(inst, METHOD_STATIC, is_range, false); @@ -2228,7 +2228,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { case Instruction::INVOKE_INTERFACE: case Instruction::INVOKE_INTERFACE_RANGE: { bool is_range = (inst->Opcode() == Instruction::INVOKE_INTERFACE_RANGE); - mirror::AbstractMethod* abs_method = VerifyInvocationArgs(inst, + mirror::ArtMethod* abs_method = VerifyInvocationArgs(inst, METHOD_INTERFACE, is_range, false); @@ -2536,7 +2536,7 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) { case Instruction::INVOKE_VIRTUAL_QUICK: case Instruction::INVOKE_VIRTUAL_RANGE_QUICK: { bool is_range = (inst->Opcode() == Instruction::INVOKE_VIRTUAL_RANGE_QUICK); - mirror::AbstractMethod* called_method = VerifyInvokeVirtualQuickArgs(inst, is_range); + mirror::ArtMethod* called_method = VerifyInvokeVirtualQuickArgs(inst, is_range); if (called_method != NULL) { const char* descriptor = MethodHelper(called_method).GetReturnTypeDescriptor(); const RegType& return_type = reg_types_.FromDescriptor(class_loader_, descriptor, false); @@ -2871,7 +2871,7 @@ const RegType& MethodVerifier::GetCaughtExceptionType() { return *common_super; } -mirror::AbstractMethod* MethodVerifier::ResolveMethodAndCheckAccess(uint32_t dex_method_idx, +mirror::ArtMethod* MethodVerifier::ResolveMethodAndCheckAccess(uint32_t dex_method_idx, MethodType method_type) { const DexFile::MethodId& method_id = dex_file_->GetMethodId(dex_method_idx); const RegType& klass_type = ResolveClassAndCheckAccess(method_id.class_idx_); @@ -2886,7 +2886,7 @@ mirror::AbstractMethod* MethodVerifier::ResolveMethodAndCheckAccess(uint32_t dex } mirror::Class* klass = klass_type.GetClass(); const RegType& referrer = GetDeclaringClass(); - mirror::AbstractMethod* res_method = dex_cache_->GetResolvedMethod(dex_method_idx); + mirror::ArtMethod* res_method = dex_cache_->GetResolvedMethod(dex_method_idx); if (res_method == NULL) { const char* name = dex_file_->GetMethodName(method_id); std::string signature(dex_file_->CreateMethodSignature(method_id.proto_idx_, NULL)); @@ -2963,14 +2963,14 @@ mirror::AbstractMethod* MethodVerifier::ResolveMethodAndCheckAccess(uint32_t dex return res_method; } -mirror::AbstractMethod* MethodVerifier::VerifyInvocationArgs(const Instruction* inst, +mirror::ArtMethod* MethodVerifier::VerifyInvocationArgs(const Instruction* inst, MethodType method_type, bool is_range, bool is_super) { // Resolve the method. This could be an abstract or concrete method depending on what sort of call // we're making. const uint32_t method_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); - mirror::AbstractMethod* res_method = ResolveMethodAndCheckAccess(method_idx, method_type); + mirror::ArtMethod* res_method = ResolveMethodAndCheckAccess(method_idx, method_type); if (res_method == NULL) { // error or class is unresolved return NULL; } @@ -3078,7 +3078,7 @@ mirror::AbstractMethod* MethodVerifier::VerifyInvocationArgs(const Instruction* } } -mirror::AbstractMethod* MethodVerifier::GetQuickInvokedMethod(const Instruction* inst, +mirror::ArtMethod* MethodVerifier::GetQuickInvokedMethod(const Instruction* inst, RegisterLine* reg_line, bool is_range) { DCHECK(inst->Opcode() == Instruction::INVOKE_VIRTUAL_QUICK || @@ -3103,19 +3103,19 @@ mirror::AbstractMethod* MethodVerifier::GetQuickInvokedMethod(const Instruction* if (this_class == NULL) { return NULL; } - mirror::ObjectArray* vtable = this_class->GetVTable(); + mirror::ObjectArray* vtable = this_class->GetVTable(); CHECK(vtable != NULL); uint16_t vtable_index = is_range ? inst->VRegB_3rc() : inst->VRegB_35c(); CHECK(vtable_index < vtable->GetLength()); - mirror::AbstractMethod* res_method = vtable->Get(vtable_index); + mirror::ArtMethod* res_method = vtable->Get(vtable_index); CHECK(!Thread::Current()->IsExceptionPending()); return res_method; } -mirror::AbstractMethod* MethodVerifier::VerifyInvokeVirtualQuickArgs(const Instruction* inst, +mirror::ArtMethod* MethodVerifier::VerifyInvokeVirtualQuickArgs(const Instruction* inst, bool is_range) { DCHECK(Runtime::Current()->IsStarted()); - mirror::AbstractMethod* res_method = GetQuickInvokedMethod(inst, work_line_.get(), + mirror::ArtMethod* res_method = GetQuickInvokedMethod(inst, work_line_.get(), is_range); if (res_method == NULL) { Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Cannot infer method from " << inst->Name(); @@ -3368,7 +3368,7 @@ void MethodVerifier::VerifyAPut(const Instruction* inst, } } -mirror::Field* MethodVerifier::GetStaticField(int field_idx) { +mirror::ArtField* MethodVerifier::GetStaticField(int field_idx) { const DexFile::FieldId& field_id = dex_file_->GetFieldId(field_idx); // Check access to class const RegType& klass_type = ResolveClassAndCheckAccess(field_id.class_idx_); @@ -3381,7 +3381,7 @@ mirror::Field* MethodVerifier::GetStaticField(int field_idx) { if (klass_type.IsUnresolvedTypes()) { return NULL; // Can't resolve Class so no more to do here, will do checking at runtime. } - mirror::Field* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_, + mirror::ArtField* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_, field_idx, dex_cache_, class_loader_); @@ -3405,7 +3405,7 @@ mirror::Field* MethodVerifier::GetStaticField(int field_idx) { } } -mirror::Field* MethodVerifier::GetInstanceField(const RegType& obj_type, int field_idx) { +mirror::ArtField* MethodVerifier::GetInstanceField(const RegType& obj_type, int field_idx) { const DexFile::FieldId& field_id = dex_file_->GetFieldId(field_idx); // Check access to class const RegType& klass_type = ResolveClassAndCheckAccess(field_id.class_idx_); @@ -3418,7 +3418,7 @@ mirror::Field* MethodVerifier::GetInstanceField(const RegType& obj_type, int fie if (klass_type.IsUnresolvedTypes()) { return NULL; // Can't resolve Class so no more to do here } - mirror::Field* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_, + mirror::ArtField* field = Runtime::Current()->GetClassLinker()->ResolveFieldJLS(*dex_file_, field_idx, dex_cache_, class_loader_); @@ -3471,7 +3471,7 @@ mirror::Field* MethodVerifier::GetInstanceField(const RegType& obj_type, int fie void MethodVerifier::VerifyISGet(const Instruction* inst, const RegType& insn_type, bool is_primitive, bool is_static) { uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c(); - mirror::Field* field; + mirror::ArtField* field; if (is_static) { field = GetStaticField(field_idx); } else { @@ -3525,7 +3525,7 @@ void MethodVerifier::VerifyISGet(const Instruction* inst, const RegType& insn_ty void MethodVerifier::VerifyISPut(const Instruction* inst, const RegType& insn_type, bool is_primitive, bool is_static) { uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c(); - mirror::Field* field; + mirror::ArtField* field; if (is_static) { field = GetStaticField(field_idx); } else { @@ -3567,13 +3567,13 @@ void MethodVerifier::VerifyISPut(const Instruction* inst, const RegType& insn_ty // Look for an instance field with this offset. // TODO: we may speed up the search if offsets are sorted by doing a quick search. -static mirror::Field* FindInstanceFieldWithOffset(const mirror::Class* klass, +static mirror::ArtField* FindInstanceFieldWithOffset(const mirror::Class* klass, uint32_t field_offset) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - const mirror::ObjectArray* instance_fields = klass->GetIFields(); + const mirror::ObjectArray* instance_fields = klass->GetIFields(); if (instance_fields != NULL) { for (int32_t i = 0, e = instance_fields->GetLength(); i < e; ++i) { - mirror::Field* field = instance_fields->Get(i); + mirror::ArtField* field = instance_fields->Get(i); if (field->GetOffset().Uint32Value() == field_offset) { return field; } @@ -3589,7 +3589,7 @@ static mirror::Field* FindInstanceFieldWithOffset(const mirror::Class* klass, // Returns the access field of a quick field access (iget/iput-quick) or NULL // if it cannot be found. -mirror::Field* MethodVerifier::GetQuickFieldAccess(const Instruction* inst, +mirror::ArtField* MethodVerifier::GetQuickFieldAccess(const Instruction* inst, RegisterLine* reg_line) { DCHECK(inst->Opcode() == Instruction::IGET_QUICK || inst->Opcode() == Instruction::IGET_WIDE_QUICK || @@ -3624,7 +3624,7 @@ mirror::Field* MethodVerifier::GetQuickFieldAccess(const Instruction* inst, void MethodVerifier::VerifyIGetQuick(const Instruction* inst, const RegType& insn_type, bool is_primitive) { DCHECK(Runtime::Current()->IsStarted()); - mirror::Field* field = GetQuickFieldAccess(inst, work_line_.get()); + mirror::ArtField* field = GetQuickFieldAccess(inst, work_line_.get()); if (field == NULL) { Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Cannot infer field from " << inst->Name(); return; @@ -3668,7 +3668,7 @@ void MethodVerifier::VerifyIGetQuick(const Instruction* inst, const RegType& ins void MethodVerifier::VerifyIPutQuick(const Instruction* inst, const RegType& insn_type, bool is_primitive) { DCHECK(Runtime::Current()->IsStarted()); - mirror::Field* field = GetQuickFieldAccess(inst, work_line_.get()); + mirror::ArtField* field = GetQuickFieldAccess(inst, work_line_.get()); if (field == NULL) { Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Cannot infer field from " << inst->Name(); return; @@ -3922,7 +3922,7 @@ MethodVerifier::PcToConcreteMethodMap* MethodVerifier::GenerateDevirtMap() { // We can't devirtualize abstract classes except on arrays of abstract classes. continue; } - mirror::AbstractMethod* abstract_method = + mirror::ArtMethod* abstract_method = dex_cache_->GetResolvedMethod(is_range ? inst->VRegB_3rc() : inst->VRegB_35c()); if (abstract_method == NULL) { // If the method is not found in the cache this means that it was never found @@ -3930,7 +3930,7 @@ MethodVerifier::PcToConcreteMethodMap* MethodVerifier::GenerateDevirtMap() { continue; } // Find the concrete method. - mirror::AbstractMethod* concrete_method = NULL; + mirror::ArtMethod* concrete_method = NULL; if (is_interface) { concrete_method = reg_type.GetClass()->FindVirtualMethodForInterface(abstract_method); } diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index e01f2c08c1..6171943a6c 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -156,7 +156,7 @@ class MethodVerifier { static void VerifyMethodAndDump(std::ostream& os, uint32_t method_idx, const DexFile* dex_file, mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item, - mirror::AbstractMethod* method, uint32_t method_access_flags) + mirror::ArtMethod* method, uint32_t method_access_flags) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); uint8_t EncodePcToReferenceMapData() const; @@ -197,20 +197,18 @@ class MethodVerifier { // Fills 'monitor_enter_dex_pcs' with the dex pcs of the monitor-enter instructions corresponding // to the locks held at 'dex_pc' in method 'm'. - static void FindLocksAtDexPc(mirror::AbstractMethod* m, uint32_t dex_pc, + static void FindLocksAtDexPc(mirror::ArtMethod* m, uint32_t dex_pc, std::vector& monitor_enter_dex_pcs) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns the accessed field corresponding to the quick instruction's field // offset at 'dex_pc' in method 'm'. - static mirror::Field* FindAccessedFieldAtDexPc(mirror::AbstractMethod* m, - uint32_t dex_pc) + static mirror::ArtField* FindAccessedFieldAtDexPc(mirror::ArtMethod* m, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Returns the invoked method corresponding to the quick instruction's vtable // index at 'dex_pc' in method 'm'. - static mirror::AbstractMethod* FindInvokedMethodAtDexPc(mirror::AbstractMethod* m, - uint32_t dex_pc) + static mirror::ArtMethod* FindInvokedMethodAtDexPc(mirror::ArtMethod* m, uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void Init() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -226,7 +224,7 @@ class MethodVerifier { MethodVerifier(const DexFile* dex_file, mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item, - uint32_t method_idx, mirror::AbstractMethod* method, + uint32_t method_idx, mirror::ArtMethod* method, uint32_t access_flags, bool can_load_classes, bool allow_soft_failures) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); @@ -266,16 +264,16 @@ class MethodVerifier { mirror::DexCache* dex_cache, mirror::ClassLoader* class_loader, uint32_t class_def_idx, const DexFile::CodeItem* code_item, - mirror::AbstractMethod* method, uint32_t method_access_flags, + mirror::ArtMethod* method, uint32_t method_access_flags, bool allow_soft_failures) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); void FindLocksAtDexPc() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::Field* FindAccessedFieldAtDexPc(uint32_t dex_pc) + mirror::ArtField* FindAccessedFieldAtDexPc(uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* FindInvokedMethodAtDexPc(uint32_t dex_pc) + mirror::ArtMethod* FindInvokedMethodAtDexPc(uint32_t dex_pc) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); /* @@ -496,11 +494,11 @@ class MethodVerifier { bool is_primitive) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Lookup instance field and fail for resolution violations - mirror::Field* GetInstanceField(const RegType& obj_type, int field_idx) + mirror::ArtField* GetInstanceField(const RegType& obj_type, int field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Lookup static field and fail for resolution violations - mirror::Field* GetStaticField(int field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + mirror::ArtField* GetStaticField(int field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Perform verification of an iget or sget instruction. void VerifyISGet(const Instruction* inst, const RegType& insn_type, @@ -514,7 +512,7 @@ class MethodVerifier { // Returns the access field of a quick field access (iget/iput-quick) or NULL // if it cannot be found. - mirror::Field* GetQuickFieldAccess(const Instruction* inst, RegisterLine* reg_line) + mirror::ArtField* GetQuickFieldAccess(const Instruction* inst, RegisterLine* reg_line) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); // Perform verification of an iget-quick instruction. @@ -545,7 +543,7 @@ class MethodVerifier { * the referrer can access the resolved method. * Does not throw exceptions. */ - mirror::AbstractMethod* ResolveMethodAndCheckAccess(uint32_t method_idx, MethodType method_type) + mirror::ArtMethod* ResolveMethodAndCheckAccess(uint32_t method_idx, MethodType method_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); /* @@ -570,18 +568,17 @@ class MethodVerifier { * Returns the resolved method on success, NULL on failure (with *failure * set appropriately). */ - mirror::AbstractMethod* VerifyInvocationArgs(const Instruction* inst, - MethodType method_type, - bool is_range, bool is_super) + mirror::ArtMethod* VerifyInvocationArgs(const Instruction* inst, + MethodType method_type, + bool is_range, bool is_super) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* GetQuickInvokedMethod(const Instruction* inst, - RegisterLine* reg_line, - bool is_range) + mirror::ArtMethod* GetQuickInvokedMethod(const Instruction* inst, + RegisterLine* reg_line, + bool is_range) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - mirror::AbstractMethod* VerifyInvokeVirtualQuickArgs(const Instruction* inst, - bool is_range) + mirror::ArtMethod* VerifyInvokeVirtualQuickArgs(const Instruction* inst, bool is_range) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); /* @@ -686,7 +683,7 @@ class MethodVerifier { const uint32_t dex_method_idx_; // The method we're working on. // Its object representation if known. - mirror::AbstractMethod* mirror_method_ GUARDED_BY(Locks::mutator_lock_); + mirror::ArtMethod* mirror_method_ GUARDED_BY(Locks::mutator_lock_); const uint32_t method_access_flags_; // Method's access flags. const DexFile* const dex_file_; // The dex file containing the method. // The dex_cache for the declaring class of the method. diff --git a/runtime/well_known_classes.cc b/runtime/well_known_classes.cc index 434fcf00f5..8de020a975 100644 --- a/runtime/well_known_classes.cc +++ b/runtime/well_known_classes.cc @@ -32,8 +32,11 @@ jclass WellKnownClasses::java_lang_ClassNotFoundException; jclass WellKnownClasses::java_lang_Daemons; jclass WellKnownClasses::java_lang_Error; jclass WellKnownClasses::java_lang_Object; -jclass WellKnownClasses::java_lang_reflect_InvocationHandler; jclass WellKnownClasses::java_lang_reflect_AbstractMethod; +jclass WellKnownClasses::java_lang_reflect_ArtMethod; +jclass WellKnownClasses::java_lang_reflect_Constructor; +jclass WellKnownClasses::java_lang_reflect_Field; +jclass WellKnownClasses::java_lang_reflect_Method; jclass WellKnownClasses::java_lang_reflect_Proxy; jclass WellKnownClasses::java_lang_RuntimeException; jclass WellKnownClasses::java_lang_StackOverflowError; @@ -61,7 +64,7 @@ jmethodID WellKnownClasses::java_lang_Integer_valueOf; jmethodID WellKnownClasses::java_lang_Long_valueOf; jmethodID WellKnownClasses::java_lang_ref_FinalizerReference_add; jmethodID WellKnownClasses::java_lang_ref_ReferenceQueue_add; -jmethodID WellKnownClasses::java_lang_reflect_InvocationHandler_invoke; +jmethodID WellKnownClasses::java_lang_reflect_Proxy_invoke; jmethodID WellKnownClasses::java_lang_Runtime_nativeLoad; jmethodID WellKnownClasses::java_lang_Short_valueOf; jmethodID WellKnownClasses::java_lang_System_runFinalization = NULL; @@ -83,6 +86,8 @@ jfieldID WellKnownClasses::java_lang_Thread_nativePeer; jfieldID WellKnownClasses::java_lang_ThreadGroup_mainThreadGroup; jfieldID WellKnownClasses::java_lang_ThreadGroup_name; jfieldID WellKnownClasses::java_lang_ThreadGroup_systemThreadGroup; +jfieldID WellKnownClasses::java_lang_reflect_AbstractMethod_artMethod; +jfieldID WellKnownClasses::java_lang_reflect_Field_artField; jfieldID WellKnownClasses::java_lang_reflect_Proxy_h; jfieldID WellKnownClasses::java_nio_DirectByteBuffer_capacity; jfieldID WellKnownClasses::java_nio_DirectByteBuffer_effectiveDirectAddress; @@ -121,7 +126,7 @@ static jmethodID CachePrimitiveBoxingMethod(JNIEnv* env, char prim_name, const c StringPrintf("(%c)L%s;", prim_name, boxed_name).c_str()); } -void WellKnownClasses::InitClasses(JNIEnv* env) { +void WellKnownClasses::Init(JNIEnv* env) { com_android_dex_Dex = CacheClass(env, "com/android/dex/Dex"); dalvik_system_PathClassLoader = CacheClass(env, "dalvik/system/PathClassLoader"); java_lang_ClassLoader = CacheClass(env, "java/lang/ClassLoader"); @@ -129,8 +134,11 @@ void WellKnownClasses::InitClasses(JNIEnv* env) { java_lang_Daemons = CacheClass(env, "java/lang/Daemons"); java_lang_Object = CacheClass(env, "java/lang/Object"); java_lang_Error = CacheClass(env, "java/lang/Error"); - java_lang_reflect_InvocationHandler = CacheClass(env, "java/lang/reflect/InvocationHandler"); java_lang_reflect_AbstractMethod = CacheClass(env, "java/lang/reflect/AbstractMethod"); + java_lang_reflect_ArtMethod = CacheClass(env, "java/lang/reflect/ArtMethod"); + java_lang_reflect_Constructor = CacheClass(env, "java/lang/reflect/Constructor"); + java_lang_reflect_Field = CacheClass(env, "java/lang/reflect/Field"); + java_lang_reflect_Method = CacheClass(env, "java/lang/reflect/Method"); java_lang_reflect_Proxy = CacheClass(env, "java/lang/reflect/Proxy"); java_lang_RuntimeException = CacheClass(env, "java/lang/RuntimeException"); java_lang_StackOverflowError = CacheClass(env, "java/lang/StackOverflowError"); @@ -142,10 +150,6 @@ void WellKnownClasses::InitClasses(JNIEnv* env) { java_nio_DirectByteBuffer = CacheClass(env, "java/nio/DirectByteBuffer"); org_apache_harmony_dalvik_ddmc_Chunk = CacheClass(env, "org/apache/harmony/dalvik/ddmc/Chunk"); org_apache_harmony_dalvik_ddmc_DdmServer = CacheClass(env, "org/apache/harmony/dalvik/ddmc/DdmServer"); -} - -void WellKnownClasses::Init(JNIEnv* env) { - InitClasses(env); com_android_dex_Dex_create = CacheMethod(env, com_android_dex_Dex, true, "create", "(Ljava/nio/ByteBuffer;)Lcom/android/dex/Dex;"); java_lang_ClassNotFoundException_init = CacheMethod(env, java_lang_ClassNotFoundException, false, "", "(Ljava/lang/String;Ljava/lang/Throwable;)V"); @@ -160,7 +164,7 @@ void WellKnownClasses::Init(JNIEnv* env) { ScopedLocalRef java_lang_ref_ReferenceQueue(env, env->FindClass("java/lang/ref/ReferenceQueue")); java_lang_ref_ReferenceQueue_add = CacheMethod(env, java_lang_ref_ReferenceQueue.get(), true, "add", "(Ljava/lang/ref/Reference;)V"); - java_lang_reflect_InvocationHandler_invoke = CacheMethod(env, java_lang_reflect_InvocationHandler, false, "invoke", "(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;"); + java_lang_reflect_Proxy_invoke = CacheMethod(env, java_lang_reflect_Proxy, true, "invoke", "(Ljava/lang/reflect/Proxy;Ljava/lang/reflect/ArtMethod;[Ljava/lang/Object;)Ljava/lang/Object;"); java_lang_Thread_init = CacheMethod(env, java_lang_Thread, false, "", "(Ljava/lang/ThreadGroup;Ljava/lang/String;IZ)V"); java_lang_Thread_run = CacheMethod(env, java_lang_Thread, false, "run", "()V"); java_lang_Thread$UncaughtExceptionHandler_uncaughtException = CacheMethod(env, java_lang_Thread$UncaughtExceptionHandler, false, "uncaughtException", "(Ljava/lang/Thread;Ljava/lang/Throwable;)V"); @@ -179,6 +183,8 @@ void WellKnownClasses::Init(JNIEnv* env) { java_lang_ThreadGroup_mainThreadGroup = CacheField(env, java_lang_ThreadGroup, true, "mainThreadGroup", "Ljava/lang/ThreadGroup;"); java_lang_ThreadGroup_name = CacheField(env, java_lang_ThreadGroup, false, "name", "Ljava/lang/String;"); java_lang_ThreadGroup_systemThreadGroup = CacheField(env, java_lang_ThreadGroup, true, "systemThreadGroup", "Ljava/lang/ThreadGroup;"); + java_lang_reflect_AbstractMethod_artMethod = CacheField(env, java_lang_reflect_AbstractMethod, false, "artMethod", "Ljava/lang/reflect/ArtMethod;"); + java_lang_reflect_Field_artField = CacheField(env, java_lang_reflect_Field, false, "artField", "Ljava/lang/reflect/ArtField;"); java_lang_reflect_Proxy_h = CacheField(env, java_lang_reflect_Proxy, false, "h", "Ljava/lang/reflect/InvocationHandler;"); java_nio_DirectByteBuffer_capacity = CacheField(env, java_nio_DirectByteBuffer, false, "capacity", "I"); java_nio_DirectByteBuffer_effectiveDirectAddress = CacheField(env, java_nio_DirectByteBuffer, false, "effectiveDirectAddress", "J"); diff --git a/runtime/well_known_classes.h b/runtime/well_known_classes.h index fc2bffb485..bc928d0dbe 100644 --- a/runtime/well_known_classes.h +++ b/runtime/well_known_classes.h @@ -32,7 +32,7 @@ class Class; jmethodID CacheMethod(JNIEnv* env, jclass c, bool is_static, const char* name, const char* signature); struct WellKnownClasses { - static void InitClasses(JNIEnv* env); + public: static void Init(JNIEnv* env); // Run before native methods are registered. static void LateInit(JNIEnv* env); // Run after native methods are registered. @@ -46,8 +46,11 @@ struct WellKnownClasses { static jclass java_lang_Daemons; static jclass java_lang_Error; static jclass java_lang_Object; - static jclass java_lang_reflect_InvocationHandler; static jclass java_lang_reflect_AbstractMethod; + static jclass java_lang_reflect_ArtMethod; + static jclass java_lang_reflect_Constructor; + static jclass java_lang_reflect_Field; + static jclass java_lang_reflect_Method; static jclass java_lang_reflect_Proxy; static jclass java_lang_RuntimeException; static jclass java_lang_StackOverflowError; @@ -75,7 +78,7 @@ struct WellKnownClasses { static jmethodID java_lang_Long_valueOf; static jmethodID java_lang_ref_FinalizerReference_add; static jmethodID java_lang_ref_ReferenceQueue_add; - static jmethodID java_lang_reflect_InvocationHandler_invoke; + static jmethodID java_lang_reflect_Proxy_invoke; static jmethodID java_lang_Runtime_nativeLoad; static jmethodID java_lang_Short_valueOf; static jmethodID java_lang_System_runFinalization; @@ -87,6 +90,8 @@ struct WellKnownClasses { static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_broadcast; static jmethodID org_apache_harmony_dalvik_ddmc_DdmServer_dispatch; + static jfieldID java_lang_reflect_AbstractMethod_artMethod; + static jfieldID java_lang_reflect_Field_artField; static jfieldID java_lang_reflect_Proxy_h; static jfieldID java_lang_Thread_daemon; static jfieldID java_lang_Thread_group; diff --git a/test/046-reflect/expected.txt b/test/046-reflect/expected.txt index 8de373caa6..fcfaf2ff3f 100644 --- a/test/046-reflect/expected.txt +++ b/test/046-reflect/expected.txt @@ -81,8 +81,9 @@ Field name is cantTouchThis Field type is int Access flags are 0x11 cantTouchThis is 77 - setAccessible is always true cantTouchThis is now 99 + public final int Target.cantTouchThis accessible=false + public final int Target.cantTouchThis accessible=true cantTouchThis is now 87 cantTouchThis is now 88 cons modifiers=1 @@ -92,6 +93,8 @@ myMethod (I)I arg=17 anInt=7 ReflectTest done! public method +static java.lang.Object java.util.Collections.checkType(java.lang.Object,java.lang.Class) accessible=false +static java.lang.Object java.util.Collections.checkType(java.lang.Object,java.lang.Class) accessible=true checkType invoking null checkType got expected exception calling const-class FieldNoisyInitUser.class @@ -113,3 +116,7 @@ MethodNoisyInit is initializing generic field: java.util.List generic method fancyMethod params='[1] java.util.ArrayList' ret='java.util.Map' generic ctor Main params='[1] java.util.ArrayList' +fields are unique +fields are .equals +methods are unique +methods are .equals diff --git a/test/046-reflect/src/Main.java b/test/046-reflect/src/Main.java index 9d4cacf499..dfb0d8fe9b 100644 --- a/test/046-reflect/src/Main.java +++ b/test/046-reflect/src/Main.java @@ -335,14 +335,15 @@ public class Main { System.out.println(" cantTouchThis is " + intVal); try { field.setInt(instance, 99); - System.out.println(" setAccessible is always true"); } catch (IllegalAccessException iae) { System.out.println("ERROR: set-final failed"); } intVal = field.getInt(instance); System.out.println(" cantTouchThis is now " + intVal); + System.out.println(" " + field + " accessible=" + field.isAccessible()); field.setAccessible(true); + System.out.println(" " + field + " accessible=" + field.isAccessible()); field.setInt(instance, 87); // exercise int version intVal = field.getInt(instance); System.out.println(" cantTouchThis is now " + intVal); @@ -378,8 +379,9 @@ public class Main { nsme.printStackTrace(); return; } - + System.out.println(m + " accessible=" + m.isAccessible()); m.setAccessible(true); + System.out.println(m + " accessible=" + m.isAccessible()); try { m.invoke(null, new Object(), Object.class); } catch (IllegalAccessException iae) { @@ -518,6 +520,42 @@ public class Main { return stb.toString(); } + public static void checkUnique() { + Field field1, field2; + try { + field1 = Main.class.getField("dummy"); + field2 = Main.class.getField("dummy"); + } catch (NoSuchFieldException nsfe) { + throw new RuntimeException(nsfe); + } + if (field1 == field2) { + System.out.println("ERROR: fields shouldn't have reference equality"); + } else { + System.out.println("fields are unique"); + } + if (field1.hashCode() == field2.hashCode() && field1.equals(field2)) { + System.out.println("fields are .equals"); + } else { + System.out.println("ERROR: fields fail equality"); + } + Method method1, method2; + try { + method1 = Main.class.getMethod("fancyMethod", new Class[] { ArrayList.class }); + method2 = Main.class.getMethod("fancyMethod", new Class[] { ArrayList.class }); + } catch (NoSuchMethodException nsme) { + throw new RuntimeException(nsme); + } + if (method1 == method2) { + System.out.println("ERROR: methods shouldn't have reference equality"); + } else { + System.out.println("methods are unique"); + } + if (method1.hashCode() == method2.hashCode() && method1.equals(method2)) { + System.out.println("methods are .equals"); + } else { + System.out.println("ERROR: methods fail equality"); + } + } public static void main(String[] args) throws Exception { Main test = new Main(); @@ -528,6 +566,7 @@ public class Main { checkClinitForFields(); checkClinitForMethods(); checkGeneric(); + checkUnique(); } } diff --git a/test/100-reflect2/expected.txt b/test/100-reflect2/expected.txt index f56fd98947..3d87ebc559 100644 --- a/test/100-reflect2/expected.txt +++ b/test/100-reflect2/expected.txt @@ -36,7 +36,7 @@ z (class java.lang.Character) 14 (class java.lang.Short) [public java.lang.String(), java.lang.String(int,int,char[]), public java.lang.String(java.lang.String), public java.lang.String(java.lang.StringBuffer), public java.lang.String(java.lang.StringBuilder), public java.lang.String(byte[]), public java.lang.String(byte[],int), public java.lang.String(byte[],int,int), public java.lang.String(byte[],int,int,int), public java.lang.String(byte[],int,int,java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],int,int,java.nio.charset.Charset), public java.lang.String(byte[],java.lang.String) throws java.io.UnsupportedEncodingException, public java.lang.String(byte[],java.nio.charset.Charset), public java.lang.String(char[]), public java.lang.String(char[],int,int), public java.lang.String(int[],int,int)] [private final char[] java.lang.String.value, private final int java.lang.String.count, private int java.lang.String.hashCode, private final int java.lang.String.offset, private static final char[] java.lang.String.ASCII, public static final java.util.Comparator java.lang.String.CASE_INSENSITIVE_ORDER, private static final char java.lang.String.REPLACEMENT_CHAR, private static final long java.lang.String.serialVersionUID] -[void java.lang.String._getChars(int,int,char[],int), public char java.lang.String.charAt(int), public int java.lang.String.codePointAt(int), public int java.lang.String.codePointBefore(int), public int java.lang.String.codePointCount(int,int), public volatile int java.lang.String.compareTo(java.lang.Object), public native int java.lang.String.compareTo(java.lang.String), public int java.lang.String.compareToIgnoreCase(java.lang.String), public java.lang.String java.lang.String.concat(java.lang.String), public boolean java.lang.String.contains(java.lang.CharSequence), public boolean java.lang.String.contentEquals(java.lang.CharSequence), public boolean java.lang.String.contentEquals(java.lang.StringBuffer), public boolean java.lang.String.endsWith(java.lang.String), public boolean java.lang.String.equals(java.lang.Object), public boolean java.lang.String.equalsIgnoreCase(java.lang.String), public void java.lang.String.getBytes(int,int,byte[],int), public [B java.lang.String.getBytes(), public [B java.lang.String.getBytes(java.lang.String) throws java.io.UnsupportedEncodingException, public [B java.lang.String.getBytes(java.nio.charset.Charset), public void java.lang.String.getChars(int,int,char[],int), public int java.lang.String.hashCode(), public int java.lang.String.indexOf(int), public int java.lang.String.indexOf(int,int), public int java.lang.String.indexOf(java.lang.String), public int java.lang.String.indexOf(java.lang.String,int), public native java.lang.String java.lang.String.intern(), public boolean java.lang.String.isEmpty(), public int java.lang.String.lastIndexOf(int), public int java.lang.String.lastIndexOf(int,int), public int java.lang.String.lastIndexOf(java.lang.String), public int java.lang.String.lastIndexOf(java.lang.String,int), public int java.lang.String.length(), public boolean java.lang.String.matches(java.lang.String), public int java.lang.String.offsetByCodePoints(int,int), public boolean java.lang.String.regionMatches(int,java.lang.String,int,int), public boolean java.lang.String.regionMatches(boolean,int,java.lang.String,int,int), public java.lang.String java.lang.String.replace(char,char), public java.lang.String java.lang.String.replace(java.lang.CharSequence,java.lang.CharSequence), public java.lang.String java.lang.String.replaceAll(java.lang.String,java.lang.String), public java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String), public [Ljava.lang.String; java.lang.String.split(java.lang.String), public [Ljava.lang.String; java.lang.String.split(java.lang.String,int), public boolean java.lang.String.startsWith(java.lang.String), public boolean java.lang.String.startsWith(java.lang.String,int), public java.lang.CharSequence java.lang.String.subSequence(int,int), public java.lang.String java.lang.String.substring(int), public java.lang.String java.lang.String.substring(int,int), public [C java.lang.String.toCharArray(), public java.lang.String java.lang.String.toLowerCase(), public java.lang.String java.lang.String.toLowerCase(java.util.Locale), public java.lang.String java.lang.String.toString(), public java.lang.String java.lang.String.toUpperCase(), public java.lang.String java.lang.String.toUpperCase(java.util.Locale), public java.lang.String java.lang.String.trim(), static void java.lang.String.(), public static java.lang.String java.lang.String.copyValueOf(char[]), public static java.lang.String java.lang.String.copyValueOf(char[],int,int), private java.lang.StringIndexOutOfBoundsException java.lang.String.failedBoundsCheck(int,int,int), private native int java.lang.String.fastIndexOf(int,int), private char java.lang.String.foldCase(char), public static transient java.lang.String java.lang.String.format(java.lang.String,java.lang.Object[]), public static transient java.lang.String java.lang.String.format(java.util.Locale,java.lang.String,java.lang.Object[]), private java.lang.StringIndexOutOfBoundsException java.lang.String.indexAndLength(int), private static int java.lang.String.indexOf(java.lang.String,java.lang.String,int,int,char), private int java.lang.String.indexOfSupplementary(int,int), private int java.lang.String.lastIndexOfSupplementary(int,int), private java.lang.StringIndexOutOfBoundsException java.lang.String.startEndAndLength(int,int), public static java.lang.String java.lang.String.valueOf(char), public static java.lang.String java.lang.String.valueOf(double), public static java.lang.String java.lang.String.valueOf(float), public static java.lang.String java.lang.String.valueOf(int), public static java.lang.String java.lang.String.valueOf(long), public static java.lang.String java.lang.String.valueOf(java.lang.Object), public static java.lang.String java.lang.String.valueOf(boolean), public static java.lang.String java.lang.String.valueOf(char[]), public static java.lang.String java.lang.String.valueOf(char[],int,int)] +[void java.lang.String._getChars(int,int,char[],int), public char java.lang.String.charAt(int), public int java.lang.String.codePointAt(int), public int java.lang.String.codePointBefore(int), public int java.lang.String.codePointCount(int,int), public volatile int java.lang.String.compareTo(java.lang.Object), public native int java.lang.String.compareTo(java.lang.String), public int java.lang.String.compareToIgnoreCase(java.lang.String), public java.lang.String java.lang.String.concat(java.lang.String), public boolean java.lang.String.contains(java.lang.CharSequence), public boolean java.lang.String.contentEquals(java.lang.CharSequence), public boolean java.lang.String.contentEquals(java.lang.StringBuffer), public boolean java.lang.String.endsWith(java.lang.String), public boolean java.lang.String.equals(java.lang.Object), public boolean java.lang.String.equalsIgnoreCase(java.lang.String), public void java.lang.String.getBytes(int,int,byte[],int), public [B java.lang.String.getBytes(), public [B java.lang.String.getBytes(java.lang.String) throws java.io.UnsupportedEncodingException, public [B java.lang.String.getBytes(java.nio.charset.Charset), public void java.lang.String.getChars(int,int,char[],int), public int java.lang.String.hashCode(), public int java.lang.String.indexOf(int), public int java.lang.String.indexOf(int,int), public int java.lang.String.indexOf(java.lang.String), public int java.lang.String.indexOf(java.lang.String,int), public native java.lang.String java.lang.String.intern(), public boolean java.lang.String.isEmpty(), public int java.lang.String.lastIndexOf(int), public int java.lang.String.lastIndexOf(int,int), public int java.lang.String.lastIndexOf(java.lang.String), public int java.lang.String.lastIndexOf(java.lang.String,int), public int java.lang.String.length(), public boolean java.lang.String.matches(java.lang.String), public int java.lang.String.offsetByCodePoints(int,int), public boolean java.lang.String.regionMatches(int,java.lang.String,int,int), public boolean java.lang.String.regionMatches(boolean,int,java.lang.String,int,int), public java.lang.String java.lang.String.replace(char,char), public java.lang.String java.lang.String.replace(java.lang.CharSequence,java.lang.CharSequence), public java.lang.String java.lang.String.replaceAll(java.lang.String,java.lang.String), public java.lang.String java.lang.String.replaceFirst(java.lang.String,java.lang.String), public [Ljava.lang.String; java.lang.String.split(java.lang.String), public [Ljava.lang.String; java.lang.String.split(java.lang.String,int), public boolean java.lang.String.startsWith(java.lang.String), public boolean java.lang.String.startsWith(java.lang.String,int), public java.lang.CharSequence java.lang.String.subSequence(int,int), public java.lang.String java.lang.String.substring(int), public java.lang.String java.lang.String.substring(int,int), public [C java.lang.String.toCharArray(), public java.lang.String java.lang.String.toLowerCase(), public java.lang.String java.lang.String.toLowerCase(java.util.Locale), public java.lang.String java.lang.String.toString(), public java.lang.String java.lang.String.toUpperCase(), public java.lang.String java.lang.String.toUpperCase(java.util.Locale), public java.lang.String java.lang.String.trim(), public static java.lang.String java.lang.String.copyValueOf(char[]), public static java.lang.String java.lang.String.copyValueOf(char[],int,int), private java.lang.StringIndexOutOfBoundsException java.lang.String.failedBoundsCheck(int,int,int), private native int java.lang.String.fastIndexOf(int,int), private char java.lang.String.foldCase(char), public static transient java.lang.String java.lang.String.format(java.lang.String,java.lang.Object[]), public static transient java.lang.String java.lang.String.format(java.util.Locale,java.lang.String,java.lang.Object[]), private java.lang.StringIndexOutOfBoundsException java.lang.String.indexAndLength(int), private static int java.lang.String.indexOf(java.lang.String,java.lang.String,int,int,char), private int java.lang.String.indexOfSupplementary(int,int), private int java.lang.String.lastIndexOfSupplementary(int,int), private java.lang.StringIndexOutOfBoundsException java.lang.String.startEndAndLength(int,int), public static java.lang.String java.lang.String.valueOf(char), public static java.lang.String java.lang.String.valueOf(double), public static java.lang.String java.lang.String.valueOf(float), public static java.lang.String java.lang.String.valueOf(int), public static java.lang.String java.lang.String.valueOf(long), public static java.lang.String java.lang.String.valueOf(java.lang.Object), public static java.lang.String java.lang.String.valueOf(boolean), public static java.lang.String java.lang.String.valueOf(char[]), public static java.lang.String java.lang.String.valueOf(char[],int,int)] [] [interface java.io.Serializable, interface java.lang.Comparable, interface java.lang.CharSequence] 0 diff --git a/test/ReferenceMap/stack_walk_refmap_jni.cc b/test/ReferenceMap/stack_walk_refmap_jni.cc index 84f5f2ea29..1f6e307f26 100644 --- a/test/ReferenceMap/stack_walk_refmap_jni.cc +++ b/test/ReferenceMap/stack_walk_refmap_jni.cc @@ -20,8 +20,8 @@ #include "class_linker.h" #include "dex_file-inl.h" #include "gc_map.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object_array-inl.h" #include "object_utils.h" @@ -52,7 +52,7 @@ struct ReferenceMap2Visitor : public StackVisitor { } bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); if (!m || m->IsNative() || m->IsRuntimeMethod() || IsShadowFrame()) { return true; } diff --git a/test/StackWalk/stack_walk_jni.cc b/test/StackWalk/stack_walk_jni.cc index 8f4aae61fd..528586ed7b 100644 --- a/test/StackWalk/stack_walk_jni.cc +++ b/test/StackWalk/stack_walk_jni.cc @@ -19,8 +19,8 @@ #include "UniquePtr.h" #include "class_linker.h" #include "gc_map.h" -#include "mirror/abstract_method.h" -#include "mirror/abstract_method-inl.h" +#include "mirror/art_method.h" +#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object_array-inl.h" #include "mirror/object-inl.h" @@ -50,7 +50,7 @@ struct TestReferenceMapVisitor : public StackVisitor { } bool VisitFrame() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::AbstractMethod* m = GetMethod(); + mirror::ArtMethod* m = GetMethod(); CHECK(m != NULL); LOG(INFO) << "At " << PrettyMethod(m, false); -- cgit v1.2.3-59-g8ed1b