Merge "Add --trace variants of the run-test testing rules."
diff --git a/compiler/dex/quick/mir_to_lir.cc b/compiler/dex/quick/mir_to_lir.cc
index 07c615f..edb3b23 100644
--- a/compiler/dex/quick/mir_to_lir.cc
+++ b/compiler/dex/quick/mir_to_lir.cc
@@ -18,7 +18,6 @@
 #include "dex/dataflow_iterator-inl.h"
 #include "dex/quick/dex_file_method_inliner.h"
 #include "mir_to_lir-inl.h"
-#include "object_utils.h"
 #include "thread-inl.h"
 
 namespace art {
diff --git a/compiler/driver/compiler_driver-inl.h b/compiler/driver/compiler_driver-inl.h
index e175d37..89295f2 100644
--- a/compiler/driver/compiler_driver-inl.h
+++ b/compiler/driver/compiler_driver-inl.h
@@ -20,12 +20,10 @@
 #include "compiler_driver.h"
 
 #include "dex/compiler_ir.h"
-#include "mirror/art_field.h"
+#include "field_helper.h"
 #include "mirror/art_field-inl.h"
-#include "mirror/art_method.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/class_loader.h"
-#include "mirror/dex_cache.h"
 #include "mirror/dex_cache-inl.h"
 #include "mirror/art_field-inl.h"
 #include "scoped_thread_state_change.h"
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 7014c3b..9e88c8d 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -35,7 +35,7 @@
 #include "dex/quick/dex_file_method_inliner.h"
 #include "driver/compiler_options.h"
 #include "jni_internal.h"
-#include "object_utils.h"
+#include "object_lock.h"
 #include "profiler.h"
 #include "runtime.h"
 #include "gc/accounting/card_table-inl.h"
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 38b4100..8ef2964 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -51,7 +51,6 @@
 #include "mirror/string-inl.h"
 #include "oat.h"
 #include "oat_file.h"
-#include "object_utils.h"
 #include "runtime.h"
 #include "scoped_thread_state_change.h"
 #include "handle_scope-inl.h"
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 3f2f925..77946b0 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -57,7 +57,6 @@
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
 #include "oat_writer.h"
-#include "object_utils.h"
 #include "os.h"
 #include "runtime.h"
 #include "ScopedLocalRef.h"
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 8834022..b8f20f3 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -29,6 +29,7 @@
 #include "dex_file-inl.h"
 #include "dex_instruction.h"
 #include "disassembler.h"
+#include "field_helper.h"
 #include "gc_map.h"
 #include "gc/space/image_space.h"
 #include "gc/space/large_object_space.h"
@@ -45,7 +46,6 @@
 #include "noop_compiler_callbacks.h"
 #include "oat.h"
 #include "oat_file-inl.h"
-#include "object_utils.h"
 #include "os.h"
 #include "runtime.h"
 #include "safe_map.h"
diff --git a/runtime/Android.mk b/runtime/Android.mk
index 9d42eea..f2d3c8e 100644
--- a/runtime/Android.mk
+++ b/runtime/Android.mk
@@ -19,291 +19,294 @@
 include art/build/Android.common_build.mk
 
 LIBART_COMMON_SRC_FILES := \
-	atomic.cc.arm \
-	barrier.cc \
-	base/allocator.cc \
-	base/bit_vector.cc \
-	base/hex_dump.cc \
-	base/logging.cc \
-	base/mutex.cc \
-	base/scoped_flock.cc \
-	base/stringpiece.cc \
-	base/stringprintf.cc \
-	base/timing_logger.cc \
-	base/unix_file/fd_file.cc \
-	base/unix_file/mapped_file.cc \
-	base/unix_file/null_file.cc \
-	base/unix_file/random_access_file_utils.cc \
-	base/unix_file/string_file.cc \
-	check_jni.cc \
-	class_linker.cc \
-	common_throws.cc \
-	debugger.cc \
-	dex_file.cc \
-	dex_file_verifier.cc \
-	dex_instruction.cc \
-	elf_file.cc \
-	gc/allocator/dlmalloc.cc \
-	gc/allocator/rosalloc.cc \
-	gc/accounting/card_table.cc \
-	gc/accounting/gc_allocator.cc \
-	gc/accounting/heap_bitmap.cc \
-	gc/accounting/mod_union_table.cc \
-	gc/accounting/remembered_set.cc \
-	gc/accounting/space_bitmap.cc \
-	gc/collector/concurrent_copying.cc \
-	gc/collector/garbage_collector.cc \
-	gc/collector/immune_region.cc \
-	gc/collector/mark_compact.cc \
-	gc/collector/mark_sweep.cc \
-	gc/collector/partial_mark_sweep.cc \
-	gc/collector/semi_space.cc \
-	gc/collector/sticky_mark_sweep.cc \
-	gc/gc_cause.cc \
-	gc/heap.cc \
-	gc/reference_processor.cc \
-	gc/reference_queue.cc \
-	gc/space/bump_pointer_space.cc \
-	gc/space/dlmalloc_space.cc \
-	gc/space/image_space.cc \
-	gc/space/large_object_space.cc \
-	gc/space/malloc_space.cc \
-	gc/space/rosalloc_space.cc \
-	gc/space/space.cc \
-	gc/space/zygote_space.cc \
-	hprof/hprof.cc \
-	image.cc \
-	indirect_reference_table.cc \
-	instruction_set.cc \
-	instrumentation.cc \
-	intern_table.cc \
-	interpreter/interpreter.cc \
-	interpreter/interpreter_common.cc \
-	interpreter/interpreter_switch_impl.cc \
-	jdwp/jdwp_event.cc \
-	jdwp/jdwp_expand_buf.cc \
-	jdwp/jdwp_handler.cc \
-	jdwp/jdwp_main.cc \
-	jdwp/jdwp_request.cc \
-	jdwp/jdwp_socket.cc \
-	jdwp/object_registry.cc \
-	jni_internal.cc \
-	jobject_comparator.cc \
-	mem_map.cc \
-	memory_region.cc \
-	mirror/art_field.cc \
-	mirror/art_method.cc \
-	mirror/array.cc \
-	mirror/class.cc \
-	mirror/dex_cache.cc \
-	mirror/object.cc \
-	mirror/reference.cc \
-	mirror/stack_trace_element.cc \
-	mirror/string.cc \
-	mirror/throwable.cc \
-	monitor.cc \
-	native/dalvik_system_DexFile.cc \
-	native/dalvik_system_VMDebug.cc \
-	native/dalvik_system_VMRuntime.cc \
-	native/dalvik_system_VMStack.cc \
-	native/dalvik_system_ZygoteHooks.cc \
-	native/java_lang_Class.cc \
-	native/java_lang_DexCache.cc \
-	native/java_lang_Object.cc \
-	native/java_lang_Runtime.cc \
-	native/java_lang_String.cc \
-	native/java_lang_System.cc \
-	native/java_lang_Thread.cc \
-	native/java_lang_Throwable.cc \
-	native/java_lang_VMClassLoader.cc \
-	native/java_lang_ref_Reference.cc \
-	native/java_lang_reflect_Array.cc \
-	native/java_lang_reflect_Constructor.cc \
-	native/java_lang_reflect_Field.cc \
-	native/java_lang_reflect_Method.cc \
-	native/java_lang_reflect_Proxy.cc \
-	native/java_util_concurrent_atomic_AtomicLong.cc \
-	native/org_apache_harmony_dalvik_ddmc_DdmServer.cc \
-	native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
-	native/sun_misc_Unsafe.cc \
-	oat.cc \
-	oat_file.cc \
-	offsets.cc \
-	os_linux.cc \
-	parsed_options.cc \
-	primitive.cc \
-	quick_exception_handler.cc \
-	quick/inline_method_analyser.cc \
-	reference_table.cc \
-	reflection.cc \
-	runtime.cc \
-	signal_catcher.cc \
-	stack.cc \
-	thread.cc \
-	thread_list.cc \
-	thread_pool.cc \
-	throw_location.cc \
-	trace.cc \
-	transaction.cc \
-	profiler.cc \
-	fault_handler.cc \
-	utf.cc \
-	utils.cc \
-	verifier/dex_gc_map.cc \
-	verifier/instruction_flags.cc \
-	verifier/method_verifier.cc \
-	verifier/reg_type.cc \
-	verifier/reg_type_cache.cc \
-	verifier/register_line.cc \
-	well_known_classes.cc \
-	zip_archive.cc
+  atomic.cc.arm \
+  barrier.cc \
+  base/allocator.cc \
+  base/bit_vector.cc \
+  base/hex_dump.cc \
+  base/logging.cc \
+  base/mutex.cc \
+  base/scoped_flock.cc \
+  base/stringpiece.cc \
+  base/stringprintf.cc \
+  base/timing_logger.cc \
+  base/unix_file/fd_file.cc \
+  base/unix_file/mapped_file.cc \
+  base/unix_file/null_file.cc \
+  base/unix_file/random_access_file_utils.cc \
+  base/unix_file/string_file.cc \
+  check_jni.cc \
+  class_linker.cc \
+  common_throws.cc \
+  debugger.cc \
+  dex_file.cc \
+  dex_file_verifier.cc \
+  dex_instruction.cc \
+  elf_file.cc \
+  field_helper.cc \
+  gc/allocator/dlmalloc.cc \
+  gc/allocator/rosalloc.cc \
+  gc/accounting/card_table.cc \
+  gc/accounting/gc_allocator.cc \
+  gc/accounting/heap_bitmap.cc \
+  gc/accounting/mod_union_table.cc \
+  gc/accounting/remembered_set.cc \
+  gc/accounting/space_bitmap.cc \
+  gc/collector/concurrent_copying.cc \
+  gc/collector/garbage_collector.cc \
+  gc/collector/immune_region.cc \
+  gc/collector/mark_compact.cc \
+  gc/collector/mark_sweep.cc \
+  gc/collector/partial_mark_sweep.cc \
+  gc/collector/semi_space.cc \
+  gc/collector/sticky_mark_sweep.cc \
+  gc/gc_cause.cc \
+  gc/heap.cc \
+  gc/reference_processor.cc \
+  gc/reference_queue.cc \
+  gc/space/bump_pointer_space.cc \
+  gc/space/dlmalloc_space.cc \
+  gc/space/image_space.cc \
+  gc/space/large_object_space.cc \
+  gc/space/malloc_space.cc \
+  gc/space/rosalloc_space.cc \
+  gc/space/space.cc \
+  gc/space/zygote_space.cc \
+  hprof/hprof.cc \
+  image.cc \
+  indirect_reference_table.cc \
+  instruction_set.cc \
+  instrumentation.cc \
+  intern_table.cc \
+  interpreter/interpreter.cc \
+  interpreter/interpreter_common.cc \
+  interpreter/interpreter_switch_impl.cc \
+  jdwp/jdwp_event.cc \
+  jdwp/jdwp_expand_buf.cc \
+  jdwp/jdwp_handler.cc \
+  jdwp/jdwp_main.cc \
+  jdwp/jdwp_request.cc \
+  jdwp/jdwp_socket.cc \
+  jdwp/object_registry.cc \
+  jni_internal.cc \
+  jobject_comparator.cc \
+  mem_map.cc \
+  memory_region.cc \
+  method_helper.cc \
+  mirror/art_field.cc \
+  mirror/art_method.cc \
+  mirror/array.cc \
+  mirror/class.cc \
+  mirror/dex_cache.cc \
+  mirror/object.cc \
+  mirror/reference.cc \
+  mirror/stack_trace_element.cc \
+  mirror/string.cc \
+  mirror/throwable.cc \
+  monitor.cc \
+  native/dalvik_system_DexFile.cc \
+  native/dalvik_system_VMDebug.cc \
+  native/dalvik_system_VMRuntime.cc \
+  native/dalvik_system_VMStack.cc \
+  native/dalvik_system_ZygoteHooks.cc \
+  native/java_lang_Class.cc \
+  native/java_lang_DexCache.cc \
+  native/java_lang_Object.cc \
+  native/java_lang_Runtime.cc \
+  native/java_lang_String.cc \
+  native/java_lang_System.cc \
+  native/java_lang_Thread.cc \
+  native/java_lang_Throwable.cc \
+  native/java_lang_VMClassLoader.cc \
+  native/java_lang_ref_Reference.cc \
+  native/java_lang_reflect_Array.cc \
+  native/java_lang_reflect_Constructor.cc \
+  native/java_lang_reflect_Field.cc \
+  native/java_lang_reflect_Method.cc \
+  native/java_lang_reflect_Proxy.cc \
+  native/java_util_concurrent_atomic_AtomicLong.cc \
+  native/org_apache_harmony_dalvik_ddmc_DdmServer.cc \
+  native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
+  native/sun_misc_Unsafe.cc \
+  oat.cc \
+  oat_file.cc \
+  object_lock.cc \
+  offsets.cc \
+  os_linux.cc \
+  parsed_options.cc \
+  primitive.cc \
+  quick_exception_handler.cc \
+  quick/inline_method_analyser.cc \
+  reference_table.cc \
+  reflection.cc \
+  runtime.cc \
+  signal_catcher.cc \
+  stack.cc \
+  thread.cc \
+  thread_list.cc \
+  thread_pool.cc \
+  throw_location.cc \
+  trace.cc \
+  transaction.cc \
+  profiler.cc \
+  fault_handler.cc \
+  utf.cc \
+  utils.cc \
+  verifier/dex_gc_map.cc \
+  verifier/instruction_flags.cc \
+  verifier/method_verifier.cc \
+  verifier/reg_type.cc \
+  verifier/reg_type_cache.cc \
+  verifier/register_line.cc \
+  well_known_classes.cc \
+  zip_archive.cc
 
 LIBART_COMMON_SRC_FILES += \
-	arch/context.cc \
-	arch/memcmp16.cc \
-	arch/arm/registers_arm.cc \
-	arch/arm64/registers_arm64.cc \
-	arch/x86/registers_x86.cc \
-	arch/mips/registers_mips.cc \
-	entrypoints/entrypoint_utils.cc \
-	entrypoints/interpreter/interpreter_entrypoints.cc \
-	entrypoints/jni/jni_entrypoints.cc \
-	entrypoints/math_entrypoints.cc \
-	entrypoints/portable/portable_alloc_entrypoints.cc \
-	entrypoints/portable/portable_cast_entrypoints.cc \
-	entrypoints/portable/portable_dexcache_entrypoints.cc \
-	entrypoints/portable/portable_field_entrypoints.cc \
-	entrypoints/portable/portable_fillarray_entrypoints.cc \
-	entrypoints/portable/portable_invoke_entrypoints.cc \
-	entrypoints/portable/portable_jni_entrypoints.cc \
-	entrypoints/portable/portable_lock_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 \
-	entrypoints/quick/quick_dexcache_entrypoints.cc \
-	entrypoints/quick/quick_field_entrypoints.cc \
-	entrypoints/quick/quick_fillarray_entrypoints.cc \
-	entrypoints/quick/quick_instrumentation_entrypoints.cc \
-	entrypoints/quick/quick_jni_entrypoints.cc \
-	entrypoints/quick/quick_lock_entrypoints.cc \
-	entrypoints/quick/quick_math_entrypoints.cc \
-	entrypoints/quick/quick_thread_entrypoints.cc \
-	entrypoints/quick/quick_throw_entrypoints.cc \
-	entrypoints/quick/quick_trampoline_entrypoints.cc
+  arch/context.cc \
+  arch/memcmp16.cc \
+  arch/arm/registers_arm.cc \
+  arch/arm64/registers_arm64.cc \
+  arch/x86/registers_x86.cc \
+  arch/mips/registers_mips.cc \
+  entrypoints/entrypoint_utils.cc \
+  entrypoints/interpreter/interpreter_entrypoints.cc \
+  entrypoints/jni/jni_entrypoints.cc \
+  entrypoints/math_entrypoints.cc \
+  entrypoints/portable/portable_alloc_entrypoints.cc \
+  entrypoints/portable/portable_cast_entrypoints.cc \
+  entrypoints/portable/portable_dexcache_entrypoints.cc \
+  entrypoints/portable/portable_field_entrypoints.cc \
+  entrypoints/portable/portable_fillarray_entrypoints.cc \
+  entrypoints/portable/portable_invoke_entrypoints.cc \
+  entrypoints/portable/portable_jni_entrypoints.cc \
+  entrypoints/portable/portable_lock_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 \
+  entrypoints/quick/quick_dexcache_entrypoints.cc \
+  entrypoints/quick/quick_field_entrypoints.cc \
+  entrypoints/quick/quick_fillarray_entrypoints.cc \
+  entrypoints/quick/quick_instrumentation_entrypoints.cc \
+  entrypoints/quick/quick_jni_entrypoints.cc \
+  entrypoints/quick/quick_lock_entrypoints.cc \
+  entrypoints/quick/quick_math_entrypoints.cc \
+  entrypoints/quick/quick_thread_entrypoints.cc \
+  entrypoints/quick/quick_throw_entrypoints.cc \
+  entrypoints/quick/quick_trampoline_entrypoints.cc
 
 # Source files that only compile with GCC.
 LIBART_GCC_ONLY_SRC_FILES := \
-	interpreter/interpreter_goto_table_impl.cc
+  interpreter/interpreter_goto_table_impl.cc
 
 LIBART_TARGET_LDFLAGS :=
 LIBART_HOST_LDFLAGS :=
 
 LIBART_TARGET_SRC_FILES := \
-	$(LIBART_COMMON_SRC_FILES) \
-	base/logging_android.cc \
-	jdwp/jdwp_adb.cc \
-	monitor_android.cc \
-	runtime_android.cc \
-	thread_android.cc
+  $(LIBART_COMMON_SRC_FILES) \
+  base/logging_android.cc \
+  jdwp/jdwp_adb.cc \
+  monitor_android.cc \
+  runtime_android.cc \
+  thread_android.cc
 
 LIBART_TARGET_SRC_FILES_arm := \
-	arch/arm/context_arm.cc.arm \
-	arch/arm/entrypoints_init_arm.cc \
-	arch/arm/jni_entrypoints_arm.S \
-	arch/arm/memcmp16_arm.S \
-	arch/arm/portable_entrypoints_arm.S \
-	arch/arm/quick_entrypoints_arm.S \
-	arch/arm/arm_sdiv.S \
-	arch/arm/thread_arm.cc \
-	arch/arm/fault_handler_arm.cc
+  arch/arm/context_arm.cc.arm \
+  arch/arm/entrypoints_init_arm.cc \
+  arch/arm/jni_entrypoints_arm.S \
+  arch/arm/memcmp16_arm.S \
+  arch/arm/portable_entrypoints_arm.S \
+  arch/arm/quick_entrypoints_arm.S \
+  arch/arm/arm_sdiv.S \
+  arch/arm/thread_arm.cc \
+  arch/arm/fault_handler_arm.cc
 
 LIBART_TARGET_SRC_FILES_arm64 := \
-	arch/arm64/context_arm64.cc \
-	arch/arm64/entrypoints_init_arm64.cc \
-	arch/arm64/jni_entrypoints_arm64.S \
-	arch/arm64/memcmp16_arm64.S \
-	arch/arm64/portable_entrypoints_arm64.S \
-	arch/arm64/quick_entrypoints_arm64.S \
-	arch/arm64/thread_arm64.cc \
-	monitor_pool.cc \
-	arch/arm64/fault_handler_arm64.cc
+  arch/arm64/context_arm64.cc \
+  arch/arm64/entrypoints_init_arm64.cc \
+  arch/arm64/jni_entrypoints_arm64.S \
+  arch/arm64/memcmp16_arm64.S \
+  arch/arm64/portable_entrypoints_arm64.S \
+  arch/arm64/quick_entrypoints_arm64.S \
+  arch/arm64/thread_arm64.cc \
+  monitor_pool.cc \
+  arch/arm64/fault_handler_arm64.cc
 
 LIBART_SRC_FILES_x86 := \
-	arch/x86/context_x86.cc \
-	arch/x86/entrypoints_init_x86.cc \
-	arch/x86/jni_entrypoints_x86.S \
-	arch/x86/portable_entrypoints_x86.S \
-	arch/x86/quick_entrypoints_x86.S \
-	arch/x86/thread_x86.cc \
-	arch/x86/fault_handler_x86.cc
+  arch/x86/context_x86.cc \
+  arch/x86/entrypoints_init_x86.cc \
+  arch/x86/jni_entrypoints_x86.S \
+  arch/x86/portable_entrypoints_x86.S \
+  arch/x86/quick_entrypoints_x86.S \
+  arch/x86/thread_x86.cc \
+  arch/x86/fault_handler_x86.cc
 
 LIBART_TARGET_SRC_FILES_x86 := \
-	$(LIBART_SRC_FILES_x86)
+  $(LIBART_SRC_FILES_x86)
 
 LIBART_SRC_FILES_x86_64 := \
-	arch/x86_64/context_x86_64.cc \
-	arch/x86_64/entrypoints_init_x86_64.cc \
-	arch/x86_64/jni_entrypoints_x86_64.S \
-	arch/x86_64/portable_entrypoints_x86_64.S \
-	arch/x86_64/quick_entrypoints_x86_64.S \
-	arch/x86_64/thread_x86_64.cc \
-	monitor_pool.cc \
-	arch/x86_64/fault_handler_x86_64.cc
+  arch/x86_64/context_x86_64.cc \
+  arch/x86_64/entrypoints_init_x86_64.cc \
+  arch/x86_64/jni_entrypoints_x86_64.S \
+  arch/x86_64/portable_entrypoints_x86_64.S \
+  arch/x86_64/quick_entrypoints_x86_64.S \
+  arch/x86_64/thread_x86_64.cc \
+  monitor_pool.cc \
+  arch/x86_64/fault_handler_x86_64.cc
 
 LIBART_TARGET_SRC_FILES_x86_64 := \
-	$(LIBART_SRC_FILES_x86_64) \
+  $(LIBART_SRC_FILES_x86_64) \
 
 LIBART_TARGET_SRC_FILES_mips := \
-	arch/mips/context_mips.cc \
-	arch/mips/entrypoints_init_mips.cc \
-	arch/mips/jni_entrypoints_mips.S \
-	arch/mips/memcmp16_mips.S \
-	arch/mips/portable_entrypoints_mips.S \
-	arch/mips/quick_entrypoints_mips.S \
-	arch/mips/thread_mips.cc \
-	arch/mips/fault_handler_mips.cc
+  arch/mips/context_mips.cc \
+  arch/mips/entrypoints_init_mips.cc \
+  arch/mips/jni_entrypoints_mips.S \
+  arch/mips/memcmp16_mips.S \
+  arch/mips/portable_entrypoints_mips.S \
+  arch/mips/quick_entrypoints_mips.S \
+  arch/mips/thread_mips.cc \
+  arch/mips/fault_handler_mips.cc
 
 ifeq ($(TARGET_ARCH),mips64)
 $(info TODOMips64: $(LOCAL_PATH)/Android.mk Add mips64 specific runtime files)
 endif # TARGET_ARCH != mips64
 
 LIBART_HOST_SRC_FILES := \
-	$(LIBART_COMMON_SRC_FILES) \
-	base/logging_linux.cc \
-	monitor_linux.cc \
-	runtime_linux.cc \
-	thread_linux.cc
+  $(LIBART_COMMON_SRC_FILES) \
+  base/logging_linux.cc \
+  monitor_linux.cc \
+  runtime_linux.cc \
+  thread_linux.cc
 
 LIBART_HOST_SRC_FILES_32 := \
-	$(LIBART_SRC_FILES_x86)
+  $(LIBART_SRC_FILES_x86)
 
 LIBART_HOST_SRC_FILES_64 := \
-	$(LIBART_SRC_FILES_x86_64)
+  $(LIBART_SRC_FILES_x86_64)
 
 LIBART_ENUM_OPERATOR_OUT_HEADER_FILES := \
-	arch/x86_64/registers_x86_64.h \
-	base/mutex.h \
-	dex_file.h \
-	dex_instruction.h \
-	gc/collector/gc_type.h \
-	gc/space/space.h \
-	gc/heap.h \
-	indirect_reference_table.h \
-	instruction_set.h \
-	invoke_type.h \
-	jdwp/jdwp.h \
-	jdwp/jdwp_constants.h \
-	lock_word.h \
-	mirror/class.h \
-	oat.h \
-	object_callbacks.h \
-	quick/inline_method_analyser.h \
-	thread.h \
-	thread_state.h \
-	verifier/method_verifier.h
+  arch/x86_64/registers_x86_64.h \
+  base/mutex.h \
+  dex_file.h \
+  dex_instruction.h \
+  gc/collector/gc_type.h \
+  gc/space/space.h \
+  gc/heap.h \
+  indirect_reference_table.h \
+  instruction_set.h \
+  invoke_type.h \
+  jdwp/jdwp.h \
+  jdwp/jdwp_constants.h \
+  lock_word.h \
+  mirror/class.h \
+  oat.h \
+  object_callbacks.h \
+  quick/inline_method_analyser.h \
+  thread.h \
+  thread_state.h \
+  verifier/method_verifier.h
 
 LIBART_CFLAGS :=
 ifeq ($(ART_USE_PORTABLE_COMPILER),true)
diff --git a/runtime/check_jni.cc b/runtime/check_jni.cc
index fefb907..9ad8a07 100644
--- a/runtime/check_jni.cc
+++ b/runtime/check_jni.cc
@@ -23,6 +23,7 @@
 #include "class_linker.h"
 #include "class_linker-inl.h"
 #include "dex_file-inl.h"
+#include "field_helper.h"
 #include "gc/space/space.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method-inl.h"
@@ -31,7 +32,6 @@
 #include "mirror/object_array-inl.h"
 #include "mirror/string-inl.h"
 #include "mirror/throwable.h"
-#include "object_utils.h"
 #include "runtime.h"
 #include "scoped_thread_state_change.h"
 #include "thread.h"
diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h
index a40a2e4..25eb3a3 100644
--- a/runtime/class_linker-inl.h
+++ b/runtime/class_linker-inl.h
@@ -24,7 +24,6 @@
 #include "mirror/dex_cache-inl.h"
 #include "mirror/iftable.h"
 #include "mirror/object_array.h"
-#include "object_utils.h"
 #include "handle_scope-inl.h"
 
 namespace art {
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 2e51cf8..2c11f8b 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -42,8 +42,10 @@
 #include "intern_table.h"
 #include "interpreter/interpreter.h"
 #include "leb128.h"
+#include "method_helper.h"
 #include "oat.h"
 #include "oat_file.h"
+#include "object_lock.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/class.h"
@@ -57,7 +59,6 @@
 #include "mirror/reference-inl.h"
 #include "mirror/stack_trace_element.h"
 #include "mirror/string-inl.h"
-#include "object_utils.h"
 #include "os.h"
 #include "runtime.h"
 #include "entrypoints/entrypoint_utils.h"
@@ -824,9 +825,20 @@
       }
     } else {
       // TODO: What to lock here?
+      bool obsolete_file_cleanup_failed;
       open_oat_file.reset(FindOatFileContainingDexFileFromDexLocation(dex_location,
                                                                       dex_location_checksum_pointer,
-                                                                      kRuntimeISA, error_msgs));
+                                                                      kRuntimeISA, error_msgs,
+                                                                      &obsolete_file_cleanup_failed));
+      // There's no point in going forward and eventually try to regenerate the
+      // file if we couldn't remove the obsolete one. Mostly likely we will fail
+      // with the same error when trying to write the new file.
+      // In case the clean up failure is due to permission issues it's *mandatory*
+      // to stop to avoid regenerating under the wrong user.
+      // TODO: should we maybe do this only when we get permission issues? (i.e. EACCESS).
+      if (obsolete_file_cleanup_failed) {
+        return false;
+      }
     }
     needs_registering = true;
   }
