Fix monitor contention logging to support negative line numbers

Bug: 24743369
Change-Id: I8dd4f59e0bd27aa4daa1d79a412fc7821c070c67
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index fa58418..cb7df04 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -274,7 +274,7 @@
           }
           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 @@
 }
 
 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 8cd93c6..256b399 100644
--- a/runtime/monitor.h
+++ b/runtime/monitor.h
@@ -179,7 +179,7 @@
       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 @@
 
   // 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 efe2e82..82ef2d8 100644
--- a/runtime/monitor_android.cc
+++ b/runtime/monitor_android.cc
@@ -50,7 +50,7 @@
 }
 
 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 @@
   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 856ebe4..1c77ac0 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