summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp1
-rw-r--r--build/Android.cpplint.mk2
-rw-r--r--imgdiag/imgdiag.cc22
-rw-r--r--openjdkjvmti/Android.bp (renamed from runtime/openjdkjvmti/Android.bp)1
-rw-r--r--openjdkjvmti/MODULE_LICENSE_GPL_WITH_CLASSPATH_EXCEPTION (renamed from runtime/openjdkjvmti/MODULE_LICENSE_GPL_WITH_CLASSPATH_EXCEPTION)0
-rw-r--r--openjdkjvmti/NOTICE (renamed from runtime/openjdkjvmti/NOTICE)0
-rw-r--r--openjdkjvmti/OpenjdkJvmTi.cc (renamed from runtime/openjdkjvmti/OpenjdkJvmTi.cc)0
-rw-r--r--openjdkjvmti/README.md (renamed from runtime/openjdkjvmti/README.md)0
-rw-r--r--openjdkjvmti/art_jvmti.h (renamed from runtime/openjdkjvmti/art_jvmti.h)8
-rw-r--r--openjdkjvmti/events-inl.h (renamed from runtime/openjdkjvmti/events-inl.h)6
-rw-r--r--openjdkjvmti/events.cc (renamed from runtime/openjdkjvmti/events.cc)0
-rw-r--r--openjdkjvmti/events.h (renamed from runtime/openjdkjvmti/events.h)6
-rw-r--r--openjdkjvmti/fixed_up_dex_file.cc (renamed from runtime/openjdkjvmti/fixed_up_dex_file.cc)0
-rw-r--r--openjdkjvmti/fixed_up_dex_file.h (renamed from runtime/openjdkjvmti/fixed_up_dex_file.h)6
-rw-r--r--openjdkjvmti/include/jvmti.h (renamed from runtime/openjdkjvmti/include/jvmti.h)0
-rw-r--r--openjdkjvmti/jvmti_allocator.h (renamed from runtime/openjdkjvmti/jvmti_allocator.h)6
-rw-r--r--openjdkjvmti/jvmti_weak_table-inl.h (renamed from runtime/openjdkjvmti/jvmti_weak_table-inl.h)6
-rw-r--r--openjdkjvmti/jvmti_weak_table.h (renamed from runtime/openjdkjvmti/jvmti_weak_table.h)6
-rw-r--r--openjdkjvmti/object_tagging.cc (renamed from runtime/openjdkjvmti/object_tagging.cc)0
-rw-r--r--openjdkjvmti/object_tagging.h (renamed from runtime/openjdkjvmti/object_tagging.h)6
-rw-r--r--openjdkjvmti/ti_allocator.cc (renamed from runtime/openjdkjvmti/ti_allocator.cc)0
-rw-r--r--openjdkjvmti/ti_allocator.h (renamed from runtime/openjdkjvmti/ti_allocator.h)6
-rw-r--r--openjdkjvmti/ti_breakpoint.cc (renamed from runtime/openjdkjvmti/ti_breakpoint.cc)0
-rw-r--r--openjdkjvmti/ti_breakpoint.h (renamed from runtime/openjdkjvmti/ti_breakpoint.h)6
-rw-r--r--openjdkjvmti/ti_class.cc (renamed from runtime/openjdkjvmti/ti_class.cc)0
-rw-r--r--openjdkjvmti/ti_class.h (renamed from runtime/openjdkjvmti/ti_class.h)6
-rw-r--r--openjdkjvmti/ti_class_definition.cc (renamed from runtime/openjdkjvmti/ti_class_definition.cc)0
-rw-r--r--openjdkjvmti/ti_class_definition.h (renamed from runtime/openjdkjvmti/ti_class_definition.h)6
-rw-r--r--openjdkjvmti/ti_class_loader.cc (renamed from runtime/openjdkjvmti/ti_class_loader.cc)0
-rw-r--r--openjdkjvmti/ti_class_loader.h (renamed from runtime/openjdkjvmti/ti_class_loader.h)6
-rw-r--r--openjdkjvmti/ti_dump.cc (renamed from runtime/openjdkjvmti/ti_dump.cc)0
-rw-r--r--openjdkjvmti/ti_dump.h (renamed from runtime/openjdkjvmti/ti_dump.h)6
-rw-r--r--openjdkjvmti/ti_field.cc (renamed from runtime/openjdkjvmti/ti_field.cc)0
-rw-r--r--openjdkjvmti/ti_field.h (renamed from runtime/openjdkjvmti/ti_field.h)6
-rw-r--r--openjdkjvmti/ti_heap.cc (renamed from runtime/openjdkjvmti/ti_heap.cc)0
-rw-r--r--openjdkjvmti/ti_heap.h (renamed from runtime/openjdkjvmti/ti_heap.h)6
-rw-r--r--openjdkjvmti/ti_jni.cc (renamed from runtime/openjdkjvmti/ti_jni.cc)0
-rw-r--r--openjdkjvmti/ti_jni.h (renamed from runtime/openjdkjvmti/ti_jni.h)6
-rw-r--r--openjdkjvmti/ti_method.cc (renamed from runtime/openjdkjvmti/ti_method.cc)6
-rw-r--r--openjdkjvmti/ti_method.h (renamed from runtime/openjdkjvmti/ti_method.h)6
-rw-r--r--openjdkjvmti/ti_monitor.cc (renamed from runtime/openjdkjvmti/ti_monitor.cc)0
-rw-r--r--openjdkjvmti/ti_monitor.h (renamed from runtime/openjdkjvmti/ti_monitor.h)6
-rw-r--r--openjdkjvmti/ti_object.cc (renamed from runtime/openjdkjvmti/ti_object.cc)0
-rw-r--r--openjdkjvmti/ti_object.h (renamed from runtime/openjdkjvmti/ti_object.h)6
-rw-r--r--openjdkjvmti/ti_phase.cc (renamed from runtime/openjdkjvmti/ti_phase.cc)0
-rw-r--r--openjdkjvmti/ti_phase.h (renamed from runtime/openjdkjvmti/ti_phase.h)6
-rw-r--r--openjdkjvmti/ti_properties.cc (renamed from runtime/openjdkjvmti/ti_properties.cc)0
-rw-r--r--openjdkjvmti/ti_properties.h (renamed from runtime/openjdkjvmti/ti_properties.h)6
-rw-r--r--openjdkjvmti/ti_redefine.cc (renamed from runtime/openjdkjvmti/ti_redefine.cc)0
-rw-r--r--openjdkjvmti/ti_redefine.h (renamed from runtime/openjdkjvmti/ti_redefine.h)6
-rw-r--r--openjdkjvmti/ti_search.cc (renamed from runtime/openjdkjvmti/ti_search.cc)0
-rw-r--r--openjdkjvmti/ti_search.h (renamed from runtime/openjdkjvmti/ti_search.h)6
-rw-r--r--openjdkjvmti/ti_stack.cc (renamed from runtime/openjdkjvmti/ti_stack.cc)0
-rw-r--r--openjdkjvmti/ti_stack.h (renamed from runtime/openjdkjvmti/ti_stack.h)6
-rw-r--r--openjdkjvmti/ti_thread.cc (renamed from runtime/openjdkjvmti/ti_thread.cc)242
-rw-r--r--openjdkjvmti/ti_thread.h (renamed from runtime/openjdkjvmti/ti_thread.h)13
-rw-r--r--openjdkjvmti/ti_threadgroup.cc (renamed from runtime/openjdkjvmti/ti_threadgroup.cc)0
-rw-r--r--openjdkjvmti/ti_threadgroup.h (renamed from runtime/openjdkjvmti/ti_threadgroup.h)6
-rw-r--r--openjdkjvmti/ti_timers.cc (renamed from runtime/openjdkjvmti/ti_timers.cc)0
-rw-r--r--openjdkjvmti/ti_timers.h (renamed from runtime/openjdkjvmti/ti_timers.h)6
-rw-r--r--openjdkjvmti/transform.cc (renamed from runtime/openjdkjvmti/transform.cc)0
-rw-r--r--openjdkjvmti/transform.h (renamed from runtime/openjdkjvmti/transform.h)6
-rw-r--r--runtime/Android.bp4
-rw-r--r--runtime/instrumentation.h3
-rw-r--r--runtime/jit/jit_code_cache.cc2
-rw-r--r--test/ti-agent/jvmti_helper.cc2
-rw-r--r--tools/art46
-rwxr-xr-xtools/cpplint_presubmit.py2
68 files changed, 278 insertions, 238 deletions
diff --git a/Android.bp b/Android.bp
index cb72082e6d..0ce7916590 100644
--- a/Android.bp
+++ b/Android.bp
@@ -32,6 +32,7 @@ subdirs = [
"imgdiag",
"oatdump",
"openjdkjvm",
+ "openjdkjvmti",
"patchoat",
"profman",
"runtime",
diff --git a/build/Android.cpplint.mk b/build/Android.cpplint.mk
index 66ac897f76..2688c049d5 100644
--- a/build/Android.cpplint.mk
+++ b/build/Android.cpplint.mk
@@ -22,7 +22,7 @@ ART_CPPLINT_FLAGS := --root=$(TOP)
ART_CPPLINT_QUIET := --quiet
ART_CPPLINT_INGORED := \
runtime/elf.h \
- runtime/openjdkjvmti/include/jvmti.h
+ openjdkjvmti/include/jvmti.h
# This:
# 1) Gets a list of all .h & .cc files in the art directory.
diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc
index fb8e894581..7ef24c700e 100644
--- a/imgdiag/imgdiag.cc
+++ b/imgdiag/imgdiag.cc
@@ -1075,6 +1075,8 @@ class ImgDiagDumper {
}
}
+ std::vector<size_t> private_dirty_pages_for_section(ImageHeader::kSectionCount, 0u);
+
// Iterate through one byte at a time.
ptrdiff_t page_off_begin = image_header_.GetImageBegin() - image_begin;
for (uintptr_t begin = boot_map_.start; begin != boot_map_.end; ++begin) {
@@ -1127,6 +1129,12 @@ class ImgDiagDumper {
if (is_dirty && is_private) {
mapping_data->private_dirty_pages++;
+ for (size_t i = 0; i < ImageHeader::kSectionCount; ++i) {
+ const ImageHeader::ImageSections section = static_cast<ImageHeader::ImageSections>(i);
+ if (image_header_.GetImageSection(section).Contains(offset)) {
+ ++private_dirty_pages_for_section[i];
+ }
+ }
}
}
}
@@ -1138,7 +1146,19 @@ class ImgDiagDumper {
<< mapping_data->dirty_pages << " pages are dirty;\n "
<< mapping_data->false_dirty_pages << " pages are false dirty;\n "
<< mapping_data->private_pages << " pages are private;\n "
- << mapping_data->private_dirty_pages << " pages are Private_Dirty\n ";
+ << mapping_data->private_dirty_pages << " pages are Private_Dirty\n "
+ << "\n";
+
+ size_t total_private_dirty_pages = std::accumulate(private_dirty_pages_for_section.begin(),
+ private_dirty_pages_for_section.end(),
+ 0u);
+ os << "Image sections (total private dirty pages " << total_private_dirty_pages << ")\n";
+ for (size_t i = 0; i < ImageHeader::kSectionCount; ++i) {
+ const ImageHeader::ImageSections section = static_cast<ImageHeader::ImageSections>(i);
+ os << section << " " << image_header_.GetImageSection(section)
+ << " private dirty pages=" << private_dirty_pages_for_section[i] << "\n";
+ }
+ os << "\n";
return true;
}
diff --git a/runtime/openjdkjvmti/Android.bp b/openjdkjvmti/Android.bp
index aec1bd0f37..b6b1b56a26 100644
--- a/runtime/openjdkjvmti/Android.bp
+++ b/openjdkjvmti/Android.bp
@@ -48,7 +48,6 @@ cc_defaults {
"ti_threadgroup.cc",
"ti_timers.cc",
"transform.cc"],
- include_dirs: ["art/runtime"],
header_libs: ["libopenjdkjvmti_headers"],
shared_libs: [
"libbase",
diff --git a/runtime/openjdkjvmti/MODULE_LICENSE_GPL_WITH_CLASSPATH_EXCEPTION b/openjdkjvmti/MODULE_LICENSE_GPL_WITH_CLASSPATH_EXCEPTION
index e69de29bb2..e69de29bb2 100644
--- a/runtime/openjdkjvmti/MODULE_LICENSE_GPL_WITH_CLASSPATH_EXCEPTION
+++ b/openjdkjvmti/MODULE_LICENSE_GPL_WITH_CLASSPATH_EXCEPTION
diff --git a/runtime/openjdkjvmti/NOTICE b/openjdkjvmti/NOTICE
index 6ec62cd4f1..6ec62cd4f1 100644
--- a/runtime/openjdkjvmti/NOTICE
+++ b/openjdkjvmti/NOTICE
diff --git a/runtime/openjdkjvmti/OpenjdkJvmTi.cc b/openjdkjvmti/OpenjdkJvmTi.cc
index af770724ab..af770724ab 100644
--- a/runtime/openjdkjvmti/OpenjdkJvmTi.cc
+++ b/openjdkjvmti/OpenjdkJvmTi.cc
diff --git a/runtime/openjdkjvmti/README.md b/openjdkjvmti/README.md
index b8bab573d1..b8bab573d1 100644
--- a/runtime/openjdkjvmti/README.md
+++ b/openjdkjvmti/README.md
diff --git a/runtime/openjdkjvmti/art_jvmti.h b/openjdkjvmti/art_jvmti.h
index a2259c74cf..12f4cabca4 100644
--- a/runtime/openjdkjvmti/art_jvmti.h
+++ b/openjdkjvmti/art_jvmti.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_ART_JVMTI_H_
-#define ART_RUNTIME_OPENJDKJVMTI_ART_JVMTI_H_
+#ifndef ART_OPENJDKJVMTI_ART_JVMTI_H_
+#define ART_OPENJDKJVMTI_ART_JVMTI_H_
#include <memory>
#include <type_traits>
@@ -232,7 +232,7 @@ const jvmtiCapabilities kPotentialCapabilities = {
.can_get_line_numbers = 1,
.can_get_source_debug_extension = 1,
.can_access_local_variables = 1,
- .can_maintain_original_method_order = 0,
+ .can_maintain_original_method_order = 1,
.can_generate_single_step_events = 1,
.can_generate_exception_events = 0,
.can_generate_frame_pop_events = 0,
@@ -262,4 +262,4 @@ const jvmtiCapabilities kPotentialCapabilities = {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_ART_JVMTI_H_
+#endif // ART_OPENJDKJVMTI_ART_JVMTI_H_
diff --git a/runtime/openjdkjvmti/events-inl.h b/openjdkjvmti/events-inl.h
index 91e40553f0..32dba3e3e1 100644
--- a/runtime/openjdkjvmti/events-inl.h
+++ b/openjdkjvmti/events-inl.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_EVENTS_INL_H_
-#define ART_RUNTIME_OPENJDKJVMTI_EVENTS_INL_H_
+#ifndef ART_OPENJDKJVMTI_EVENTS_INL_H_
+#define ART_OPENJDKJVMTI_EVENTS_INL_H_
#include <array>
@@ -437,4 +437,4 @@ inline void EventHandler::HandleChangedCapabilities(ArtJvmTiEnv* env,
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_EVENTS_INL_H_
+#endif // ART_OPENJDKJVMTI_EVENTS_INL_H_
diff --git a/runtime/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 2944a453e0..2944a453e0 100644
--- a/runtime/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
diff --git a/runtime/openjdkjvmti/events.h b/openjdkjvmti/events.h
index 617519eaa3..3d05fa18c7 100644
--- a/runtime/openjdkjvmti/events.h
+++ b/openjdkjvmti/events.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_EVENTS_H_
-#define ART_RUNTIME_OPENJDKJVMTI_EVENTS_H_
+#ifndef ART_OPENJDKJVMTI_EVENTS_H_
+#define ART_OPENJDKJVMTI_EVENTS_H_
#include <bitset>
#include <vector>
@@ -227,4 +227,4 @@ class EventHandler {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_EVENTS_H_
+#endif // ART_OPENJDKJVMTI_EVENTS_H_
diff --git a/runtime/openjdkjvmti/fixed_up_dex_file.cc b/openjdkjvmti/fixed_up_dex_file.cc
index 5bfa5ca491..5bfa5ca491 100644
--- a/runtime/openjdkjvmti/fixed_up_dex_file.cc
+++ b/openjdkjvmti/fixed_up_dex_file.cc
diff --git a/runtime/openjdkjvmti/fixed_up_dex_file.h b/openjdkjvmti/fixed_up_dex_file.h
index a96ee1219e..4cb39cfe93 100644
--- a/runtime/openjdkjvmti/fixed_up_dex_file.h
+++ b/openjdkjvmti/fixed_up_dex_file.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_FIXED_UP_DEX_FILE_H_
-#define ART_RUNTIME_OPENJDKJVMTI_FIXED_UP_DEX_FILE_H_
+#ifndef ART_OPENJDKJVMTI_FIXED_UP_DEX_FILE_H_
+#define ART_OPENJDKJVMTI_FIXED_UP_DEX_FILE_H_
#include <memory>
#include <vector>
@@ -80,4 +80,4 @@ class FixedUpDexFile {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_FIXED_UP_DEX_FILE_H_
+#endif // ART_OPENJDKJVMTI_FIXED_UP_DEX_FILE_H_
diff --git a/runtime/openjdkjvmti/include/jvmti.h b/openjdkjvmti/include/jvmti.h
index de07c163fc..de07c163fc 100644
--- a/runtime/openjdkjvmti/include/jvmti.h
+++ b/openjdkjvmti/include/jvmti.h
diff --git a/runtime/openjdkjvmti/jvmti_allocator.h b/openjdkjvmti/jvmti_allocator.h
index 44b1cb1c20..e29e034f40 100644
--- a/runtime/openjdkjvmti/jvmti_allocator.h
+++ b/openjdkjvmti/jvmti_allocator.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_JVMTI_ALLOCATOR_H_
-#define ART_RUNTIME_OPENJDKJVMTI_JVMTI_ALLOCATOR_H_
+#ifndef ART_OPENJDKJVMTI_JVMTI_ALLOCATOR_H_
+#define ART_OPENJDKJVMTI_JVMTI_ALLOCATOR_H_
#include "base/logging.h"
#include "base/macros.h"
@@ -171,4 +171,4 @@ inline bool operator!=(const JvmtiAllocator<T>& lhs, const JvmtiAllocator<T>& rh
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_JVMTI_ALLOCATOR_H_
+#endif // ART_OPENJDKJVMTI_JVMTI_ALLOCATOR_H_
diff --git a/runtime/openjdkjvmti/jvmti_weak_table-inl.h b/openjdkjvmti/jvmti_weak_table-inl.h
index a640acbe98..1c82255fff 100644
--- a/runtime/openjdkjvmti/jvmti_weak_table-inl.h
+++ b/openjdkjvmti/jvmti_weak_table-inl.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_JVMTI_WEAK_TABLE_INL_H_
-#define ART_RUNTIME_OPENJDKJVMTI_JVMTI_WEAK_TABLE_INL_H_
+#ifndef ART_OPENJDKJVMTI_JVMTI_WEAK_TABLE_INL_H_
+#define ART_OPENJDKJVMTI_JVMTI_WEAK_TABLE_INL_H_
#include "jvmti_weak_table.h"
@@ -403,4 +403,4 @@ art::mirror::Object* JvmtiWeakTable<T>::Find(T tag) {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_JVMTI_WEAK_TABLE_INL_H_
+#endif // ART_OPENJDKJVMTI_JVMTI_WEAK_TABLE_INL_H_
diff --git a/runtime/openjdkjvmti/jvmti_weak_table.h b/openjdkjvmti/jvmti_weak_table.h
index a5175a42ba..5a821c964b 100644
--- a/runtime/openjdkjvmti/jvmti_weak_table.h
+++ b/openjdkjvmti/jvmti_weak_table.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_JVMTI_WEAK_TABLE_H_
-#define ART_RUNTIME_OPENJDKJVMTI_JVMTI_WEAK_TABLE_H_
+#ifndef ART_OPENJDKJVMTI_JVMTI_WEAK_TABLE_H_
+#define ART_OPENJDKJVMTI_JVMTI_WEAK_TABLE_H_
#include <unordered_map>
@@ -224,4 +224,4 @@ class JvmtiWeakTable : public art::gc::SystemWeakHolder {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_JVMTI_WEAK_TABLE_H_
+#endif // ART_OPENJDKJVMTI_JVMTI_WEAK_TABLE_H_
diff --git a/runtime/openjdkjvmti/object_tagging.cc b/openjdkjvmti/object_tagging.cc
index dcdd3ede13..dcdd3ede13 100644
--- a/runtime/openjdkjvmti/object_tagging.cc
+++ b/openjdkjvmti/object_tagging.cc
diff --git a/runtime/openjdkjvmti/object_tagging.h b/openjdkjvmti/object_tagging.h
index ca84e442dc..b474845566 100644
--- a/runtime/openjdkjvmti/object_tagging.h
+++ b/openjdkjvmti/object_tagging.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_OBJECT_TAGGING_H_
-#define ART_RUNTIME_OPENJDKJVMTI_OBJECT_TAGGING_H_
+#ifndef ART_OPENJDKJVMTI_OBJECT_TAGGING_H_
+#define ART_OPENJDKJVMTI_OBJECT_TAGGING_H_
#include <unordered_map>
@@ -83,4 +83,4 @@ class ObjectTagTable FINAL : public JvmtiWeakTable<jlong> {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_OBJECT_TAGGING_H_
+#endif // ART_OPENJDKJVMTI_OBJECT_TAGGING_H_
diff --git a/runtime/openjdkjvmti/ti_allocator.cc b/openjdkjvmti/ti_allocator.cc
index 575558dccf..575558dccf 100644
--- a/runtime/openjdkjvmti/ti_allocator.cc
+++ b/openjdkjvmti/ti_allocator.cc
diff --git a/runtime/openjdkjvmti/ti_allocator.h b/openjdkjvmti/ti_allocator.h
index 35575c3884..776cc5ed14 100644
--- a/runtime/openjdkjvmti/ti_allocator.h
+++ b/openjdkjvmti/ti_allocator.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_ALLOCATOR_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_ALLOCATOR_H_
+#ifndef ART_OPENJDKJVMTI_TI_ALLOCATOR_H_
+#define ART_OPENJDKJVMTI_TI_ALLOCATOR_H_
#include "jni.h"
#include "jvmti.h"
@@ -61,5 +61,5 @@ class AllocUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_ALLOCATOR_H_
+#endif // ART_OPENJDKJVMTI_TI_ALLOCATOR_H_
diff --git a/runtime/openjdkjvmti/ti_breakpoint.cc b/openjdkjvmti/ti_breakpoint.cc
index f5116a8080..f5116a8080 100644
--- a/runtime/openjdkjvmti/ti_breakpoint.cc
+++ b/openjdkjvmti/ti_breakpoint.cc
diff --git a/runtime/openjdkjvmti/ti_breakpoint.h b/openjdkjvmti/ti_breakpoint.h
index c3dbef7baf..9b08b425fa 100644
--- a/runtime/openjdkjvmti/ti_breakpoint.h
+++ b/openjdkjvmti/ti_breakpoint.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_BREAKPOINT_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_BREAKPOINT_H_
+#ifndef ART_OPENJDKJVMTI_TI_BREAKPOINT_H_
+#define ART_OPENJDKJVMTI_TI_BREAKPOINT_H_
#include "jni.h"
#include "jvmti.h"
@@ -91,4 +91,4 @@ template<> struct hash<openjdkjvmti::Breakpoint> {
};
} // namespace std
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_BREAKPOINT_H_
+#endif // ART_OPENJDKJVMTI_TI_BREAKPOINT_H_
diff --git a/runtime/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index 954b5d1d03..954b5d1d03 100644
--- a/runtime/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
diff --git a/runtime/openjdkjvmti/ti_class.h b/openjdkjvmti/ti_class.h
index 7bb6b3e5de..dd99e3621f 100644
--- a/runtime/openjdkjvmti/ti_class.h
+++ b/openjdkjvmti/ti_class.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_H_
+#ifndef ART_OPENJDKJVMTI_TI_CLASS_H_
+#define ART_OPENJDKJVMTI_TI_CLASS_H_
#include "jni.h"
#include "jvmti.h"
@@ -92,4 +92,4 @@ class ClassUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_H_
+#endif // ART_OPENJDKJVMTI_TI_CLASS_H_
diff --git a/runtime/openjdkjvmti/ti_class_definition.cc b/openjdkjvmti/ti_class_definition.cc
index c73ef0d31c..c73ef0d31c 100644
--- a/runtime/openjdkjvmti/ti_class_definition.cc
+++ b/openjdkjvmti/ti_class_definition.cc
diff --git a/runtime/openjdkjvmti/ti_class_definition.h b/openjdkjvmti/ti_class_definition.h
index 2c268ddd4c..accc456957 100644
--- a/runtime/openjdkjvmti/ti_class_definition.h
+++ b/openjdkjvmti/ti_class_definition.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_DEFINITION_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_DEFINITION_H_
+#ifndef ART_OPENJDKJVMTI_TI_CLASS_DEFINITION_H_
+#define ART_OPENJDKJVMTI_TI_CLASS_DEFINITION_H_
#include "art_jvmti.h"
@@ -128,4 +128,4 @@ class ArtClassDefinition {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_DEFINITION_H_
+#endif // ART_OPENJDKJVMTI_TI_CLASS_DEFINITION_H_
diff --git a/runtime/openjdkjvmti/ti_class_loader.cc b/openjdkjvmti/ti_class_loader.cc
index e81e4bc803..e81e4bc803 100644
--- a/runtime/openjdkjvmti/ti_class_loader.cc
+++ b/openjdkjvmti/ti_class_loader.cc
diff --git a/runtime/openjdkjvmti/ti_class_loader.h b/openjdkjvmti/ti_class_loader.h
index af66c5fd4d..767e258a77 100644
--- a/runtime/openjdkjvmti/ti_class_loader.h
+++ b/openjdkjvmti/ti_class_loader.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_LOADER_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_LOADER_H_
+#ifndef ART_OPENJDKJVMTI_TI_CLASS_LOADER_H_
+#define ART_OPENJDKJVMTI_TI_CLASS_LOADER_H_
#include <string>
@@ -96,4 +96,4 @@ class ClassLoaderHelper {
};
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_CLASS_LOADER_H_
+#endif // ART_OPENJDKJVMTI_TI_CLASS_LOADER_H_
diff --git a/runtime/openjdkjvmti/ti_dump.cc b/openjdkjvmti/ti_dump.cc
index 809a5e47bb..809a5e47bb 100644
--- a/runtime/openjdkjvmti/ti_dump.cc
+++ b/openjdkjvmti/ti_dump.cc
diff --git a/runtime/openjdkjvmti/ti_dump.h b/openjdkjvmti/ti_dump.h
index 67cb2394f8..323bf56aef 100644
--- a/runtime/openjdkjvmti/ti_dump.h
+++ b/openjdkjvmti/ti_dump.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_DUMP_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_DUMP_H_
+#ifndef ART_OPENJDKJVMTI_TI_DUMP_H_
+#define ART_OPENJDKJVMTI_TI_DUMP_H_
#include "jni.h"
#include "jvmti.h"
@@ -47,4 +47,4 @@ class DumpUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_DUMP_H_
+#endif // ART_OPENJDKJVMTI_TI_DUMP_H_
diff --git a/runtime/openjdkjvmti/ti_field.cc b/openjdkjvmti/ti_field.cc
index c45b926695..c45b926695 100644
--- a/runtime/openjdkjvmti/ti_field.cc
+++ b/openjdkjvmti/ti_field.cc
diff --git a/runtime/openjdkjvmti/ti_field.h b/openjdkjvmti/ti_field.h
index 880949eecb..8a229ed19d 100644
--- a/runtime/openjdkjvmti/ti_field.h
+++ b/openjdkjvmti/ti_field.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_FIELD_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_FIELD_H_
+#ifndef ART_OPENJDKJVMTI_TI_FIELD_H_
+#define ART_OPENJDKJVMTI_TI_FIELD_H_
#include "jni.h"
#include "jvmti.h"
@@ -69,4 +69,4 @@ class FieldUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_FIELD_H_
+#endif // ART_OPENJDKJVMTI_TI_FIELD_H_
diff --git a/runtime/openjdkjvmti/ti_heap.cc b/openjdkjvmti/ti_heap.cc
index 3397210151..3397210151 100644
--- a/runtime/openjdkjvmti/ti_heap.cc
+++ b/openjdkjvmti/ti_heap.cc
diff --git a/runtime/openjdkjvmti/ti_heap.h b/openjdkjvmti/ti_heap.h
index 0c973db199..62761b500c 100644
--- a/runtime/openjdkjvmti/ti_heap.h
+++ b/openjdkjvmti/ti_heap.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_HEAP_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_HEAP_H_
+#ifndef ART_OPENJDKJVMTI_TI_HEAP_H_
+#define ART_OPENJDKJVMTI_TI_HEAP_H_
#include "jvmti.h"
@@ -70,4 +70,4 @@ class HeapExtensions {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_HEAP_H_
+#endif // ART_OPENJDKJVMTI_TI_HEAP_H_
diff --git a/runtime/openjdkjvmti/ti_jni.cc b/openjdkjvmti/ti_jni.cc
index dd2dda118a..dd2dda118a 100644
--- a/runtime/openjdkjvmti/ti_jni.cc
+++ b/openjdkjvmti/ti_jni.cc
diff --git a/runtime/openjdkjvmti/ti_jni.h b/openjdkjvmti/ti_jni.h
index 906aab0667..590fd545da 100644
--- a/runtime/openjdkjvmti/ti_jni.h
+++ b/openjdkjvmti/ti_jni.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_JNI_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_JNI_H_
+#ifndef ART_OPENJDKJVMTI_TI_JNI_H_
+#define ART_OPENJDKJVMTI_TI_JNI_H_
#include "jni.h"
#include "jvmti.h"
@@ -55,4 +55,4 @@ class JNIUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_JNI_H_
+#endif // ART_OPENJDKJVMTI_TI_JNI_H_
diff --git a/runtime/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index ed5645a1ab..8f727147a4 100644
--- a/runtime/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -782,6 +782,7 @@ jvmtiError MethodUtil::GetLocalVariableGeneric(jvmtiEnv* env ATTRIBUTE_UNUSED,
}
art::Thread* self = art::Thread::Current();
art::ScopedObjectAccess soa(self);
+ art::MutexLock mu(self, *art::Locks::thread_list_lock_);
art::Thread* target = ThreadUtil::GetNativeThread(thread, soa);
if (target == nullptr && thread == nullptr) {
return ERR(INVALID_THREAD);
@@ -790,7 +791,6 @@ jvmtiError MethodUtil::GetLocalVariableGeneric(jvmtiEnv* env ATTRIBUTE_UNUSED,
return ERR(THREAD_NOT_ALIVE);
}
GetLocalVariableClosure c(self, depth, slot, type, val);
- art::MutexLock mu(self, *art::Locks::thread_list_lock_);
if (!target->RequestSynchronousCheckpoint(&c)) {
return ERR(THREAD_NOT_ALIVE);
} else {
@@ -909,6 +909,7 @@ jvmtiError MethodUtil::SetLocalVariableGeneric(jvmtiEnv* env ATTRIBUTE_UNUSED,
}
art::Thread* self = art::Thread::Current();
art::ScopedObjectAccess soa(self);
+ art::MutexLock mu(self, *art::Locks::thread_list_lock_);
art::Thread* target = ThreadUtil::GetNativeThread(thread, soa);
if (target == nullptr && thread == nullptr) {
return ERR(INVALID_THREAD);
@@ -917,7 +918,6 @@ jvmtiError MethodUtil::SetLocalVariableGeneric(jvmtiEnv* env ATTRIBUTE_UNUSED,
return ERR(THREAD_NOT_ALIVE);
}
SetLocalVariableClosure c(self, depth, slot, type, val);
- art::MutexLock mu(self, *art::Locks::thread_list_lock_);
if (!target->RequestSynchronousCheckpoint(&c)) {
return ERR(THREAD_NOT_ALIVE);
} else {
@@ -974,6 +974,7 @@ jvmtiError MethodUtil::GetLocalInstance(jvmtiEnv* env ATTRIBUTE_UNUSED,
}
art::Thread* self = art::Thread::Current();
art::ScopedObjectAccess soa(self);
+ art::MutexLock mu(self, *art::Locks::thread_list_lock_);
art::Thread* target = ThreadUtil::GetNativeThread(thread, soa);
if (target == nullptr && thread == nullptr) {
return ERR(INVALID_THREAD);
@@ -982,7 +983,6 @@ jvmtiError MethodUtil::GetLocalInstance(jvmtiEnv* env ATTRIBUTE_UNUSED,
return ERR(THREAD_NOT_ALIVE);
}
GetLocalInstanceClosure c(self, depth, data);
- art::MutexLock mu(self, *art::Locks::thread_list_lock_);
if (!target->RequestSynchronousCheckpoint(&c)) {
return ERR(THREAD_NOT_ALIVE);
} else {
diff --git a/runtime/openjdkjvmti/ti_method.h b/openjdkjvmti/ti_method.h
index aabaedb932..e3578a416f 100644
--- a/runtime/openjdkjvmti/ti_method.h
+++ b/openjdkjvmti/ti_method.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_METHOD_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_METHOD_H_
+#ifndef ART_OPENJDKJVMTI_TI_METHOD_H_
+#define ART_OPENJDKJVMTI_TI_METHOD_H_
#include "jni.h"
#include "jvmti.h"
@@ -111,4 +111,4 @@ class MethodUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_METHOD_H_
+#endif // ART_OPENJDKJVMTI_TI_METHOD_H_
diff --git a/runtime/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index 61bf533eb7..61bf533eb7 100644
--- a/runtime/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
diff --git a/runtime/openjdkjvmti/ti_monitor.h b/openjdkjvmti/ti_monitor.h
index 96ccb0d1c7..add089c377 100644
--- a/runtime/openjdkjvmti/ti_monitor.h
+++ b/openjdkjvmti/ti_monitor.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_MONITOR_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_MONITOR_H_
+#ifndef ART_OPENJDKJVMTI_TI_MONITOR_H_
+#define ART_OPENJDKJVMTI_TI_MONITOR_H_
#include "jni.h"
#include "jvmti.h"
@@ -56,4 +56,4 @@ class MonitorUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_MONITOR_H_
+#endif // ART_OPENJDKJVMTI_TI_MONITOR_H_
diff --git a/runtime/openjdkjvmti/ti_object.cc b/openjdkjvmti/ti_object.cc
index 2506acac3a..2506acac3a 100644
--- a/runtime/openjdkjvmti/ti_object.cc
+++ b/openjdkjvmti/ti_object.cc
diff --git a/runtime/openjdkjvmti/ti_object.h b/openjdkjvmti/ti_object.h
index 09eee61bdb..fa3bd0f51a 100644
--- a/runtime/openjdkjvmti/ti_object.h
+++ b/openjdkjvmti/ti_object.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_OBJECT_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_OBJECT_H_
+#ifndef ART_OPENJDKJVMTI_TI_OBJECT_H_
+#define ART_OPENJDKJVMTI_TI_OBJECT_H_
#include "jni.h"
#include "jvmti.h"
@@ -46,4 +46,4 @@ class ObjectUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_OBJECT_H_
+#endif // ART_OPENJDKJVMTI_TI_OBJECT_H_
diff --git a/runtime/openjdkjvmti/ti_phase.cc b/openjdkjvmti/ti_phase.cc
index 8893c9b4aa..8893c9b4aa 100644
--- a/runtime/openjdkjvmti/ti_phase.cc
+++ b/openjdkjvmti/ti_phase.cc
diff --git a/runtime/openjdkjvmti/ti_phase.h b/openjdkjvmti/ti_phase.h
index a2c0d114ef..d4ed86b0c5 100644
--- a/runtime/openjdkjvmti/ti_phase.h
+++ b/openjdkjvmti/ti_phase.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_PHASE_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_PHASE_H_
+#ifndef ART_OPENJDKJVMTI_TI_PHASE_H_
+#define ART_OPENJDKJVMTI_TI_PHASE_H_
#include "jni.h"
#include "jvmti.h"
@@ -66,4 +66,4 @@ class PhaseUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_PHASE_H_
+#endif // ART_OPENJDKJVMTI_TI_PHASE_H_
diff --git a/runtime/openjdkjvmti/ti_properties.cc b/openjdkjvmti/ti_properties.cc
index c412814d8d..c412814d8d 100644
--- a/runtime/openjdkjvmti/ti_properties.cc
+++ b/openjdkjvmti/ti_properties.cc
diff --git a/runtime/openjdkjvmti/ti_properties.h b/openjdkjvmti/ti_properties.h
index 70734813bd..187b85d35f 100644
--- a/runtime/openjdkjvmti/ti_properties.h
+++ b/openjdkjvmti/ti_properties.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_PROPERTIES_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_PROPERTIES_H_
+#ifndef ART_OPENJDKJVMTI_TI_PROPERTIES_H_
+#define ART_OPENJDKJVMTI_TI_PROPERTIES_H_
#include "jni.h"
#include "jvmti.h"
@@ -48,4 +48,4 @@ class PropertiesUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_PROPERTIES_H_
+#endif // ART_OPENJDKJVMTI_TI_PROPERTIES_H_
diff --git a/runtime/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index c679d731fe..c679d731fe 100644
--- a/runtime/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
diff --git a/runtime/openjdkjvmti/ti_redefine.h b/openjdkjvmti/ti_redefine.h
index 03b4bf2074..984f922e25 100644
--- a/runtime/openjdkjvmti/ti_redefine.h
+++ b/openjdkjvmti/ti_redefine.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_REDEFINE_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_REDEFINE_H_
+#ifndef ART_OPENJDKJVMTI_TI_REDEFINE_H_
+#define ART_OPENJDKJVMTI_TI_REDEFINE_H_
#include <string>
@@ -265,4 +265,4 @@ class Redefiner {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_REDEFINE_H_
+#endif // ART_OPENJDKJVMTI_TI_REDEFINE_H_
diff --git a/runtime/openjdkjvmti/ti_search.cc b/openjdkjvmti/ti_search.cc
index 25bc5d6eb3..25bc5d6eb3 100644
--- a/runtime/openjdkjvmti/ti_search.cc
+++ b/openjdkjvmti/ti_search.cc
diff --git a/runtime/openjdkjvmti/ti_search.h b/openjdkjvmti/ti_search.h
index cd7b4be28c..81a28ccbe5 100644
--- a/runtime/openjdkjvmti/ti_search.h
+++ b/openjdkjvmti/ti_search.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_SEARCH_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_SEARCH_H_
+#ifndef ART_OPENJDKJVMTI_TI_SEARCH_H_
+#define ART_OPENJDKJVMTI_TI_SEARCH_H_
#include <vector>
@@ -50,4 +50,4 @@ class SearchUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_SEARCH_H_
+#endif // ART_OPENJDKJVMTI_TI_SEARCH_H_
diff --git a/runtime/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index ff2de8dac6..ff2de8dac6 100644
--- a/runtime/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
diff --git a/runtime/openjdkjvmti/ti_stack.h b/openjdkjvmti/ti_stack.h
index 6a593cfa9c..2e96b82e38 100644
--- a/runtime/openjdkjvmti/ti_stack.h
+++ b/openjdkjvmti/ti_stack.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_STACK_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_STACK_H_
+#ifndef ART_OPENJDKJVMTI_TI_STACK_H_
+#define ART_OPENJDKJVMTI_TI_STACK_H_
#include "jni.h"
#include "jvmti.h"
@@ -71,4 +71,4 @@ class StackUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_STACK_H_
+#endif // ART_OPENJDKJVMTI_TI_STACK_H_
diff --git a/runtime/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc
index 7d42879055..6fa73f8a8c 100644
--- a/runtime/openjdkjvmti/ti_thread.cc
+++ b/openjdkjvmti/ti_thread.cc
@@ -159,17 +159,6 @@ jvmtiError ThreadUtil::GetCurrentThread(jvmtiEnv* env ATTRIBUTE_UNUSED, jthread*
return ERR(NONE);
}
-static art::Thread* GetNativeThreadLocked(jthread thread,
- const art::ScopedObjectAccessAlreadyRunnable& soa)
- REQUIRES_SHARED(art::Locks::mutator_lock_)
- REQUIRES(art::Locks::thread_list_lock_) {
- if (thread == nullptr) {
- return art::Thread::Current();
- }
-
- return art::Thread::FromManagedThread(soa, thread);
-}
-
// Get the native thread. The spec says a null object denotes the current thread.
art::Thread* ThreadUtil::GetNativeThread(jthread thread,
const art::ScopedObjectAccessAlreadyRunnable& soa) {
@@ -177,7 +166,6 @@ art::Thread* ThreadUtil::GetNativeThread(jthread thread,
return art::Thread::Current();
}
- art::MutexLock mu(soa.Self(), *art::Locks::thread_list_lock_);
return art::Thread::FromManagedThread(soa, thread);
}
@@ -189,18 +177,20 @@ jvmtiError ThreadUtil::GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadI
return JVMTI_ERROR_WRONG_PHASE;
}
- art::ScopedObjectAccess soa(art::Thread::Current());
+ art::Thread* self = art::Thread::Current();
+ art::ScopedObjectAccess soa(self);
+ art::MutexLock mu(self, *art::Locks::thread_list_lock_);
- art::Thread* self = GetNativeThread(thread, soa);
- if (self == nullptr && thread == nullptr) {
+ art::Thread* target = GetNativeThread(thread, soa);
+ if (target == nullptr && thread == nullptr) {
return ERR(INVALID_THREAD);
}
JvmtiUniquePtr<char[]> name_uptr;
- if (self != nullptr) {
+ if (target != nullptr) {
// Have a native thread object, this thread is alive.
std::string name;
- self->GetThreadName(name);
+ target->GetThreadName(name);
jvmtiError name_result;
name_uptr = CopyString(env, name.c_str(), &name_result);
if (name_uptr == nullptr) {
@@ -208,11 +198,11 @@ jvmtiError ThreadUtil::GetThreadInfo(jvmtiEnv* env, jthread thread, jvmtiThreadI
}
info_ptr->name = name_uptr.get();
- info_ptr->priority = self->GetNativePriority();
+ info_ptr->priority = target->GetNativePriority();
- info_ptr->is_daemon = self->IsDaemon();
+ info_ptr->is_daemon = target->IsDaemon();
- art::ObjPtr<art::mirror::Object> peer = self->GetPeerFromOtherThread();
+ art::ObjPtr<art::mirror::Object> peer = target->GetPeerFromOtherThread();
// ThreadGroup.
if (peer != nullptr) {
@@ -309,9 +299,8 @@ struct InternalThreadState {
static InternalThreadState GetNativeThreadState(jthread thread,
const art::ScopedObjectAccessAlreadyRunnable& soa)
REQUIRES_SHARED(art::Locks::mutator_lock_)
- REQUIRES(art::Locks::user_code_suspension_lock_) {
+ REQUIRES(art::Locks::thread_list_lock_, art::Locks::user_code_suspension_lock_) {
art::Thread* self = nullptr;
- art::MutexLock tll_mu(soa.Self(), *art::Locks::thread_list_lock_);
if (thread == nullptr) {
self = art::Thread::Current();
} else {
@@ -455,43 +444,46 @@ jvmtiError ThreadUtil::GetThreadState(jvmtiEnv* env ATTRIBUTE_UNUSED,
}
}
art::ScopedObjectAccess soa(self);
+ art::MutexLock tll_mu(self, *art::Locks::thread_list_lock_);
state = GetNativeThreadState(thread, soa);
- break;
- } while (true);
-
- if (state.art_state == art::ThreadState::kStarting) {
- if (thread == nullptr) {
- // No native thread, and no Java thread? We must be starting up. Report as wrong phase.
- return ERR(WRONG_PHASE);
+ if (state.art_state == art::ThreadState::kStarting) {
+ break;
}
+ DCHECK(state.native_thread != nullptr);
- art::ScopedObjectAccess soa(self);
+ // Translate internal thread state to JVMTI and Java state.
+ jint jvmti_state = GetJvmtiThreadStateFromInternal(state);
+
+ // Java state is derived from nativeGetState.
+ // TODO: Our implementation assigns "runnable" to suspended. As such, we will have slightly
+ // different mask if a thread got suspended due to user-code. However, this is for
+ // consistency with the Java view.
+ jint java_state = GetJavaStateFromInternal(state);
+
+ *thread_state_ptr = jvmti_state | java_state;
- // Need to read the Java "started" field to know whether this is starting or terminated.
- art::ObjPtr<art::mirror::Object> peer = soa.Decode<art::mirror::Object>(thread);
- art::ObjPtr<art::mirror::Class> klass = peer->GetClass();
- art::ArtField* started_field = klass->FindDeclaredInstanceField("started", "Z");
- CHECK(started_field != nullptr);
- bool started = started_field->GetBoolean(peer) != 0;
- constexpr jint kStartedState = JVMTI_JAVA_LANG_THREAD_STATE_NEW;
- constexpr jint kTerminatedState = JVMTI_THREAD_STATE_TERMINATED |
- JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED;
- *thread_state_ptr = started ? kTerminatedState : kStartedState;
return ERR(NONE);
- }
- DCHECK(state.native_thread != nullptr);
+ } while (true);
- // Translate internal thread state to JVMTI and Java state.
- jint jvmti_state = GetJvmtiThreadStateFromInternal(state);
+ DCHECK_EQ(state.art_state, art::ThreadState::kStarting);
- // Java state is derived from nativeGetState.
- // TODO: Our implementation assigns "runnable" to suspended. As such, we will have slightly
- // different mask if a thread got suspended due to user-code. However, this is for
- // consistency with the Java view.
- jint java_state = GetJavaStateFromInternal(state);
+ if (thread == nullptr) {
+ // No native thread, and no Java thread? We must be starting up. Report as wrong phase.
+ return ERR(WRONG_PHASE);
+ }
- *thread_state_ptr = jvmti_state | java_state;
+ art::ScopedObjectAccess soa(self);
+ // Need to read the Java "started" field to know whether this is starting or terminated.
+ art::ObjPtr<art::mirror::Object> peer = soa.Decode<art::mirror::Object>(thread);
+ art::ObjPtr<art::mirror::Class> klass = peer->GetClass();
+ art::ArtField* started_field = klass->FindDeclaredInstanceField("started", "Z");
+ CHECK(started_field != nullptr);
+ bool started = started_field->GetBoolean(peer) != 0;
+ constexpr jint kStartedState = JVMTI_JAVA_LANG_THREAD_STATE_NEW;
+ constexpr jint kTerminatedState = JVMTI_THREAD_STATE_TERMINATED |
+ JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED;
+ *thread_state_ptr = started ? kTerminatedState : kStartedState;
return ERR(NONE);
}
@@ -570,7 +562,7 @@ jvmtiError ThreadUtil::SetThreadLocalStorage(jvmtiEnv* env, jthread thread, cons
art::Thread* self = art::Thread::Current();
art::ScopedObjectAccess soa(self);
art::MutexLock mu(self, *art::Locks::thread_list_lock_);
- art::Thread* target = GetNativeThreadLocked(thread, soa);
+ art::Thread* target = GetNativeThread(thread, soa);
if (target == nullptr && thread == nullptr) {
return ERR(INVALID_THREAD);
}
@@ -599,7 +591,7 @@ jvmtiError ThreadUtil::GetThreadLocalStorage(jvmtiEnv* env,
art::Thread* self = art::Thread::Current();
art::ScopedObjectAccess soa(self);
art::MutexLock mu(self, *art::Locks::thread_list_lock_);
- art::Thread* target = GetNativeThreadLocked(thread, soa);
+ art::Thread* target = GetNativeThread(thread, soa);
if (target == nullptr && thread == nullptr) {
return ERR(INVALID_THREAD);
}
@@ -699,8 +691,7 @@ jvmtiError ThreadUtil::RunAgentThread(jvmtiEnv* jvmti_env,
}
jvmtiError ThreadUtil::SuspendOther(art::Thread* self,
- jthread target_jthread,
- const art::Thread* target) {
+ jthread target_jthread) {
// Loop since we need to bail out and try again if we would end up getting suspended while holding
// the user_code_suspension_lock_ due to a SuspendReason::kForUserCode. In this situation we
// release the lock, wait to get resumed and try again.
@@ -713,33 +704,43 @@ jvmtiError ThreadUtil::SuspendOther(art::Thread* self,
SuspendCheck(self);
art::MutexLock mu(self, *art::Locks::user_code_suspension_lock_);
{
- art::MutexLock thread_list_mu(self, *art::Locks::thread_suspend_count_lock_);
+ art::MutexLock thread_suspend_count_mu(self, *art::Locks::thread_suspend_count_lock_);
// Make sure we won't be suspended in the middle of holding the thread_suspend_count_lock_ by
// a user-code suspension. We retry and do another SuspendCheck to clear this.
if (self->GetUserCodeSuspendCount() != 0) {
continue;
- } else if (target->GetUserCodeSuspendCount() != 0) {
- return ERR(THREAD_SUSPENDED);
}
+ // We are not going to be suspended by user code from now on.
}
- bool timeout = true;
- while (timeout) {
+ {
+ art::ScopedObjectAccess soa(self);
+ art::MutexLock thread_list_mu(self, *art::Locks::thread_list_lock_);
+ art::Thread* target = GetNativeThread(target_jthread, soa);
art::ThreadState state = target->GetState();
if (state == art::ThreadState::kTerminated || state == art::ThreadState::kStarting) {
return ERR(THREAD_NOT_ALIVE);
- }
- art::Thread* ret_target = art::Runtime::Current()->GetThreadList()->SuspendThreadByPeer(
- target_jthread,
- /* request_suspension */ true,
- art::SuspendReason::kForUserCode,
- &timeout);
- if (ret_target == nullptr && !timeout) {
- // TODO It would be good to get more information about why exactly the thread failed to
- // suspend.
- return ERR(INTERNAL);
+ } else {
+ art::MutexLock thread_suspend_count_mu(self, *art::Locks::thread_suspend_count_lock_);
+ if (target->GetUserCodeSuspendCount() != 0) {
+ return ERR(THREAD_SUSPENDED);
+ }
}
}
- return OK;
+ bool timeout = true;
+ art::Thread* ret_target = art::Runtime::Current()->GetThreadList()->SuspendThreadByPeer(
+ target_jthread,
+ /* request_suspension */ true,
+ art::SuspendReason::kForUserCode,
+ &timeout);
+ if (ret_target == nullptr && !timeout) {
+ // TODO It would be good to get more information about why exactly the thread failed to
+ // suspend.
+ return ERR(INTERNAL);
+ } else if (!timeout) {
+ // we didn't time out and got a result.
+ return OK;
+ }
+ // We timed out. Just go around and try again.
} while (true);
UNREACHABLE();
}
@@ -768,18 +769,21 @@ jvmtiError ThreadUtil::SuspendSelf(art::Thread* self) {
jvmtiError ThreadUtil::SuspendThread(jvmtiEnv* env ATTRIBUTE_UNUSED, jthread thread) {
art::Thread* self = art::Thread::Current();
- art::Thread* target;
+ bool target_is_self = false;
{
art::ScopedObjectAccess soa(self);
- target = GetNativeThread(thread, soa);
- }
- if (target == nullptr) {
- return ERR(INVALID_THREAD);
+ art::MutexLock mu(self, *art::Locks::thread_list_lock_);
+ art::Thread* target = GetNativeThread(thread, soa);
+ if (target == nullptr) {
+ return ERR(INVALID_THREAD);
+ } else if (target == self) {
+ target_is_self = true;
+ }
}
- if (target == self) {
+ if (target_is_self) {
return SuspendSelf(self);
} else {
- return SuspendOther(self, thread, target);
+ return SuspendOther(self, thread);
}
}
@@ -790,41 +794,56 @@ jvmtiError ThreadUtil::ResumeThread(jvmtiEnv* env ATTRIBUTE_UNUSED,
}
art::Thread* self = art::Thread::Current();
art::Thread* target;
- {
- // NB This does a SuspendCheck (during thread state change) so we need to make sure we don't
- // have the 'suspend_lock' locked here.
- art::ScopedObjectAccess soa(self);
- target = GetNativeThread(thread, soa);
- }
- if (target == nullptr) {
- return ERR(INVALID_THREAD);
- } else if (target == self) {
- // We would have paused until we aren't suspended anymore due to the ScopedObjectAccess so we
- // can just return THREAD_NOT_SUSPENDED. Unfortunately we cannot do any real DCHECKs about
- // current state since it's all concurrent.
- return ERR(THREAD_NOT_SUSPENDED);
- }
- // Now that we know we aren't getting suspended ourself (since we have a mutator lock) we lock the
- // suspend_lock to start suspending.
- art::MutexLock mu(self, *art::Locks::user_code_suspension_lock_);
- {
- // The JVMTI spec requires us to return THREAD_NOT_SUSPENDED if it is alive but we really cannot
- // tell why resume failed.
- art::MutexLock thread_list_mu(self, *art::Locks::thread_suspend_count_lock_);
- if (target->GetUserCodeSuspendCount() == 0) {
- return ERR(THREAD_NOT_SUSPENDED);
+ // Retry until we know we won't get suspended by user code while resuming something.
+ do {
+ SuspendCheck(self);
+ art::MutexLock ucsl_mu(self, *art::Locks::user_code_suspension_lock_);
+ {
+ art::MutexLock tscl_mu(self, *art::Locks::thread_suspend_count_lock_);
+ // Make sure we won't be suspended in the middle of holding the thread_suspend_count_lock_ by
+ // a user-code suspension. We retry and do another SuspendCheck to clear this.
+ if (self->GetUserCodeSuspendCount() != 0) {
+ continue;
+ }
}
- }
- if (target->GetState() == art::ThreadState::kTerminated) {
- return ERR(THREAD_NOT_ALIVE);
- }
- DCHECK(target != self);
- if (!art::Runtime::Current()->GetThreadList()->Resume(target, art::SuspendReason::kForUserCode)) {
- // TODO Give a better error.
- // This is most likely THREAD_NOT_SUSPENDED but we cannot really be sure.
- return ERR(INTERNAL);
- }
- return OK;
+ // From now on we know we cannot get suspended by user-code.
+ {
+ // NB This does a SuspendCheck (during thread state change) so we need to make sure we don't
+ // have the 'suspend_lock' locked here.
+ art::ScopedObjectAccess soa(self);
+ art::MutexLock tll_mu(self, *art::Locks::thread_list_lock_);
+ target = GetNativeThread(thread, soa);
+ if (target == nullptr) {
+ return ERR(INVALID_THREAD);
+ } else if (target == self) {
+ // We would have paused until we aren't suspended anymore due to the ScopedObjectAccess so
+ // we can just return THREAD_NOT_SUSPENDED. Unfortunately we cannot do any real DCHECKs
+ // about current state since it's all concurrent.
+ return ERR(THREAD_NOT_SUSPENDED);
+ } else if (target->GetState() == art::ThreadState::kTerminated) {
+ return ERR(THREAD_NOT_ALIVE);
+ }
+ // The JVMTI spec requires us to return THREAD_NOT_SUSPENDED if it is alive but we really
+ // cannot tell why resume failed.
+ {
+ art::MutexLock thread_suspend_count_mu(self, *art::Locks::thread_suspend_count_lock_);
+ if (target->GetUserCodeSuspendCount() == 0) {
+ return ERR(THREAD_NOT_SUSPENDED);
+ }
+ }
+ }
+ // It is okay that we don't have a thread_list_lock here since we know that the thread cannot
+ // die since it is currently held suspended by a SuspendReason::kForUserCode suspend.
+ DCHECK(target != self);
+ if (!art::Runtime::Current()->GetThreadList()->Resume(target,
+ art::SuspendReason::kForUserCode)) {
+ // TODO Give a better error.
+ // This is most likely THREAD_NOT_SUSPENDED but we cannot really be sure.
+ return ERR(INTERNAL);
+ } else {
+ return OK;
+ }
+ } while (true);
}
// Suspends all the threads in the list at the same time. Getting this behavior is a little tricky
@@ -850,6 +869,7 @@ jvmtiError ThreadUtil::SuspendThreadList(jvmtiEnv* env,
for (jint i = 0; i < request_count; i++) {
{
art::ScopedObjectAccess soa(self);
+ art::MutexLock mu(self, *art::Locks::thread_list_lock_);
if (threads[i] == nullptr || GetNativeThread(threads[i], soa) == self) {
current_thread_indexes.push_back(i);
continue;
diff --git a/runtime/openjdkjvmti/ti_thread.h b/openjdkjvmti/ti_thread.h
index 083bf8d7a5..03c49d7788 100644
--- a/runtime/openjdkjvmti/ti_thread.h
+++ b/openjdkjvmti/ti_thread.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_THREAD_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_THREAD_H_
+#ifndef ART_OPENJDKJVMTI_TI_THREAD_H_
+#define ART_OPENJDKJVMTI_TI_THREAD_H_
#include "jni.h"
#include "jvmti.h"
@@ -90,7 +90,8 @@ class ThreadUtil {
static art::Thread* GetNativeThread(jthread thread,
const art::ScopedObjectAccessAlreadyRunnable& soa)
- REQUIRES_SHARED(art::Locks::mutator_lock_);
+ REQUIRES_SHARED(art::Locks::mutator_lock_)
+ REQUIRES(art::Locks::thread_list_lock_);
private:
// We need to make sure only one thread tries to suspend threads at a time so we can get the
@@ -104,9 +105,7 @@ class ThreadUtil {
// cause the thread to wake up if the thread is suspended for the debugger or gc or something.
static jvmtiError SuspendSelf(art::Thread* self)
REQUIRES(!art::Locks::mutator_lock_, !art::Locks::user_code_suspension_lock_);
- static jvmtiError SuspendOther(art::Thread* self,
- jthread target_jthread,
- const art::Thread* target)
+ static jvmtiError SuspendOther(art::Thread* self, jthread target_jthread)
REQUIRES(!art::Locks::mutator_lock_, !art::Locks::user_code_suspension_lock_);
static art::ArtField* context_class_loader_;
@@ -114,4 +113,4 @@ class ThreadUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_THREAD_H_
+#endif // ART_OPENJDKJVMTI_TI_THREAD_H_
diff --git a/runtime/openjdkjvmti/ti_threadgroup.cc b/openjdkjvmti/ti_threadgroup.cc
index c0597ad0cc..c0597ad0cc 100644
--- a/runtime/openjdkjvmti/ti_threadgroup.cc
+++ b/openjdkjvmti/ti_threadgroup.cc
diff --git a/runtime/openjdkjvmti/ti_threadgroup.h b/openjdkjvmti/ti_threadgroup.h
index c3a0ff5e15..49115664d5 100644
--- a/runtime/openjdkjvmti/ti_threadgroup.h
+++ b/openjdkjvmti/ti_threadgroup.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_THREADGROUP_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_THREADGROUP_H_
+#ifndef ART_OPENJDKJVMTI_TI_THREADGROUP_H_
+#define ART_OPENJDKJVMTI_TI_THREADGROUP_H_
#include "jni.h"
#include "jvmti.h"
@@ -57,4 +57,4 @@ class ThreadGroupUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_THREADGROUP_H_
+#endif // ART_OPENJDKJVMTI_TI_THREADGROUP_H_
diff --git a/runtime/openjdkjvmti/ti_timers.cc b/openjdkjvmti/ti_timers.cc
index 24fb0419ee..24fb0419ee 100644
--- a/runtime/openjdkjvmti/ti_timers.cc
+++ b/openjdkjvmti/ti_timers.cc
diff --git a/runtime/openjdkjvmti/ti_timers.h b/openjdkjvmti/ti_timers.h
index 6300678ff7..892205aef4 100644
--- a/runtime/openjdkjvmti/ti_timers.h
+++ b/openjdkjvmti/ti_timers.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TI_TIMERS_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TI_TIMERS_H_
+#ifndef ART_OPENJDKJVMTI_TI_TIMERS_H_
+#define ART_OPENJDKJVMTI_TI_TIMERS_H_
#include "jni.h"
#include "jvmti.h"
@@ -48,4 +48,4 @@ class TimerUtil {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TI_TIMERS_H_
+#endif // ART_OPENJDKJVMTI_TI_TIMERS_H_
diff --git a/runtime/openjdkjvmti/transform.cc b/openjdkjvmti/transform.cc
index 1d7f137f2b..1d7f137f2b 100644
--- a/runtime/openjdkjvmti/transform.cc
+++ b/openjdkjvmti/transform.cc
diff --git a/runtime/openjdkjvmti/transform.h b/openjdkjvmti/transform.h
index ed24068bb2..6bbe60a91f 100644
--- a/runtime/openjdkjvmti/transform.h
+++ b/openjdkjvmti/transform.h
@@ -29,8 +29,8 @@
* questions.
*/
-#ifndef ART_RUNTIME_OPENJDKJVMTI_TRANSFORM_H_
-#define ART_RUNTIME_OPENJDKJVMTI_TRANSFORM_H_
+#ifndef ART_OPENJDKJVMTI_TRANSFORM_H_
+#define ART_OPENJDKJVMTI_TRANSFORM_H_
#include <string>
@@ -65,5 +65,5 @@ class Transformer {
} // namespace openjdkjvmti
-#endif // ART_RUNTIME_OPENJDKJVMTI_TRANSFORM_H_
+#endif // ART_OPENJDKJVMTI_TRANSFORM_H_
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 952f8bf0c3..d534542e3c 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -625,7 +625,3 @@ art_cc_test {
"libvixld-arm64",
],
}
-
-subdirs = [
- "openjdkjvmti",
-]
diff --git a/runtime/instrumentation.h b/runtime/instrumentation.h
index b8ea59725d..9969489648 100644
--- a/runtime/instrumentation.h
+++ b/runtime/instrumentation.h
@@ -461,8 +461,7 @@ class Instrumentation {
// This is used by the debugger to cause a deoptimization of the thread's stack after updating
// local variable(s).
void InstrumentThreadStack(Thread* thread)
- REQUIRES_SHARED(Locks::mutator_lock_)
- REQUIRES(!Locks::thread_list_lock_);
+ REQUIRES_SHARED(Locks::mutator_lock_);
static size_t ComputeFrameId(Thread* self,
size_t frame_depth,
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index a030a51473..59373eb34e 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -1600,7 +1600,7 @@ OatQuickMethodHeader* JitCodeCache::LookupMethodHeader(uintptr_t pc, ArtMethod*
// is the one we expect. We change to the non-obsolete versions in the error message since the
// obsolete version of the method might not be fully initialized yet. This situation can only
// occur when we are in the process of allocating and setting up obsolete methods. Otherwise
- // method and it->second should be identical. (See runtime/openjdkjvmti/ti_redefine.cc for more
+ // method and it->second should be identical. (See openjdkjvmti/ti_redefine.cc for more
// information.)
DCHECK_EQ(it->second->GetNonObsoleteMethod(), method->GetNonObsoleteMethod())
<< ArtMethod::PrettyMethod(method->GetNonObsoleteMethod()) << " "
diff --git a/test/ti-agent/jvmti_helper.cc b/test/ti-agent/jvmti_helper.cc
index 0d5cb39985..7280102c6f 100644
--- a/test/ti-agent/jvmti_helper.cc
+++ b/test/ti-agent/jvmti_helper.cc
@@ -58,7 +58,7 @@ static const jvmtiCapabilities standard_caps = {
.can_get_line_numbers = 1,
.can_get_source_debug_extension = 1,
.can_access_local_variables = 0,
- .can_maintain_original_method_order = 0,
+ .can_maintain_original_method_order = 1,
.can_generate_single_step_events = 1,
.can_generate_exception_events = 0,
.can_generate_frame_pop_events = 0,
diff --git a/tools/art b/tools/art
index bc0c85e2b8..18c5c84ed0 100644
--- a/tools/art
+++ b/tools/art
@@ -17,7 +17,6 @@
# Android (e.g. mksh).
# Globals
-ARCHS={arm,arm64,mips,mips64,x86,x86_64}
ART_BINARY=dalvikvm
DELETE_ANDROID_DATA="no"
LAUNCH_WRAPPER=
@@ -120,26 +119,31 @@ function verbose_run() {
env "$@"
}
+# Attempt to find $ANDROID_ROOT/framework/<isa>/core.art' without knowing what <isa> is.
+function check_if_boot_image_file_exists() {
+ local image_location_dir="$1"
+ local image_location_name="$2"
+
+ # Expand image_files to a list of existing image files on the disk.
+ # If no such files exist, it expands to single element 'dir/*/file' with a literal '*'.
+ local image_files
+ image_files=("$image_location_dir"/*/"$image_location_name") # avoid treating "*" as literal.
+
+ # Array always has at least 1 element. Test explicitly whether the file exists.
+ [[ -e "${image_files[0]}" ]]
+}
+
# Automatically find the boot image location. It uses core.art by default.
# On a real device, it might only have a boot.art, so use that instead when core.art does not exist.
function detect_boot_image_location() {
local image_location_dir="$ANDROID_ROOT/framework"
local image_location_name="core.art"
- local maybe_arch
- local core_image_exists="false"
-
- # Parse ARCHS={a,b,c,d} syntax.
- local array
- IFS=, read -a array <<< "${ARCHS:1:(-1)}";
- for maybe_arch in "${array[@]}"; do
- if [[ -e "$image_location_dir/$maybe_arch/$image_location_name" ]]; then
- core_image_exists="true"
- break
- fi
- done
-
- if [[ "$core_image_exists" == "false" ]]; then
+ # If there are no existing core.art, try to find boot.art.
+ # If there is no boot.art then leave it as-is, assumes -Ximage is explicitly used.
+ # Otherwise let dalvikvm give the error message about an invalid image file.
+ if ! check_if_boot_image_file_exists "$image_location_dir" "core.art" && \
+ check_if_boot_image_file_exists "$image_location_dir" "boot.art"; then
image_location_name="boot.art"
fi
@@ -251,7 +255,7 @@ if [ "$ANDROID_DATA" = "/data" ] || [ "$ANDROID_DATA" = "" ]; then
# by default.
ANDROID_DATA="$ANDROID_DATA/local/tmp/android-data$$"
fi
- mkdir -p $ANDROID_DATA/dalvik-cache/$ARCHS
+ mkdir -p "$ANDROID_DATA"
DELETE_ANDROID_DATA="yes"
fi
@@ -264,7 +268,7 @@ if [ "$JIT_PROFILE" = "yes" ]; then
# Create the profile. The runtime expects profiles to be created before
# execution.
PROFILE_PATH="$ANDROID_DATA/primary.prof"
- touch $PROFILE_PATH
+ touch "$PROFILE_PATH"
# Replace the compiler filter with quicken so that we
# can capture the profile.
@@ -282,13 +286,15 @@ if [ "$JIT_PROFILE" = "yes" ]; then
EXIT_STATUS=$?
if [ $EXIT_STATUS != 0 ]; then
- cat "$ANDROID_DATA/profile_gen.log"
+ echo "Profile run failed: " >&2
+ cat "$ANDROID_DATA/profile_gen.log" >&2
clean_android_data
exit $EXIT_STATUS
fi
- # Wipe dalvik-cache to prepare it for the next invocation.
- rm -rf $ANDROID_DATA/dalvik-cache/$ARCHS/*
+ # Wipe dalvik-cache so that a subsequent run_art must regenerate it.
+ # Leave $ANDROID_DATA intact since it contains our profile file.
+ rm -rf "$ANDROID_DATA/dalvik-cache"
# Append arguments so next invocation of run_art uses the profile.
EXTRA_OPTIONS+=(-Xcompiler-option --profile-file="$PROFILE_PATH")
diff --git a/tools/cpplint_presubmit.py b/tools/cpplint_presubmit.py
index 478151736f..b42a6913dc 100755
--- a/tools/cpplint_presubmit.py
+++ b/tools/cpplint_presubmit.py
@@ -21,7 +21,7 @@ import pathlib
import subprocess
import sys
-IGNORED_FILES = {"runtime/elf.h", "runtime/openjdkjvmti/include/jvmti.h"}
+IGNORED_FILES = {"runtime/elf.h", "openjdkjvmti/include/jvmti.h"}
INTERESTING_SUFFIXES = {".h", ".cc"}