@@ -1084,7 +1096,9 @@
     const char* dex_location,
     const uint32_t* const dex_location_checksum,
     InstructionSet isa,
-    std::vector<std::string>* error_msgs) {
+    std::vector<std::string>* error_msgs,
+    bool* obsolete_file_cleanup_failed) {
+  *obsolete_file_cleanup_failed = false;
   // Look for an existing file next to dex. for example, for
   // /foo/bar/baz.jar, look for /foo/bar/<isa>/baz.odex.
   std::string odex_filename(DexFilenameToOdexFilename(dex_location, isa));
@@ -1111,9 +1125,18 @@
   if (oat_file != nullptr) {
     return oat_file;
   }
+
   if (!open_failed && TEMP_FAILURE_RETRY(unlink(cache_location.c_str())) != 0) {
-    PLOG(FATAL) << "Failed to remove obsolete oat file from " << cache_location;
+    std::string error_msg = StringPrintf("Failed to remove obsolete file from %s when searching"
+                                         "for dex file %s: %s",
+                                         cache_location.c_str(), dex_location, strerror(errno));
+    error_msgs->push_back(error_msg);
+    VLOG(class_linker) << error_msg;
+    // Let the caller know that we couldn't remove the obsolete file.
+    // This is a good indication that further writes may fail as well.
+    *obsolete_file_cleanup_failed = true;
   }
+
   std::string compound_msg = StringPrintf("Failed to open oat file from %s (error '%s') or %s "
                                           "(error '%s').", odex_filename.c_str(), error_msg.c_str(),
                                           cache_location.c_str(), cache_error_msg.c_str());
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index d9b3d25..64bffc9 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -571,7 +571,8 @@
   const OatFile* FindOatFileContainingDexFileFromDexLocation(const char* location,
                                                              const uint32_t* const location_checksum,
                                                              InstructionSet isa,
-                                                             std::vector<std::string>* error_msgs)
+                                                             std::vector<std::string>* error_msgs,
+                                                             bool* obsolete_file_cleanup_failed)
       LOCKS_EXCLUDED(dex_lock_, Locks::mutator_lock_);
 
   // Find a verify an oat file with the given dex file. Will return nullptr when the oat file
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 7930b48..21fe006 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -23,6 +23,7 @@
 #include "common_runtime_test.h"
 #include "dex_file.h"
 #include "entrypoints/entrypoint_utils-inl.h"
