summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Brian Carlstrom <bdc@google.com> 2015-10-07 21:29:28 -0700
committer Brian Carlstrom <bdc@google.com> 2015-10-07 22:04:43 -0700
commiteaa4609574267771f2080cbaa3dbe26da709b6f6 (patch)
treef1d44562808c89b615929e130adf2b1a0b9cad1b
parent7f9558eea5ffae184556ac13b93edf48371b41f8 (diff)
Fix monitor contention logging to support negative line numbers
Bug: 24743369 Change-Id: I8dd4f59e0bd27aa4daa1d79a412fc7821c070c67
-rw-r--r--runtime/monitor.cc4
-rw-r--r--runtime/monitor.h4
-rw-r--r--runtime/monitor_android.cc4
-rw-r--r--runtime/monitor_linux.cc2
4 files changed, 7 insertions, 7 deletions
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index fa5841882e..cb7df04ec1 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -274,7 +274,7 @@ void Monitor::Lock(Thread* self) {
}
if (sample_percent != 0 && (static_cast<uint32_t>(rand() % 100) < sample_percent)) {
const char* owners_filename;
- uint32_t owners_line_number;
+ int32_t owners_line_number;
TranslateLocation(owners_method, owners_dex_pc, &owners_filename, &owners_line_number);
if (wait_ms > kLongWaitMs && owners_method != nullptr) {
LOG(WARNING) << "Long monitor contention event with owner method="
@@ -1084,7 +1084,7 @@ bool Monitor::IsLocked() SHARED_REQUIRES(Locks::mutator_lock_) {
}
void Monitor::TranslateLocation(ArtMethod* method, uint32_t dex_pc,
- const char** source_file, uint32_t* line_number) const {
+ const char** source_file, int32_t* line_number) const {
// If method is null, location is unknown
if (method == nullptr) {
*source_file = "";
diff --git a/runtime/monitor.h b/runtime/monitor.h
index 8cd93c69d7..256b3999bc 100644
--- a/runtime/monitor.h
+++ b/runtime/monitor.h
@@ -179,7 +179,7 @@ class Monitor {
NO_THREAD_SAFETY_ANALYSIS; // For m->Install(self)
void LogContentionEvent(Thread* self, uint32_t wait_ms, uint32_t sample_percent,
- const char* owner_filename, uint32_t owner_line_number)
+ const char* owner_filename, int32_t owner_line_number)
SHARED_REQUIRES(Locks::mutator_lock_);
static void FailedUnlock(mirror::Object* obj, Thread* expected_owner, Thread* found_owner,
@@ -231,7 +231,7 @@ class Monitor {
// Translates the provided method and pc into its declaring class' source file and line number.
void TranslateLocation(ArtMethod* method, uint32_t pc,
- const char** source_file, uint32_t* line_number) const
+ const char** source_file, int32_t* line_number) const
SHARED_REQUIRES(Locks::mutator_lock_);
uint32_t GetOwnerThreadId() REQUIRES(!monitor_lock_);
diff --git a/runtime/monitor_android.cc b/runtime/monitor_android.cc
index efe2e823d9..82ef2d841a 100644
--- a/runtime/monitor_android.cc
+++ b/runtime/monitor_android.cc
@@ -50,7 +50,7 @@ static char* EventLogWriteString(char* dst, const char* value, size_t len) {
}
void Monitor::LogContentionEvent(Thread* self, uint32_t wait_ms, uint32_t sample_percent,
- const char* owner_filename, uint32_t owner_line_number) {
+ const char* owner_filename, int32_t owner_line_number) {
// Emit the event list length, 1 byte.
char eventBuffer[174];
char* cp = eventBuffer;
@@ -80,7 +80,7 @@ void Monitor::LogContentionEvent(Thread* self, uint32_t wait_ms, uint32_t sample
uint32_t pc;
ArtMethod* m = self->GetCurrentMethod(&pc);
const char* filename;
- uint32_t line_number;
+ int32_t line_number;
TranslateLocation(m, pc, &filename, &line_number);
cp = EventLogWriteString(cp, filename, strlen(filename));
diff --git a/runtime/monitor_linux.cc b/runtime/monitor_linux.cc
index 856ebe45f9..1c77ac0eb3 100644
--- a/runtime/monitor_linux.cc
+++ b/runtime/monitor_linux.cc
@@ -18,7 +18,7 @@
namespace art {
-void Monitor::LogContentionEvent(Thread*, uint32_t, uint32_t, const char*, uint32_t) {
+void Monitor::LogContentionEvent(Thread*, uint32_t, uint32_t, const char*, int32_t) {
}
} // namespace art