summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdexfile/dex/class_accessor-inl.h11
-rw-r--r--libdexfile/dex/class_accessor.h21
-rw-r--r--runtime/art_field-inl.h1
-rw-r--r--runtime/art_method-inl.h1
-rw-r--r--runtime/class_linker.h1
-rw-r--r--runtime/interpreter/shadow_frame.h1
-rw-r--r--runtime/mirror/class-inl.h1
-rw-r--r--runtime/mirror/class.h8
-rw-r--r--runtime/thread.cc1
-rw-r--r--runtime/thread.h5
-rw-r--r--runtime/thread_list.cc30
-rw-r--r--test/911-get-stack-trace/expected.txt8
-rw-r--r--test/knownfailures.json6
13 files changed, 68 insertions, 27 deletions
diff --git a/libdexfile/dex/class_accessor-inl.h b/libdexfile/dex/class_accessor-inl.h
index c9e5360f31..8562d0583c 100644
--- a/libdexfile/dex/class_accessor-inl.h
+++ b/libdexfile/dex/class_accessor-inl.h
@@ -24,6 +24,8 @@
#include "base/utils.h"
#include "class_iterator.h"
#include "code_item_accessors-inl.h"
+#include "dex_file.h"
+#include "method_reference.h"
namespace art {
@@ -71,6 +73,11 @@ inline void ClassAccessor::Method::Read() {
}
}
+inline MethodReference ClassAccessor::Method::GetReference() const {
+ return MethodReference(&dex_file_, GetIndex());
+}
+
+
inline void ClassAccessor::Field::Read() {
index_ += DecodeUnsignedLeb128(&ptr_pos_);
access_flags_ = DecodeUnsignedLeb128(&ptr_pos_);
@@ -231,6 +238,10 @@ inline dex::TypeIndex ClassAccessor::GetClassIdx() const {
return dex_file_.GetClassDef(class_def_index_).class_idx_;
}
+inline const dex::ClassDef& ClassAccessor::GetClassDef() const {
+ return dex_file_.GetClassDef(GetClassDefIndex());
+}
+
} // namespace art
#endif // ART_LIBDEXFILE_DEX_CLASS_ACCESSOR_INL_H_
diff --git a/libdexfile/dex/class_accessor.h b/libdexfile/dex/class_accessor.h
index cf6e5095d6..16282562cc 100644
--- a/libdexfile/dex/class_accessor.h
+++ b/libdexfile/dex/class_accessor.h
@@ -18,14 +18,21 @@
#define ART_LIBDEXFILE_DEX_CLASS_ACCESSOR_H_
#include "code_item_accessors.h"
-#include "dex_file.h"
+#include "dex_file_types.h"
#include "invoke_type.h"
-#include "method_reference.h"
#include "modifiers.h"
namespace art {
+namespace dex {
+struct ClassDef;
+struct CodeItem;
+} // namespace dex
+
class ClassIteratorData;
+class DexFile;
+template <typename Iter> class IterationRange;
+class MethodReference;
// Classes to access Dex data.
class ClassAccessor {
@@ -92,9 +99,7 @@ class ClassAccessor {
: GetVirtualMethodInvokeType(class_access_flags);
}
- MethodReference GetReference() const {
- return MethodReference(&dex_file_, GetIndex());
- }
+ MethodReference GetReference() const;
CodeItemInstructionAccessor GetInstructions() const;
CodeItemDataAccessor GetInstructionsAndData() const;
@@ -273,7 +278,7 @@ class ClassAccessor {
ClassAccessor(const DexFile& dex_file,
const uint8_t* class_data,
- uint32_t class_def_index = DexFile::kDexNoIndex32,
+ uint32_t class_def_index = dex::kDexNoIndex,
bool parse_hiddenapi_class_data = false);
// Return the code item for a method.
@@ -361,9 +366,7 @@ class ClassAccessor {
return class_def_index_;
}
- const dex::ClassDef& GetClassDef() const {
- return dex_file_.GetClassDef(GetClassDefIndex());
- }
+ const dex::ClassDef& GetClassDef() const;
protected:
// Template visitor to reduce copy paste for visiting elements.
diff --git a/runtime/art_field-inl.h b/runtime/art_field-inl.h
index fb4141886a..6f976d1c16 100644
--- a/runtime/art_field-inl.h
+++ b/runtime/art_field-inl.h
@@ -29,7 +29,6 @@
#include "jvalue.h"
#include "mirror/dex_cache-inl.h"
#include "mirror/object-inl.h"
-#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
namespace art {
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index 02196baebd..e28ffa2122 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -43,7 +43,6 @@
#include "quick/quick_method_frame_info.h"
#include "read_barrier-inl.h"
#include "runtime-inl.h"
-#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
namespace art {
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index fa5df441c7..b9ac9caf0c 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -40,6 +40,7 @@ namespace art {
namespace dex {
struct ClassDef;
+struct MethodHandleItem;
} // namespace dex
namespace gc {
diff --git a/runtime/interpreter/shadow_frame.h b/runtime/interpreter/shadow_frame.h
index ca98999acd..3f6b729644 100644
--- a/runtime/interpreter/shadow_frame.h
+++ b/runtime/interpreter/shadow_frame.h
@@ -23,7 +23,6 @@
#include "base/locks.h"
#include "base/macros.h"
-#include "dex/dex_file.h"
#include "lock_count_data.h"
#include "read_barrier.h"
#include "stack_reference.h"
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 0f19bac526..40c7d30707 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -32,6 +32,7 @@
#include "dex/invoke_type.h"
#include "dex_cache.h"
#include "iftable.h"
+#include "imtable.h"
#include "object-inl.h"
#include "object_array.h"
#include "read_barrier-inl.h"
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 5682def4c4..f7a41f7f56 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -23,12 +23,10 @@
#include "base/stride_iterator.h"
#include "class_flags.h"
#include "class_status.h"
-#include "dex/dex_file_structs.h"
#include "dex/dex_file_types.h"
#include "dex/modifiers.h"
#include "dex/primitive.h"
#include "gc/allocator_type.h"
-#include "imtable.h"
#include "object.h"
#include "object_array.h"
#include "read_barrier_option.h"
@@ -36,11 +34,17 @@
namespace art {
+namespace dex {
+struct ClassDef;
+class TypeList;
+} // namespace dex
+
class ArtField;
class ArtMethod;
struct ClassOffsets;
class DexFile;
template<class T> class Handle;
+class ImTable;
enum InvokeType : uint32_t;
template <typename Iter> class IterationRange;
template<typename T> class LengthPrefixedArray;
diff --git a/runtime/thread.cc b/runtime/thread.cc
index f459f9c8fb..7c050a4e4d 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -73,6 +73,7 @@
#include "gc_root.h"
#include "handle_scope-inl.h"
#include "indirect_reference_table-inl.h"
+#include "instrumentation.h"
#include "interpreter/interpreter.h"
#include "interpreter/mterp/mterp.h"
#include "interpreter/shadow_frame-inl.h"
diff --git a/runtime/thread.h b/runtime/thread.h
index 6db1943bac..ad69ecfacc 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -36,7 +36,6 @@
#include "entrypoints/jni/jni_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "handle_scope.h"
-#include "instrumentation.h"
#include "interpreter/interpreter_cache.h"
#include "jvalue.h"
#include "managed_stack.h"
@@ -59,6 +58,10 @@ class SemiSpace;
} // namespace collector
} // namespace gc
+namespace instrumentation {
+struct InstrumentationStackFrame;
+} // namespace instrumentation
+
namespace mirror {
class Array;
class Class;
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 4bbd81a70d..75462ac147 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -766,15 +766,29 @@ void ThreadList::SuspendAllInternal(Thread* self,
#if ART_USE_FUTEXES
if (futex(pending_threads.Address(), FUTEX_WAIT_PRIVATE, cur_val, &wait_timeout, nullptr, 0)
!= 0) {
- // EAGAIN and EINTR both indicate a spurious failure, try again from the beginning.
- if ((errno != EAGAIN) && (errno != EINTR)) {
- if (errno == ETIMEDOUT) {
- LOG(kIsDebugBuild ? ::android::base::FATAL : ::android::base::ERROR)
- << "Timed out waiting for threads to suspend, waited for "
- << PrettyDuration(NanoTime() - start_time);
- } else {
- PLOG(FATAL) << "futex wait failed for SuspendAllInternal()";
+ if ((errno == EAGAIN) || (errno == EINTR)) {
+ // EAGAIN and EINTR both indicate a spurious failure, try again from the beginning.
+ continue;
+ }
+ if (errno == ETIMEDOUT) {
+ const uint64_t wait_time = NanoTime() - start_time;
+ MutexLock mu(self, *Locks::thread_list_lock_);
+ MutexLock mu2(self, *Locks::thread_suspend_count_lock_);
+ std::ostringstream oss;
+ for (const auto& thread : list_) {
+ if (thread == ignore1 || thread == ignore2) {
+ continue;
+ }
+ if (!thread->IsSuspended()) {
+ oss << std::endl << "Thread not suspended: " << *thread;
+ }
}
+ LOG(kIsDebugBuild ? ::android::base::FATAL : ::android::base::ERROR)
+ << "Timed out waiting for threads to suspend, waited for "
+ << PrettyDuration(wait_time)
+ << oss.str();
+ } else {
+ PLOG(FATAL) << "futex wait failed for SuspendAllInternal()";
}
} // else re-check pending_threads in the next iteration (this may be a spurious wake-up).
#else
diff --git a/test/911-get-stack-trace/expected.txt b/test/911-get-stack-trace/expected.txt
index 8dd49aaa9b..31794243da 100644
--- a/test/911-get-stack-trace/expected.txt
+++ b/test/911-get-stack-trace/expected.txt
@@ -388,7 +388,7 @@ Signal Catcher
Test911
getAllStackTraces (I)[[Ljava/lang/Object; -1 -2
printAll (I)V 0 75
- doTest ()V 118 59
+ doTest ()V 120 59
run ()V 24 37
---------
@@ -643,7 +643,7 @@ Signal Catcher
Test911
getAllStackTraces (I)[[Ljava/lang/Object; -1 -2
printAll (I)V 0 75
- doTest ()V 123 61
+ doTest ()V 125 61
run ()V 24 37
---------
@@ -675,7 +675,7 @@ ThreadListTraces Thread 8
Test911
getThreadListStackTraces ([Ljava/lang/Thread;I)[[Ljava/lang/Object; -1 -2
printList ([Ljava/lang/Thread;I)V 0 68
- doTest ()V 108 54
+ doTest ()V 110 54
run ()V 32 41
---------
@@ -732,7 +732,7 @@ ThreadListTraces Thread 8
Test911
getThreadListStackTraces ([Ljava/lang/Thread;I)[[Ljava/lang/Object; -1 -2
printList ([Ljava/lang/Thread;I)V 0 68
- doTest ()V 113 56
+ doTest ()V 115 56
run ()V 32 41
---------
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 879f2fd79d..983c16a051 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -6,6 +6,12 @@
"bug": "http://b/33389022"
},
{
+ "tests": "132-daemon-locks-shutdown",
+ "description": ["This test seems to fail occasionally on redefine-stress for unknown reasons without stack-traces"],
+ "variant": "redefine-stress",
+ "bug": "http://b/121302864"
+ },
+ {
"tests": "579-inline-infinite",
"description": ["This test seems to fail often on redefine-stress for unknown reasons"],
"variant": "redefine-stress",