+#include "field_helper.h"
 #include "gc/heap.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method.h"
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc
index 8de3068..970593d 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -16,6 +16,8 @@
 
 #include "common_throws.h"
 
+#include <sstream>
+
 #include "base/logging.h"
 #include "class_linker-inl.h"
 #include "dex_file-inl.h"
@@ -25,12 +27,9 @@
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "thread.h"
 #include "verifier/method_verifier.h"
 
-#include <sstream>
-
 namespace art {
 
 static void AddReferrerLocation(std::ostream& os, mirror::Class* referrer)
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index c95be01..4cf4c09 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -25,11 +25,13 @@
 #include "class_linker-inl.h"
 #include "dex_file-inl.h"
 #include "dex_instruction.h"
+#include "field_helper.h"
 #include "gc/accounting/card_table-inl.h"
 #include "gc/space/large_object_space.h"
 #include "gc/space/space-inl.h"
 #include "handle_scope.h"
 #include "jdwp/object_registry.h"
+#include "method_helper.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/class.h"
@@ -39,7 +41,6 @@
 #include "mirror/object_array-inl.h"
 #include "mirror/string-inl.h"
 #include "mirror/throwable.h"
-#include "object_utils.h"
 #include "quick/inline_method_analyser.h"
 #include "reflection.h"
 #include "safe_map.h"
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 482ad47..542e1a9 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -25,12 +25,12 @@
 #include "indirect_reference_table.h"
 #include "invoke_type.h"
 #include "jni_internal.h"
+#include "method_helper.h"
 #include "mirror/art_method.h"
 #include "mirror/array.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/throwable.h"
-#include "object_utils.h"
 #include "handle_scope-inl.h"
 #include "thread.h"
 
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index d029df2..d063dfb 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -24,7 +24,6 @@
 #include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "mirror/object_array-inl.h"
 #include "reflection.h"
 #include "scoped_thread_state_change.h"
diff --git a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc
index 329c175..64faf76 100644
--- a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc
+++ b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc
@@ -18,7 +18,6 @@
 #include "interpreter/interpreter.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "reflection.h"
 #include "runtime.h"
 #include "stack.h"
diff --git a/runtime/entrypoints/jni/jni_entrypoints.cc b/runtime/entrypoints/jni/jni_entrypoints.cc
index bae4023..edb3b72 100644
--- a/runtime/entrypoints/jni/jni_entrypoints.cc
+++ b/runtime/entrypoints/jni/jni_entrypoints.cc
@@ -18,7 +18,6 @@
 #include "entrypoints/entrypoint_utils.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "scoped_thread_state_change.h"
 #include "thread.h"
 
diff --git a/runtime/entrypoints/portable/portable_throw_entrypoints.cc b/runtime/entrypoints/portable/portable_throw_entrypoints.cc
index 9e36a05..be6231c 100644
--- a/runtime/entrypoints/portable/portable_throw_entrypoints.cc
+++ b/runtime/entrypoints/portable/portable_throw_entrypoints.cc
@@ -80,7 +80,6 @@
   }
   mirror::Class* exception_type = exception->GetClass();
   StackHandleScope<1> hs(self);
-  MethodHelper mh(hs.NewHandle(current_method));
   const DexFile::CodeItem* code_item = current_method->GetCodeItem();
   DCHECK_LT(ti_offset, code_item->tries_size_);
   const DexFile::TryItem* try_item = DexFile::GetTryItems(*code_item, ti_offset);
@@ -98,7 +97,8 @@
       break;
     }
     // Does this catch exception type apply?
-    mirror::Class* iter_exception_type = mh.GetDexCacheResolvedType(iter_type_idx);
+    mirror::Class* iter_exception_type =
+        current_method->GetDexCacheResolvedTypes()->Get(iter_type_idx);
     if (UNLIKELY(iter_exception_type == NULL)) {
       // TODO: check, the verifier (class linker?) should take care of resolving all exception
       //       classes early.
diff --git a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc
index 7ee869b..9f75b0f 100644
--- a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc
@@ -22,7 +22,6 @@
 #include "interpreter/interpreter.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "scoped_thread_state_change.h"
 
 namespace art {
diff --git a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
index 47fb9d6..f9f62c2 100644
--- a/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
@@ -21,7 +21,6 @@
 #include "mirror/class-inl.h"
 #include "mirror/object_array-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "stack.h"
 #include "thread.h"
 #include "verifier/method_verifier.h"
diff --git a/runtime/entrypoints/quick/quick_jni_entrypoints.cc b/runtime/entrypoints/quick/quick_jni_entrypoints.cc
index 30e8609..6537249 100644
--- a/runtime/entrypoints/quick/quick_jni_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_jni_entrypoints.cc
@@ -21,7 +21,6 @@
 #include "mirror/object.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "scoped_thread_state_change.h"
 #include "thread.h"
 #include "verify_object-inl.h"
diff --git a/runtime/entrypoints/quick/quick_throw_entrypoints.cc b/runtime/entrypoints/quick/quick_throw_entrypoints.cc
index 4dcb1c8..879010e 100644
--- a/runtime/entrypoints/quick/quick_throw_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_throw_entrypoints.cc
@@ -18,7 +18,6 @@
 #include "common_throws.h"
 #include "entrypoints/entrypoint_utils-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "thread.h"
 #include "well_known_classes.h"
 
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index f7cb126..338bd06 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -27,7 +27,6 @@
 #include "mirror/dex_cache-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "runtime.h"
 #include "scoped_thread_state_change.h"
 
diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc
index 3112bc0..b4355ca 100644
--- a/runtime/fault_handler.cc
+++ b/runtime/fault_handler.cc
@@ -15,23 +15,16 @@
  */
 
 #include "fault_handler.h"
+
 #include <sys/mman.h>
 #include <sys/ucontext.h>
-#include "base/macros.h"
-#include "globals.h"
-#include "base/logging.h"
-#include "base/hex_dump.h"
-#include "thread.h"
-#include "mirror/art_method-inl.h"
-#include "mirror/class-inl.h"
-#include "mirror/dex_cache.h"
-#include "mirror/object_array-inl.h"
-#include "mirror/object-inl.h"
-#include "object_utils.h"
-#include "scoped_thread_state_change.h"
+
+#include "mirror/art_method.h"
+#include "mirror/class.h"
 #ifdef HAVE_ANDROID_OS
 #include "sigchain.h"
 #endif
+#include "thread-inl.h"
 #include "verify_object-inl.h"
 
 namespace art {
diff --git a/runtime/field_helper.cc b/runtime/field_helper.cc
new file mode 100644
index 0000000..40daa6d
--- /dev/null
+++ b/runtime/field_helper.cc
@@ -0,0 +1,57 @@
+/*
+ * 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_helper.h"
+
+#include "class_linker-inl.h"
+#include "dex_file.h"
+#include "mirror/dex_cache.h"
+#include "runtime.h"
+#include "thread-inl.h"
+
+namespace art {
+
+mirror::Class* FieldHelper::GetType(bool resolve) {
+  uint32_t field_index = field_->GetDexFieldIndex();
+  if (UNLIKELY(field_->GetDeclaringClass()->IsProxyClass())) {
+    return Runtime::Current()->GetClassLinker()->FindSystemClass(Thread::Current(),
+                                                                 field_->GetTypeDescriptor());
+  }
+  const DexFile* dex_file = field_->GetDexFile();
+  const DexFile::FieldId& field_id = dex_file->GetFieldId(field_index);
+  mirror::Class* type = field_->GetDexCache()->GetResolvedType(field_id.type_idx_);
+  if (resolve && (type == nullptr)) {
+    type = Runtime::Current()->GetClassLinker()->ResolveType(field_id.type_idx_, field_.Get());
+    CHECK(type != nullptr || Thread::Current()->IsExceptionPending());
+  }
+  return type;
+}
+
+const char* FieldHelper::GetDeclaringClassDescriptor() {
+  uint32_t field_index = field_->GetDexFieldIndex();
+  if (UNLIKELY(field_->GetDeclaringClass()->IsProxyClass())) {
+    DCHECK(field_->IsStatic());
+    DCHECK_LT(field_index, 2U);
+    // 0 == Class[] interfaces; 1 == Class[][] throws;
+    declaring_class_descriptor_ = field_->GetDeclaringClass()->GetDescriptor();
+    return declaring_class_descriptor_.c_str();
+  }
+  const DexFile* dex_file = field_->GetDexFile();
+  const DexFile::FieldId& field_id = dex_file->GetFieldId(field_index);
+  return dex_file->GetFieldDeclaringClassDescriptor(field_id);
+}
+
+}  // namespace art
diff --git a/runtime/field_helper.h b/runtime/field_helper.h
new file mode 100644
index 0000000..5eae55e
--- /dev/null
+++ b/runtime/field_helper.h
@@ -0,0 +1,54 @@
+/*
+ * 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_FIELD_HELPER_H_
+#define ART_RUNTIME_FIELD_HELPER_H_
+
+#include "base/macros.h"
+#include "handle.h"
+#include "mirror/art_field.h"
+
+namespace art {
+
+class FieldHelper {
+ public:
+  explicit FieldHelper(Handle<mirror::ArtField> f) : field_(f) {}
+
+  void ChangeField(mirror::ArtField* new_f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    DCHECK(new_f != nullptr);
+    field_.Assign(new_f);
+  }
+
+  mirror::ArtField* GetField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    return field_.Get();
+  }
+
+  mirror::Class* GetType(bool resolve = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  // The returned const char* is only guaranteed to be valid for the lifetime of the FieldHelper.
+  // If you need it longer, copy it into a std::string.
+  const char* GetDeclaringClassDescriptor() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+ private:
+  Handle<mirror::ArtField> field_;
+  std::string declaring_class_descriptor_;
+
+  DISALLOW_COPY_AND_ASSIGN(FieldHelper);
+};
+
+}  // namespace art
+
+#endif  // ART_RUNTIME_FIELD_HELPER_H_
diff --git a/runtime/gc/accounting/space_bitmap-inl.h b/runtime/gc/accounting/space_bitmap-inl.h
index 1e9556a..fc4213e 100644
--- a/runtime/gc/accounting/space_bitmap-inl.h
+++ b/runtime/gc/accounting/space_bitmap-inl.h
@@ -23,14 +23,6 @@
 
 #include "atomic.h"
 #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/object-inl.h"
-#include "mirror/object_array-inl.h"
-#include "object_utils.h"
-#include "space_bitmap-inl.h"
 #include "utils.h"
 
 namespace art {
diff --git a/runtime/gc/accounting/space_bitmap.cc b/runtime/gc/accounting/space_bitmap.cc
index c0aa43e..39d1f9e 100644
--- a/runtime/gc/accounting/space_bitmap.cc
+++ b/runtime/gc/accounting/space_bitmap.cc
@@ -16,6 +16,13 @@
 
 #include "space_bitmap-inl.h"
 
+#include "base/stringprintf.h"
+#include "mem_map.h"
+#include "mirror/object-inl.h"
+#include "mirror/class.h"
+#include "mirror/art_field.h"
+#include "mirror/object_array.h"
+
 namespace art {
 namespace gc {
 namespace accounting {
@@ -46,6 +53,9 @@
 }
 
 template<size_t kAlignment>
+SpaceBitmap<kAlignment>::~SpaceBitmap() {}
+
+template<size_t kAlignment>
 SpaceBitmap<kAlignment>* SpaceBitmap<kAlignment>::Create(
     const std::string& name, byte* heap_begin, size_t heap_capacity) {
   // Round up since heap_capacity is not necessarily a multiple of kAlignment * kBitsPerWord.
diff --git a/runtime/gc/accounting/space_bitmap.h b/runtime/gc/accounting/space_bitmap.h
index 6d1ba87..a3073bd 100644
--- a/runtime/gc/accounting/space_bitmap.h
+++ b/runtime/gc/accounting/space_bitmap.h
@@ -54,8 +54,7 @@
   static SpaceBitmap* CreateFromMemMap(const std::string& name, MemMap* mem_map,
                                        byte* heap_begin, size_t heap_capacity);
 
-  ~SpaceBitmap() {
-  }
+  ~SpaceBitmap();
 
   // <offset> is the difference from .base to a pointer address.
   // <index> is the index of .bits that contains the bit representing
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 4ec9bc2..292173d 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -58,7 +58,6 @@
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
 #include "mirror/reference-inl.h"
-#include "object_utils.h"
 #include "os.h"
 #include "reflection.h"
 #include "runtime.h"
diff --git a/runtime/handle.h b/runtime/handle.h
index 7e13601..f70faf4 100644
--- a/runtime/handle.h
+++ b/runtime/handle.h
@@ -28,29 +28,40 @@
 
 template<class T> class Handle;
 
+// Handles are memory locations that contain GC roots. As the mirror::Object*s within a handle are
+// GC visible then the GC may move the references within them, something that couldn't be done with
+// a wrap pointer. Handles are generally allocated within HandleScopes. ConstHandle is a super-class
+// of Handle and doesn't support assignment operations.
 template<class T>
 class ConstHandle {
  public:
   ConstHandle() : reference_(nullptr) {
   }
-  ConstHandle(const ConstHandle<T>& handle) ALWAYS_INLINE : reference_(handle.reference_) {
+
+  ALWAYS_INLINE ConstHandle(const ConstHandle<T>& handle) : reference_(handle.reference_) {
   }
-  ConstHandle<T>& operator=(const ConstHandle<T>& handle) ALWAYS_INLINE {
+
+  ALWAYS_INLINE ConstHandle<T>& operator=(const ConstHandle<T>& handle) {
     reference_ = handle.reference_;
     return *this;
   }
-  explicit ConstHandle(StackReference<T>* reference) ALWAYS_INLINE : reference_(reference) {
+
+  ALWAYS_INLINE explicit ConstHandle(StackReference<T>* reference) : reference_(reference) {
   }
-  T& operator*() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE {
+
+  ALWAYS_INLINE T& operator*() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     return *Get();
   }
-  T* operator->() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE {
+
+  ALWAYS_INLINE T* operator->() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     return Get();
   }
-  T* Get() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE {
+
+  ALWAYS_INLINE T* Get() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     return reference_->AsMirrorPtr();
   }
-  jobject ToJObject() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE {
+
+  ALWAYS_INLINE jobject ToJObject() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     if (UNLIKELY(reference_->AsMirrorPtr() == nullptr)) {
       // Special case so that we work with NullHandles.
       return nullptr;
@@ -73,8 +84,8 @@
   StackReference<T>* GetReference() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE {
     return reference_;
   }
-  const StackReference<T>* GetReference() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-      ALWAYS_INLINE {
+  ALWAYS_INLINE const StackReference<T>* GetReference() const
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     return reference_;
   }
 
@@ -86,47 +97,54 @@
   template<size_t kNumReferences> friend class StackHandleScope;
 };
 
+// Handles that support assignment.
 template<class T>
 class Handle : public ConstHandle<T> {
  public:
   Handle() {
   }
-  Handle(const Handle<T>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE
+
+  ALWAYS_INLINE Handle(const Handle<T>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
       : ConstHandle<T>(handle.reference_) {
   }
-  Handle<T>& operator=(const Handle<T>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-      ALWAYS_INLINE {
+
+  ALWAYS_INLINE Handle<T>& operator=(const Handle<T>& handle)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     ConstHandle<T>::operator=(handle);
     return *this;
   }
-  explicit Handle(StackReference<T>* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-      ALWAYS_INLINE : ConstHandle<T>(reference) {
+
+  ALWAYS_INLINE explicit Handle(StackReference<T>* reference)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+      : ConstHandle<T>(reference) {
   }
-  T* Assign(T* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) ALWAYS_INLINE {
+
+  ALWAYS_INLINE T* Assign(T* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     StackReference<T>* ref = ConstHandle<T>::GetReference();
     T* const old = ref->AsMirrorPtr();
     ref->Assign(reference);
     return old;
   }
 
+  template<typename S>
+  explicit Handle(const Handle<S>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+      : ConstHandle<T>(handle) {
+  }
+
  protected:
   template<typename S>
   explicit Handle(StackReference<S>* reference) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
       : ConstHandle<T>(reference) {
   }
-  template<typename S>
-  explicit Handle(const Handle<S>& handle) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-      : ConstHandle<T>(handle) {
-  }
 
  private:
   friend class BuildGenericJniFrameVisitor;
-  template<class S> friend class Handle;
   friend class HandleScope;
   template<class S> friend class HandleWrapper;
   template<size_t kNumReferences> friend class StackHandleScope;
 };
 
+// A special case of Handle that only holds references to null.
 template<class T>
 class NullHandle : public Handle<T> {
  public:
diff --git a/runtime/handle_scope-inl.h b/runtime/handle_scope-inl.h
index 62c7614..7bc811d 100644
--- a/runtime/handle_scope-inl.h
+++ b/runtime/handle_scope-inl.h
@@ -17,7 +17,7 @@
 #ifndef ART_RUNTIME_HANDLE_SCOPE_INL_H_
 #define ART_RUNTIME_HANDLE_SCOPE_INL_H_
 
-#include "handle_scope-inl.h"
+#include "handle_scope.h"
 
 #include "handle.h"
 #include "thread.h"
diff --git a/runtime/handle_scope.h b/runtime/handle_scope.h
index 2fd42d2..42ef779 100644
--- a/runtime/handle_scope.h
+++ b/runtime/handle_scope.h
@@ -30,8 +30,9 @@
 
 class Thread;
 
-// HandleScopes can be allocated within the bridge frame between managed and native code backed by
-// stack storage or manually allocated in native.
+// HandleScopes are scoped objects containing a number of Handles. They are used to allocate
+// handles, for these handles (and the objects contained within them) to be visible/roots for the
+// GC. It is most common to stack allocate HandleScopes using StackHandleScope.
 class PACKED(4) HandleScope {
  public:
   ~HandleScope() {}
@@ -131,6 +132,7 @@
 
  private:
   template<size_t kNumReferences> friend class StackHandleScope;
+
   DISALLOW_COPY_AND_ASSIGN(HandleScope);
 };
 
@@ -153,7 +155,7 @@
 
 // Scoped handle storage of a fixed size that is usually stack allocated.
 template<size_t kNumReferences>
-class PACKED(4) StackHandleScope : public HandleScope {
+class PACKED(4) StackHandleScope FINAL : public HandleScope {
  public:
   explicit StackHandleScope(Thread* self);
   ~StackHandleScope();
@@ -182,20 +184,29 @@
   template<class T>
   Handle<T> NewHandle(T* object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     SetReference(pos_, object);
-    return Handle<T>(GetHandle(pos_++));
+    Handle<T> h(GetHandle(pos_));
+    pos_++;
+    return h;
   }
 
   template<class T>
   HandleWrapper<T> NewHandleWrapper(T** object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
     SetReference(pos_, *object);
-    Handle<T> h(GetHandle(pos_++));
+    Handle<T> h(GetHandle(pos_));
+    pos_++;
     return HandleWrapper<T>(object, h);
   }
 
  private:
-  // references_storage_ needs to be first so that it matches the address of references_.
+  // References_storage_ needs to be first so that it appears in the same location as
+  // HandleScope::references_.
   StackReference<mirror::Object> references_storage_[kNumReferences];
+
+  // The thread that the stack handle scope is a linked list upon. The stack handle scope will
+  // push and pop itself from this thread.
   Thread* const self_;
+
+  // Position new handles will be created.
   size_t pos_;
 
   template<size_t kNumRefs> friend class StackHandleScope;
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index 33339f8..7e3b6ba 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -52,7 +52,6 @@
 #include "mirror/class.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "os.h"
 #include "safe_map.h"
 #include "scoped_thread_state_change.h"
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index e3d32bb..f4eaa61 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -35,7 +35,6 @@
 #if !defined(ART_USE_PORTABLE_COMPILER)
 #include "entrypoints/quick/quick_entrypoints.h"
 #endif
-#include "object_utils.h"
 #include "os.h"
 #include "scoped_thread_state_change.h"
 #include "thread.h"
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 5a03601..630b324 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -15,6 +15,8 @@
  */
 
 #include "interpreter_common.h"
+
+#include "field_helper.h"
 #include "mirror/array-inl.h"
 
 namespace art {
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index db42eb0..1bcd27e 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -30,6 +30,7 @@
 #include "entrypoints/entrypoint_utils-inl.h"
 #include "gc/accounting/card_table-inl.h"
 #include "handle_scope-inl.h"
+#include "method_helper-inl.h"
 #include "nth_caller_visitor.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method.h"
@@ -39,7 +40,6 @@
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
 #include "mirror/string-inl.h"
-#include "object_utils.h"
 #include "ScopedLocalRef.h"
 #include "scoped_thread_state_change.h"
 #include "thread.h"
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index e97512b..f9c7ec6 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -41,7 +41,6 @@
 #include "mirror/object_array-inl.h"
 #include "mirror/string-inl.h"
 #include "mirror/throwable.h"
-#include "object_utils.h"
 #include "parsed_options.h"
 #include "reflection.h"
 #include "runtime.h"
diff --git a/runtime/method_helper-inl.h b/runtime/method_helper-inl.h
new file mode 100644
index 0000000..42a6089
--- /dev/null
+++ b/runtime/method_helper-inl.h
@@ -0,0 +1,50 @@
+/*
+ * 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_METHOD_HELPER_INL_H_
+#define ART_RUNTIME_METHOD_HELPER_INL_H_
+
+#include "method_helper.h"
+
+#include "runtime.h"
+
+namespace art {
+
+inline mirror::Class* MethodHelper::GetClassFromTypeIdx(uint16_t type_idx, bool resolve) {
+  mirror::ArtMethod* method = GetMethod();
+  mirror::Class* type = method->GetDexCacheResolvedTypes()->Get(type_idx);
+  if (type == nullptr && resolve) {
+    type = Runtime::Current()->GetClassLinker()->ResolveType(type_idx, method);
+    CHECK(type != nullptr || Thread::Current()->IsExceptionPending());
+  }
+  return type;
+}
+
+inline mirror::String* MethodHelper::ResolveString(uint32_t string_idx) {
+  mirror::ArtMethod* method = GetMethod();
+  mirror::String* s = method->GetDexCacheStrings()->Get(string_idx);
+  if (UNLIKELY(s == nullptr)) {
+    StackHandleScope<1> hs(Thread::Current());
+    Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache()));
+    s = Runtime::Current()->GetClassLinker()->ResolveString(*method->GetDexFile(), string_idx,
+                                                            dex_cache);
+  }
+  return s;
+}
+
+}  // namespace art
+
+#endif  // ART_RUNTIME_METHOD_HELPER_INL_H_
diff --git a/runtime/method_helper.cc b/runtime/method_helper.cc
new file mode 100644
index 0000000..4b1b1da
--- /dev/null
+++ b/runtime/method_helper.cc
@@ -0,0 +1,127 @@
+/*
+ * 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 "method_helper.h"
+
+#include "class_linker.h"
+#include "dex_file-inl.h"
+#include "handle_scope-inl.h"
+#include "mirror/art_method-inl.h"
+#include "mirror/dex_cache.h"
+#include "runtime.h"
+
+namespace art {
+
+mirror::String* MethodHelper::GetNameAsString(Thread* self) {
+  const DexFile* dex_file = method_->GetDexFile();
+  mirror::ArtMethod* method = method_->GetInterfaceMethodIfProxy();
+  uint32_t dex_method_idx = method->GetDexMethodIndex();
+  const DexFile::MethodId& method_id = dex_file->GetMethodId(dex_method_idx);
+  StackHandleScope<1> hs(self);
+  Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache()));
+  return Runtime::Current()->GetClassLinker()->ResolveString(*dex_file, method_id.name_idx_,
+                                                             dex_cache);
+}
+
+bool MethodHelper::HasSameNameAndSignature(MethodHelper* other) {
+  const DexFile* dex_file = method_->GetDexFile();
+  const DexFile::MethodId& mid = dex_file->GetMethodId(GetMethod()->GetDexMethodIndex());
+  if (method_->GetDexCache() == other->method_->GetDexCache()) {
+    const DexFile::MethodId& other_mid =
+        dex_file->GetMethodId(other->GetMethod()->GetDexMethodIndex());
+    return mid.name_idx_ == other_mid.name_idx_ && mid.proto_idx_ == other_mid.proto_idx_;
+  }
+  const DexFile* other_dex_file = other->method_->GetDexFile();
+  const DexFile::MethodId& other_mid =
+      other_dex_file->GetMethodId(other->GetMethod()->GetDexMethodIndex());
+  if (!DexFileStringEquals(dex_file, mid.name_idx_, other_dex_file, other_mid.name_idx_)) {
+    return false;  // Name mismatch.
+  }
+  return dex_file->GetMethodSignature(mid) == other_dex_file->GetMethodSignature(other_mid);
+}
+
+uint32_t MethodHelper::FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+  mirror::ArtMethod* method = GetMethod();
+  const DexFile* dexfile = method->GetDexFile();
+  if (dexfile == &other_dexfile) {
+    return method->GetDexMethodIndex();
+  }
+  const DexFile::MethodId& mid = dexfile->GetMethodId(method->GetDexMethodIndex());
+  const char* mid_declaring_class_descriptor = dexfile->StringByTypeIdx(mid.class_idx_);
+  const DexFile::StringId* other_descriptor =
+      other_dexfile.FindStringId(mid_declaring_class_descriptor);
+  if (other_descriptor != nullptr) {
+    const DexFile::TypeId* other_type_id =
+        other_dexfile.FindTypeId(other_dexfile.GetIndexForStringId(*other_descriptor));
+    if (other_type_id != nullptr) {
+      const char* mid_name = dexfile->GetMethodName(mid);
+      const DexFile::StringId* other_name = other_dexfile.FindStringId(mid_name);
+      if (other_name != nullptr) {
+        uint16_t other_return_type_idx;
+        std::vector<uint16_t> other_param_type_idxs;
+        bool success = other_dexfile.CreateTypeList(
+            dexfile->GetMethodSignature(mid).ToString(), &other_return_type_idx,
+            &other_param_type_idxs);
+        if (success) {
+          const DexFile::ProtoId* other_sig =
+              other_dexfile.FindProtoId(other_return_type_idx, other_param_type_idxs);
+          if (other_sig != nullptr) {
+            const  DexFile::MethodId* other_mid = other_dexfile.FindMethodId(
+                *other_type_id, *other_name, *other_sig);
+            if (other_mid != nullptr) {
+              return other_dexfile.GetIndexForMethodId(*other_mid);
+            }
+          }
+        }
+      }
+    }
+  }
+  return DexFile::kDexNoIndex;
+}
+
+uint32_t MethodHelper::FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile,
+                                                        uint32_t name_and_signature_idx)
+    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+  mirror::ArtMethod* method = GetMethod();
+  const DexFile* dexfile = method->GetDexFile();
+  const uint32_t dex_method_idx = method->GetDexMethodIndex();
+  const DexFile::MethodId& mid = dexfile->GetMethodId(dex_method_idx);
+  const DexFile::MethodId& name_and_sig_mid = other_dexfile.GetMethodId(name_and_signature_idx);
+  DCHECK_STREQ(dexfile->GetMethodName(mid), other_dexfile.GetMethodName(name_and_sig_mid));
+  DCHECK_EQ(dexfile->GetMethodSignature(mid), other_dexfile.GetMethodSignature(name_and_sig_mid));
+  if (dexfile == &other_dexfile) {
+    return dex_method_idx;
+  }
+  const char* mid_declaring_class_descriptor = dexfile->StringByTypeIdx(mid.class_idx_);
+  const DexFile::StringId* other_descriptor =
+      other_dexfile.FindStringId(mid_declaring_class_descriptor);
+  if (other_descriptor != nullptr) {
+    const DexFile::TypeId* other_type_id =
+        other_dexfile.FindTypeId(other_dexfile.GetIndexForStringId(*other_descriptor));
+    if (other_type_id != nullptr) {
+      const DexFile::MethodId* other_mid = other_dexfile.FindMethodId(
+          *other_type_id, other_dexfile.GetStringId(name_and_sig_mid.name_idx_),
+          other_dexfile.GetProtoId(name_and_sig_mid.proto_idx_));
+      if (other_mid != nullptr) {
+        return other_dexfile.GetIndexForMethodId(*other_mid);
+      }
+    }
+  }
+  return DexFile::kDexNoIndex;
+}
+
+}  // namespace art
diff --git a/runtime/method_helper.h b/runtime/method_helper.h
new file mode 100644
index 0000000..012695e
--- /dev/null
+++ b/runtime/method_helper.h
@@ -0,0 +1,174 @@
+/*
+ * 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_METHOD_HELPER_H_
+#define ART_RUNTIME_METHOD_HELPER_H_
+
+#include "base/macros.h"
+#include "handle.h"
+#include "mirror/art_method.h"
+#include "primitive.h"
+
+namespace art {
+
+class MethodHelper {
+ public:
+  explicit MethodHelper(Handle<mirror::ArtMethod> m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
+      : method_(m), shorty_(nullptr), shorty_len_(0) {
+    SetMethod(m.Get());
+  }
+
+  void ChangeMethod(mirror::ArtMethod* new_m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    DCHECK(new_m != nullptr);
+    SetMethod(new_m);
+    shorty_ = nullptr;
+  }
+
+  mirror::ArtMethod* GetMethod() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    return method_->GetInterfaceMethodIfProxy();
+  }
+
+  mirror::String* GetNameAsString(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  const char* GetShorty() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    const char* result = shorty_;
+    if (result == nullptr) {
+      result = method_->GetShorty(&shorty_len_);
+      shorty_ = result;
+    }
+    return result;
+  }
+
+  uint32_t GetShortyLength() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    if (shorty_ == nullptr) {
+      GetShorty();
+    }
+    return shorty_len_;
+  }
+
+  // Counts the number of references in the parameter list of the corresponding method.
+  // Note: Thus does _not_ include "this" for non-static methods.
+  uint32_t GetNumberOfReferenceArgsWithoutReceiver() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    const char* shorty = GetShorty();
+    uint32_t refs = 0;
+    for (uint32_t i = 1; i < shorty_len_ ; ++i) {
+      if (shorty[i] == 'L') {
+        refs++;
+      }
+    }
+
+    return refs;
+  }
+
+  // May cause thread suspension due to GetClassFromTypeIdx calling ResolveType this caused a large
+  // number of bugs at call sites.
+  mirror::Class* GetReturnType(bool resolve = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    mirror::ArtMethod* method = GetMethod();
+    const DexFile* dex_file = method->GetDexFile();
+    const DexFile::MethodId& method_id = dex_file->GetMethodId(method->GetDexMethodIndex());
+    const DexFile::ProtoId& proto_id = dex_file->GetMethodPrototype(method_id);
+    uint16_t return_type_idx = proto_id.return_type_idx_;
+    return GetClassFromTypeIdx(return_type_idx, resolve);
+  }
+
+  size_t NumArgs() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    // "1 +" because the first in Args is the receiver.
+    // "- 1" because we don't count the return type.
+    return (method_->IsStatic() ? 0 : 1) + GetShortyLength() - 1;
+  }
+
+  // Get the primitive type associated with the given parameter.
+  Primitive::Type GetParamPrimitiveType(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    CHECK_LT(param, NumArgs());
+    if (GetMethod()->IsStatic()) {
+      param++;  // 0th argument must skip return value at start of the shorty
+    } else if (param == 0) {
+      return Primitive::kPrimNot;
+    }
+    return Primitive::GetType(GetShorty()[param]);
+  }
+
+  // Is the specified parameter a long or double, where parameter 0 is 'this' for instance methods.
+  bool IsParamALongOrDouble(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    Primitive::Type type = GetParamPrimitiveType(param);
+    return type == Primitive::kPrimLong || type == Primitive::kPrimDouble;
+  }
+
+  // Is the specified parameter a reference, where parameter 0 is 'this' for instance methods.
+  bool IsParamAReference(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    return GetParamPrimitiveType(param) == Primitive::kPrimNot;
+  }
+
+  bool HasSameNameAndSignature(MethodHelper* other) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  bool HasSameSignatureWithDifferentClassLoaders(MethodHelper* other)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    if (UNLIKELY(GetReturnType() != other->GetReturnType())) {
+      return false;
+    }
+    const DexFile::TypeList* types = method_->GetParameterTypeList();
+    const DexFile::TypeList* other_types = other->method_->GetParameterTypeList();
+    if (types == nullptr) {
+      return (other_types == nullptr) || (other_types->Size() == 0);
+    } else if (UNLIKELY(other_types == nullptr)) {
+      return types->Size() == 0;
+    }
+    uint32_t num_types = types->Size();
+    if (UNLIKELY(num_types != other_types->Size())) {
+      return false;
+    }
+    for (uint32_t i = 0; i < num_types; ++i) {
+      mirror::Class* param_type = GetClassFromTypeIdx(types->GetTypeItem(i).type_idx_);
+      mirror::Class* other_param_type =
+          other->GetClassFromTypeIdx(other_types->GetTypeItem(i).type_idx_);
+      if (UNLIKELY(param_type != other_param_type)) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  mirror::Class* GetClassFromTypeIdx(uint16_t type_idx, bool resolve = true)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  mirror::String* ResolveString(uint32_t string_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  uint32_t FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  // The name_and_signature_idx MUST point to a MethodId with the same name and signature in the
+  // other_dexfile, such as the method index used to resolve this method in the other_dexfile.
+  uint32_t FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile,
+                                            uint32_t name_and_signature_idx)
+      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+ private:
+  // Set the method_ field, for proxy methods looking up the interface method via the resolved
+  // methods table.
+  void SetMethod(mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+    method_.Assign(method);
+  }
+
+  Handle<mirror::ArtMethod> method_;
+  const char* shorty_;
+  uint32_t shorty_len_;
+
+  DISALLOW_COPY_AND_ASSIGN(MethodHelper);
+};
+
+}  // namespace art
+
+#endif  // ART_RUNTIME_METHOD_HELPER_H_
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index f7b5737..63f9860 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -25,7 +25,6 @@
 #include "object-inl.h"
 #include "object_array.h"
 #include "object_array-inl.h"
-#include "object_utils.h"
 #include "handle_scope-inl.h"
 #include "thread.h"
 #include "utils.h"
diff --git a/runtime/mirror/art_field-inl.h b/runtime/mirror/art_field-inl.h
index 90247ed..00bed92 100644
--- a/runtime/mirror/art_field-inl.h
+++ b/runtime/mirror/art_field-inl.h
@@ -20,10 +20,10 @@
 #include "art_field.h"
 
 #include "base/logging.h"
+#include "dex_cache.h"
 #include "gc/accounting/card_table-inl.h"
 #include "jvalue.h"
 #include "object-inl.h"
-#include "object_utils.h"
 #include "primitive.h"
 
 namespace art {
diff --git a/runtime/mirror/art_field.cc b/runtime/mirror/art_field.cc
index f2729f6..da21dfe 100644
--- a/runtime/mirror/art_field.cc
+++ b/runtime/mirror/art_field.cc
@@ -20,7 +20,6 @@
 #include "gc/accounting/card_table-inl.h"
 #include "object-inl.h"
 #include "object_array-inl.h"
-#include "object_utils.h"
 #include "runtime.h"
 #include "scoped_thread_state_change.h"
 #include "utils.h"
diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h
index a5b5df6..01b05a6 100644
--- a/runtime/mirror/art_method-inl.h
+++ b/runtime/mirror/art_method-inl.h
@@ -19,11 +19,13 @@
 
 #include "art_method.h"
 
+#include "class_linker.h"
+#include "dex_cache.h"
 #include "dex_file.h"
 #include "entrypoints/entrypoint_utils.h"
+#include "method_helper.h"
 #include "object-inl.h"
 #include "object_array.h"
-#include "object_utils.h"
 #include "oat.h"
 #include "quick/quick_method_frame_info.h"
 #include "read_barrier-inl.h"
diff --git a/runtime/mirror/art_method.cc b/runtime/mirror/art_method.cc
index 86bac24..167f848 100644
--- a/runtime/mirror/art_method.cc
+++ b/runtime/mirror/art_method.cc
@@ -27,12 +27,12 @@
 #include "interpreter/interpreter.h"
 #include "jni_internal.h"
 #include "mapping_table.h"
-#include "object-inl.h"
-#include "object_array.h"
+#include "method_helper.h"
 #include "object_array-inl.h"
+#include "object_array.h"
+#include "object-inl.h"
 #include "scoped_thread_state_change.h"
 #include "string.h"
-#include "object_utils.h"
 #include "well_known_classes.h"
 
 namespace art {
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index be05fb8..fadf80e 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -18,17 +18,16 @@
 
 #include "art_field-inl.h"
 #include "art_method-inl.h"
-#include "class-inl.h"
 #include "class_linker.h"
 #include "class_loader.h"
+#include "class-inl.h"
 #include "dex_cache.h"
 #include "dex_file-inl.h"
 #include "gc/accounting/card_table-inl.h"
-#include "object-inl.h"
-#include "object_array-inl.h"
-#include "object_utils.h"
-#include "runtime.h"
 #include "handle_scope-inl.h"
+#include "object_array-inl.h"
+#include "object-inl.h"
+#include "runtime.h"
 #include "thread.h"
 #include "throwable.h"
 #include "utils.h"
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc
index bc5cbcb..961bc64 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -24,13 +24,13 @@
 #include "class.h"
 #include "class-inl.h"
 #include "class_linker-inl.h"
+#include "field_helper.h"
 #include "gc/accounting/card_table-inl.h"
 #include "gc/heap.h"
 #include "iftable-inl.h"
 #include "monitor.h"
 #include "object-inl.h"
 #include "object_array-inl.h"
-#include "object_utils.h"
 #include "runtime.h"
 #include "handle_scope-inl.h"
 #include "throwable.h"
diff --git a/runtime/mirror/throwable.cc b/runtime/mirror/throwable.cc
index 6efc9e2..1c3f1ed 100644
--- a/runtime/mirror/throwable.cc
+++ b/runtime/mirror/throwable.cc
@@ -23,7 +23,6 @@
 #include "object-inl.h"
 #include "object_array.h"
 #include "object_array-inl.h"
-#include "object_utils.h"
 #include "stack_trace_element.h"
 #include "utils.h"
 #include "well_known_classes.h"
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index da481e4..4b26eda 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -28,7 +28,6 @@
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "scoped_thread_state_change.h"
 #include "thread.h"
 #include "thread_list.h"
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index f1a987f..b0b64aa 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -30,7 +30,6 @@
 #include "mirror/class-inl.h"
 #include "mirror/dex_cache-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "runtime.h"
 #include "scoped_fast_native_object_access.h"
 #include "scoped_thread_state_change.h"
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index cede1a0..e577c2c 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -21,7 +21,6 @@
 #include "mirror/class-inl.h"
 #include "mirror/class_loader.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "scoped_thread_state_change.h"
 #include "scoped_fast_native_object_access.h"
 #include "ScopedLocalRef.h"
diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc
index eae4584..f94e42b 100644
--- a/runtime/native/java_lang_reflect_Array.cc
+++ b/runtime/native/java_lang_reflect_Array.cc
@@ -20,7 +20,6 @@
 #include "jni_internal.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "scoped_fast_native_object_access.h"
 #include "handle_scope-inl.h"
 
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index 1981bfd..34cb93a 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -20,7 +20,6 @@
 #include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "reflection.h"
 #include "scoped_fast_native_object_access.h"
 #include "well_known_classes.h"
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 3564dfd..3903ffc 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -18,11 +18,11 @@
 #include "class_linker-inl.h"
 #include "common_throws.h"
 #include "dex_file-inl.h"
+#include "field_helper.h"
 #include "jni_internal.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
-#include "object_utils.h"
 #include "reflection.h"
 #include "scoped_fast_native_object_access.h"
 
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
index ac602ac..f029b16 100644
--- a/runtime/native/java_lang_reflect_Method.cc
+++ b/runtime/native/java_lang_reflect_Method.cc
@@ -21,7 +21,6 @@
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "reflection.h"
 #include "scoped_fast_native_object_access.h"
 #include "well_known_classes.h"
diff --git a/runtime/object_lock.cc b/runtime/object_lock.cc
new file mode 100644
index 0000000..f7accc0
--- /dev/null
+++ b/runtime/object_lock.cc
@@ -0,0 +1,53 @@
+/*
+ * 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 "object_lock.h"
+
+#include "mirror/object-inl.h"
+#include "monitor.h"
+
+namespace art {
+
+template <typename T>
+ObjectLock<T>::ObjectLock(Thread* self, Handle<T> object) : self_(self), obj_(object) {
+  CHECK(object.Get() != nullptr);
+  obj_->MonitorEnter(self_);
+}
+
+template <typename T>
+ObjectLock<T>::~ObjectLock() {
+  obj_->MonitorExit(self_);
+}
+
+template <typename T>
+void ObjectLock<T>::WaitIgnoringInterrupts() {
+  Monitor::Wait(self_, obj_.Get(), 0, 0, false, kWaiting);
+}
+
+template <typename T>
+void ObjectLock<T>::Notify() {
+  obj_->Notify(self_);
+}
+
+template <typename T>
+void ObjectLock<T>::NotifyAll() {
+  obj_->NotifyAll(self_);
+}
+
+template class ObjectLock<mirror::Class>;
+template class ObjectLock<mirror::Object>;
+
+}  // namespace art
diff --git a/runtime/object_lock.h b/runtime/object_lock.h
new file mode 100644
index 0000000..acddc03
--- /dev/null
+++ b/runtime/object_lock.h
@@ -0,0 +1,50 @@
+/*
+ * 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_OBJECT_LOCK_H_
+#define ART_RUNTIME_OBJECT_LOCK_H_
+
+#include "base/macros.h"
+#include "base/mutex.h"
+#include "handle.h"
+
+namespace art {
+
+class Thread;
+
+template <typename T>
+class ObjectLock {
+ public:
+  ObjectLock(Thread* self, Handle<T> object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  ~ObjectLock() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  void WaitIgnoringInterrupts() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  void Notify() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+  void NotifyAll() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
+ private:
+  Thread* const self_;
+  Handle<T> const obj_;
+
+  DISALLOW_COPY_AND_ASSIGN(ObjectLock);
+};
+
+}  // namespace art
+
+#endif  // ART_RUNTIME_OBJECT_LOCK_H_
diff --git a/runtime/object_utils.h b/runtime/object_utils.h
deleted file mode 100644
index 4379b4a..0000000
--- a/runtime/object_utils.h
+++ /dev/null
@@ -1,379 +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_OBJECT_UTILS_H_
-#define ART_RUNTIME_OBJECT_UTILS_H_
-
-#include "class_linker.h"
-#include "dex_file.h"
-#include "monitor.h"
-#include "mirror/art_field.h"
-#include "mirror/art_method.h"
-#include "mirror/class.h"
-#include "mirror/dex_cache.h"
-#include "mirror/iftable.h"
-#include "mirror/string.h"
-
-#include "runtime.h"
-#include "handle_scope-inl.h"
-
-#include <string>
-
-namespace art {
-
-template <typename T>
-class ObjectLock {
- public:
-  ObjectLock(Thread* self, Handle<T> object) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-      : self_(self), obj_(object) {
-    CHECK(object.Get() != nullptr);
-    obj_->MonitorEnter(self_);
-  }
-
-  ~ObjectLock() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    obj_->MonitorExit(self_);
-  }
-
-  void WaitIgnoringInterrupts() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    Monitor::Wait(self_, obj_.Get(), 0, 0, false, kWaiting);
-  }
-
-  void Notify() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    obj_->Notify(self_);
-  }
-
-  void NotifyAll() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    obj_->NotifyAll(self_);
-  }
-
- private:
-  Thread* const self_;
-  Handle<T> const obj_;
-  DISALLOW_COPY_AND_ASSIGN(ObjectLock);
-};
-
-class FieldHelper {
- public:
-  explicit FieldHelper(Handle<mirror::ArtField> f) : field_(f) {}
-
-  void ChangeField(mirror::ArtField* new_f) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    DCHECK(new_f != nullptr);
-    field_.Assign(new_f);
-  }
-
-  mirror::ArtField* GetField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    return field_.Get();
-  }
-
-  mirror::Class* GetType(bool resolve = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    uint32_t field_index = field_->GetDexFieldIndex();
-    if (UNLIKELY(field_->GetDeclaringClass()->IsProxyClass())) {
-      return Runtime::Current()->GetClassLinker()->FindSystemClass(Thread::Current(),
-                                                                   field_->GetTypeDescriptor());
-    }
-    const DexFile* dex_file = field_->GetDexFile();
-    const DexFile::FieldId& field_id = dex_file->GetFieldId(field_index);
-    mirror::Class* type = field_->GetDexCache()->GetResolvedType(field_id.type_idx_);
-    if (resolve && (type == nullptr)) {
-      type = Runtime::Current()->GetClassLinker()->ResolveType(field_id.type_idx_, field_.Get());
-      CHECK(type != nullptr || Thread::Current()->IsExceptionPending());
-    }
-    return type;
-  }
-
-  // The returned const char* is only guaranteed to be valid for the lifetime of the FieldHelper.
-  // If you need it longer, copy it into a std::string.
-  const char* GetDeclaringClassDescriptor()
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    uint32_t field_index = field_->GetDexFieldIndex();
-    if (UNLIKELY(field_->GetDeclaringClass()->IsProxyClass())) {
-      DCHECK(field_->IsStatic());
-      DCHECK_LT(field_index, 2U);
-      // 0 == Class[] interfaces; 1 == Class[][] throws;
-      declaring_class_descriptor_ = field_->GetDeclaringClass()->GetDescriptor();
-      return declaring_class_descriptor_.c_str();
-    }
-    const DexFile* dex_file = field_->GetDexFile();
-    const DexFile::FieldId& field_id = dex_file->GetFieldId(field_index);
-    return dex_file->GetFieldDeclaringClassDescriptor(field_id);
-  }
-
- private:
-  Handle<mirror::ArtField> field_;
-  std::string declaring_class_descriptor_;
-
-  DISALLOW_COPY_AND_ASSIGN(FieldHelper);
-};
-
-class MethodHelper {
- public:
-  explicit MethodHelper(Handle<mirror::ArtMethod> m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
-      : method_(m), shorty_(nullptr), shorty_len_(0) {
-    SetMethod(m.Get());
-  }
-
-  void ChangeMethod(mirror::ArtMethod* new_m) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    DCHECK(new_m != nullptr);
-    SetMethod(new_m);
-    shorty_ = nullptr;
-  }
-
-  mirror::ArtMethod* GetMethod() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    return method_->GetInterfaceMethodIfProxy();
-  }
-
-  mirror::String* GetNameAsString(Thread* self) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    const DexFile* dex_file = method_->GetDexFile();
-    mirror::ArtMethod* method = method_->GetInterfaceMethodIfProxy();
-    uint32_t dex_method_idx = method->GetDexMethodIndex();
-    const DexFile::MethodId& method_id = dex_file->GetMethodId(dex_method_idx);
-    StackHandleScope<1> hs(self);
-    Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache()));
-    return Runtime::Current()->GetClassLinker()->ResolveString(*dex_file, method_id.name_idx_,
-                                                               dex_cache);
-  }
-
-  const char* GetShorty() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    const char* result = shorty_;
-    if (result == nullptr) {
-      result = method_->GetShorty(&shorty_len_);
-      shorty_ = result;
-    }
-    return result;
-  }
-
-  uint32_t GetShortyLength() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    if (shorty_ == nullptr) {
-      GetShorty();
-    }
-    return shorty_len_;
-  }
-
-  // Counts the number of references in the parameter list of the corresponding method.
-  // Note: Thus does _not_ include "this" for non-static methods.
-  uint32_t GetNumberOfReferenceArgsWithoutReceiver() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    const char* shorty = GetShorty();
-    uint32_t refs = 0;
-    for (uint32_t i = 1; i < shorty_len_ ; ++i) {
-      if (shorty[i] == 'L') {
-        refs++;
-      }
-    }
-
-    return refs;
-  }
-
-  // May cause thread suspension due to GetClassFromTypeIdx calling ResolveType this caused a large
-  // number of bugs at call sites.
-  mirror::Class* GetReturnType(bool resolve = true) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    mirror::ArtMethod* method = GetMethod();
-    const DexFile* dex_file = method->GetDexFile();
-    const DexFile::MethodId& method_id = dex_file->GetMethodId(method->GetDexMethodIndex());
-    const DexFile::ProtoId& proto_id = dex_file->GetMethodPrototype(method_id);
-    uint16_t return_type_idx = proto_id.return_type_idx_;
-    return GetClassFromTypeIdx(return_type_idx, resolve);
-  }
-
-  size_t NumArgs() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    // "1 +" because the first in Args is the receiver.
-    // "- 1" because we don't count the return type.
-    return (method_->IsStatic() ? 0 : 1) + GetShortyLength() - 1;
-  }
-
-  // Get the primitive type associated with the given parameter.
-  Primitive::Type GetParamPrimitiveType(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    CHECK_LT(param, NumArgs());
-    if (GetMethod()->IsStatic()) {
-      param++;  // 0th argument must skip return value at start of the shorty
-    } else if (param == 0) {
-      return Primitive::kPrimNot;
-    }
-    return Primitive::GetType(GetShorty()[param]);
-  }
-
-  // Is the specified parameter a long or double, where parameter 0 is 'this' for instance methods.
-  bool IsParamALongOrDouble(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    Primitive::Type type = GetParamPrimitiveType(param);
-    return type == Primitive::kPrimLong || type == Primitive::kPrimDouble;
-  }
-
-  // Is the specified parameter a reference, where parameter 0 is 'this' for instance methods.
-  bool IsParamAReference(size_t param) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    return GetParamPrimitiveType(param) == Primitive::kPrimNot;
-  }
-
-  bool HasSameNameAndSignature(MethodHelper* other) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    const DexFile* dex_file = method_->GetDexFile();
-    const DexFile::MethodId& mid = dex_file->GetMethodId(GetMethod()->GetDexMethodIndex());
-    if (method_->GetDexCache() == other->method_->GetDexCache()) {
-      const DexFile::MethodId& other_mid =
-          dex_file->GetMethodId(other->GetMethod()->GetDexMethodIndex());
-      return mid.name_idx_ == other_mid.name_idx_ && mid.proto_idx_ == other_mid.proto_idx_;
-    }
-    const DexFile* other_dex_file = other->method_->GetDexFile();
-    const DexFile::MethodId& other_mid =
-        other_dex_file->GetMethodId(other->GetMethod()->GetDexMethodIndex());
-    if (!DexFileStringEquals(dex_file, mid.name_idx_, other_dex_file, other_mid.name_idx_)) {
-      return false;  // Name mismatch.
-    }
-    return dex_file->GetMethodSignature(mid) == other_dex_file->GetMethodSignature(other_mid);
-  }
-
-  bool HasSameSignatureWithDifferentClassLoaders(MethodHelper* other)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    if (UNLIKELY(GetReturnType() != other->GetReturnType())) {
-      return false;
-    }
-    const DexFile::TypeList* types = method_->GetParameterTypeList();
-    const DexFile::TypeList* other_types = other->method_->GetParameterTypeList();
-    if (types == nullptr) {
-      return (other_types == nullptr) || (other_types->Size() == 0);
-    } else if (UNLIKELY(other_types == nullptr)) {
-      return types->Size() == 0;
-    }
-    uint32_t num_types = types->Size();
-    if (UNLIKELY(num_types != other_types->Size())) {
-      return false;
-    }
-    for (uint32_t i = 0; i < num_types; ++i) {
-      mirror::Class* param_type = GetClassFromTypeIdx(types->GetTypeItem(i).type_idx_);
-      mirror::Class* other_param_type =
-          other->GetClassFromTypeIdx(other_types->GetTypeItem(i).type_idx_);
-      if (UNLIKELY(param_type != other_param_type)) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  mirror::Class* GetClassFromTypeIdx(uint16_t type_idx, bool resolve = true)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    mirror::ArtMethod* method = GetMethod();
-    mirror::Class* type = method->GetDexCacheResolvedTypes()->Get(type_idx);
-    if (type == nullptr && resolve) {
-      type = Runtime::Current()->GetClassLinker()->ResolveType(type_idx, method);
-      CHECK(type != nullptr || Thread::Current()->IsExceptionPending());
-    }
-    return type;
-  }
-
-  mirror::Class* GetDexCacheResolvedType(uint16_t type_idx)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    return GetMethod()->GetDexCacheResolvedTypes()->Get(type_idx);
-  }
-
-  mirror::String* ResolveString(uint32_t string_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    mirror::ArtMethod* method = GetMethod();
-    mirror::String* s = method->GetDexCacheStrings()->Get(string_idx);
-    if (UNLIKELY(s == nullptr)) {
-      StackHandleScope<1> hs(Thread::Current());
-      Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache()));
-      s = Runtime::Current()->GetClassLinker()->ResolveString(*method->GetDexFile(), string_idx,
-                                                              dex_cache);
-    }
-    return s;
-  }
-
-  uint32_t FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    mirror::ArtMethod* method = GetMethod();
-    const DexFile* dexfile = method->GetDexFile();
-    if (dexfile == &other_dexfile) {
-      return method->GetDexMethodIndex();
-    }
-    const DexFile::MethodId& mid = dexfile->GetMethodId(method->GetDexMethodIndex());
-    const char* mid_declaring_class_descriptor = dexfile->StringByTypeIdx(mid.class_idx_);
-    const DexFile::StringId* other_descriptor =
-        other_dexfile.FindStringId(mid_declaring_class_descriptor);
-    if (other_descriptor != nullptr) {
-      const DexFile::TypeId* other_type_id =
-          other_dexfile.FindTypeId(other_dexfile.GetIndexForStringId(*other_descriptor));
-      if (other_type_id != nullptr) {
-        const char* mid_name = dexfile->GetMethodName(mid);
-        const DexFile::StringId* other_name = other_dexfile.FindStringId(mid_name);
-        if (other_name != nullptr) {
-          uint16_t other_return_type_idx;
-          std::vector<uint16_t> other_param_type_idxs;
-          bool success = other_dexfile.CreateTypeList(
-              dexfile->GetMethodSignature(mid).ToString(), &other_return_type_idx,
-              &other_param_type_idxs);
-          if (success) {
-            const DexFile::ProtoId* other_sig =
-                other_dexfile.FindProtoId(other_return_type_idx, other_param_type_idxs);
-            if (other_sig != nullptr) {
-              const  DexFile::MethodId* other_mid = other_dexfile.FindMethodId(
-                  *other_type_id, *other_name, *other_sig);
-              if (other_mid != nullptr) {
-                return other_dexfile.GetIndexForMethodId(*other_mid);
-              }
-            }
-          }
-        }
-      }
-    }
-    return DexFile::kDexNoIndex;
-  }
-
-  // The name_and_signature_idx MUST point to a MethodId with the same name and signature in the
-  // other_dexfile, such as the method index used to resolve this method in the other_dexfile.
-  uint32_t FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile,
-                                            uint32_t name_and_signature_idx)
-      SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    mirror::ArtMethod* method = GetMethod();
-    const DexFile* dexfile = method->GetDexFile();
-    const uint32_t dex_method_idx = method->GetDexMethodIndex();
-    const DexFile::MethodId& mid = dexfile->GetMethodId(dex_method_idx);
-    const DexFile::MethodId& name_and_sig_mid = other_dexfile.GetMethodId(name_and_signature_idx);
-    DCHECK_STREQ(dexfile->GetMethodName(mid), other_dexfile.GetMethodName(name_and_sig_mid));
-    DCHECK_EQ(dexfile->GetMethodSignature(mid), other_dexfile.GetMethodSignature(name_and_sig_mid));
-    if (dexfile == &other_dexfile) {
-      return dex_method_idx;
-    }
-    const char* mid_declaring_class_descriptor = dexfile->StringByTypeIdx(mid.class_idx_);
-    const DexFile::StringId* other_descriptor =
-        other_dexfile.FindStringId(mid_declaring_class_descriptor);
-    if (other_descriptor != nullptr) {
-      const DexFile::TypeId* other_type_id =
-          other_dexfile.FindTypeId(other_dexfile.GetIndexForStringId(*other_descriptor));
-      if (other_type_id != nullptr) {
-        const DexFile::MethodId* other_mid = other_dexfile.FindMethodId(
-            *other_type_id, other_dexfile.GetStringId(name_and_sig_mid.name_idx_),
-            other_dexfile.GetProtoId(name_and_sig_mid.proto_idx_));
-        if (other_mid != nullptr) {
-          return other_dexfile.GetIndexForMethodId(*other_mid);
-        }
-      }
-    }
-    return DexFile::kDexNoIndex;
-  }
-
- private:
-  // Set the method_ field, for proxy methods looking up the interface method via the resolved
-  // methods table.
-  void SetMethod(mirror::ArtMethod* method) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
-    method_.Assign(method);
-  }
-
-  Handle<mirror::ArtMethod> method_;
-  const char* shorty_;
-  uint32_t shorty_len_;
-
-  DISALLOW_COPY_AND_ASSIGN(MethodHelper);
-};
-
-}  // namespace art
-
-#endif  // ART_RUNTIME_OBJECT_UTILS_H_
diff --git a/runtime/profiler.cc b/runtime/profiler.cc
index 7a7a92a..9514448 100644
--- a/runtime/profiler.cc
+++ b/runtime/profiler.cc
@@ -32,7 +32,6 @@
 #include "mirror/dex_cache.h"
 #include "mirror/object_array-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "os.h"
 #include "scoped_thread_state_change.h"
 #include "ScopedLocalRef.h"
diff --git a/runtime/proxy_test.cc b/runtime/proxy_test.cc
index 57eb3f7..bd6656d 100644
--- a/runtime/proxy_test.cc
+++ b/runtime/proxy_test.cc
@@ -18,6 +18,7 @@
 #include <vector>
 
 #include "common_compiler_test.h"
+#include "field_helper.h"
 #include "mirror/art_field-inl.h"
 #include "scoped_thread_state_change.h"
 
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index 41421bc..0af4117 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -20,14 +20,14 @@
 #include "common_throws.h"
 #include "dex_file-inl.h"
 #include "jni_internal.h"
+#include "method_helper.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method-inl.h"
-#include "mirror/class.h"
 #include "mirror/class-inl.h"
-#include "mirror/object_array.h"
+#include "mirror/class.h"
 #include "mirror/object_array-inl.h"
+#include "mirror/object_array.h"
 #include "nth_caller_visitor.h"
-#include "object_utils.h"
 #include "scoped_thread_state_change.h"
 #include "stack.h"
 #include "well_known_classes.h"
diff --git a/runtime/stack.cc b/runtime/stack.cc
index a6cf24e..71e566e 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -23,7 +23,6 @@
 #include "mirror/object.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "quick/quick_method_frame_info.h"
 #include "runtime.h"
 #include "thread.h"
diff --git a/runtime/thread.cc b/runtime/thread.cc
index dcd4f23..9fa158d 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -32,8 +32,8 @@
 
 #include "arch/context.h"
 #include "base/mutex.h"
-#include "class_linker.h"
 #include "class_linker-inl.h"
+#include "class_linker.h"
 #include "debugger.h"
 #include "dex_file-inl.h"
 #include "entrypoints/entrypoint_utils.h"
@@ -43,17 +43,18 @@
 #include "gc/allocator/rosalloc.h"
 #include "gc/heap.h"
 #include "gc/space/space.h"
+#include "handle_scope-inl.h"
 #include "handle_scope.h"
 #include "indirect_reference_table-inl.h"
 #include "jni_internal.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/class-inl.h"
 #include "mirror/object_array-inl.h"
 #include "mirror/stack_trace_element.h"
 #include "monitor.h"
-#include "object_utils.h"
+#include "object_lock.h"
 #include "quick_exception_handler.h"
 #include "quick/quick_method_frame_info.h"
 #include "reflection.h"
@@ -61,10 +62,9 @@
 #include "scoped_thread_state_change.h"
 #include "ScopedLocalRef.h"
 #include "ScopedUtfChars.h"
-#include "handle_scope-inl.h"
 #include "stack.h"
-#include "thread-inl.h"
 #include "thread_list.h"
+#include "thread-inl.h"
 #include "utils.h"
 #include "verifier/dex_gc_map.h"
 #include "verify_object-inl.h"
diff --git a/runtime/throw_location.cc b/runtime/throw_location.cc
index a1347a4..04abe64 100644
--- a/runtime/throw_location.cc
+++ b/runtime/throw_location.cc
@@ -19,7 +19,6 @@
 #include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "utils.h"
 
 namespace art {
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 1eb5cf8..f51b8c4 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -30,7 +30,6 @@
 #include "mirror/dex_cache.h"
 #include "mirror/object_array-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 #include "os.h"
 #include "scoped_thread_state_change.h"
 #include "ScopedLocalRef.h"
diff --git a/runtime/utils.cc b/runtime/utils.cc
index b56bdd0..8b1ad39 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -28,6 +28,7 @@
 #include "base/stl_util.h"
 #include "base/unix_file/fd_file.h"
 #include "dex_file-inl.h"
+#include "field_helper.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/class-inl.h"
@@ -35,7 +36,6 @@
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
 #include "mirror/string.h"
-#include "object_utils.h"
 #include "os.h"
 #include "scoped_thread_state_change.h"
 #include "utf-inl.h"
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index eabb993..a1b86e0 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -25,10 +25,12 @@
 #include "dex_file-inl.h"
 #include "dex_instruction-inl.h"
 #include "dex_instruction_visitor.h"
+#include "field_helper.h"
 #include "gc/accounting/card_table-inl.h"
 #include "indenter.h"
 #include "intern_table.h"
 #include "leb128.h"
+#include "method_helper.h"
 #include "mirror/art_field-inl.h"
 #include "mirror/art_method-inl.h"
 #include "mirror/class.h"
@@ -36,7 +38,6 @@
 #include "mirror/dex_cache-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "register_line-inl.h"
 #include "runtime.h"
 #include "scoped_thread_state_change.h"
diff --git a/runtime/verifier/reg_type.cc b/runtime/verifier/reg_type.cc
index e24c920..f0729e4 100644
--- a/runtime/verifier/reg_type.cc
+++ b/runtime/verifier/reg_type.cc
@@ -24,7 +24,6 @@
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
 #include "mirror/object_array-inl.h"
-#include "object_utils.h"
 #include "reg_type_cache-inl.h"
 #include "scoped_thread_state_change.h"
 
diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc
index ff9edbb..91fba4d 100644
--- a/runtime/verifier/reg_type_cache.cc
+++ b/runtime/verifier/reg_type_cache.cc
@@ -21,7 +21,6 @@
 #include "dex_file-inl.h"
 #include "mirror/class-inl.h"
 #include "mirror/object-inl.h"
-#include "object_utils.h"
 
 namespace art {
 namespace verifier {
diff --git a/runtime/verify_object.h b/runtime/verify_object.h
index 6640e0d..8e1653d 100644
--- a/runtime/verify_object.h
+++ b/runtime/verify_object.h
@@ -52,10 +52,10 @@
 static constexpr VerifyObjectMode kVerifyObjectSupport =
     kDefaultVerifyFlags != 0 ? kVerifyObjectModeFast : kVerifyObjectModeDisabled;
 
-void VerifyObject(mirror::Object* obj) ALWAYS_INLINE NO_THREAD_SAFETY_ANALYSIS;
+ALWAYS_INLINE void VerifyObject(mirror::Object* obj) NO_THREAD_SAFETY_ANALYSIS;
 
 // Check that c.getClass() == c.getClass().getClass().
-bool VerifyClassClass(mirror::Class* c) ALWAYS_INLINE NO_THREAD_SAFETY_ANALYSIS;
+ALWAYS_INLINE bool VerifyClassClass(mirror::Class* c) NO_THREAD_SAFETY_ANALYSIS;
 
 }  // namespace art
 
diff --git a/sigchainlib/sigchain.h b/sigchainlib/sigchain.h
index f6f2253..a4ce81c 100644
--- a/sigchainlib/sigchain.h
+++ b/sigchainlib/sigchain.h
@@ -18,10 +18,13 @@
 #define ART_SIGCHAINLIB_SIGCHAIN_H_
 
 #include <signal.h>
+
 namespace art {
 
 void ClaimSignalChain(int signal, struct sigaction* oldaction);
+
 void UnclaimSignalChain(int signal);
+
 void InvokeUserSignalHandler(int sig, siginfo_t* info, void* context);
 
 }   // namespace art
diff --git a/test/ReferenceMap/stack_walk_refmap_jni.cc b/test/ReferenceMap/stack_walk_refmap_jni.cc
index 87187ed..e5a1786 100644
--- a/test/ReferenceMap/stack_walk_refmap_jni.cc
+++ b/test/ReferenceMap/stack_walk_refmap_jni.cc
@@ -20,12 +20,10 @@
 #include "class_linker.h"
 #include "dex_file-inl.h"
 #include "gc_map.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"
-#include "object_utils.h"
 #include "scoped_thread_state_change.h"
 #include "thread.h"
 #include "jni.h"
diff --git a/test/StackWalk/stack_walk_jni.cc b/test/StackWalk/stack_walk_jni.cc
index c849c54..e404f6a 100644
--- a/test/StackWalk/stack_walk_jni.cc
+++ b/test/StackWalk/stack_walk_jni.cc
@@ -19,12 +19,10 @@
 
 #include "class_linker.h"
 #include "gc_map.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"
-#include "object_utils.h"
 #include "jni.h"
 #include "scoped_thread_state_change.h"