summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2013-11-12 17:03:02 -0800
committerMathieu Chartier <mathieuc@google.com>2013-11-12 17:03:02 -0800
commit46bc778f1feed02b20d25e3d03470c93ca2c0506 (patch)
treeac760c321039cd8a5e78ae766accf4dc3ddb194b
parent0b74e3acc2fd35d95ac55c4ee2ffe5c651229ed8 (diff)
downloadart-46bc778f1feed02b20d25e3d03470c93ca2c0506.zip
art-46bc778f1feed02b20d25e3d03470c93ca2c0506.tar.gz
art-46bc778f1feed02b20d25e3d03470c93ca2c0506.tar.bz2
Fix portable + mips build.
Change-Id: Ia200e582b04c84973281e12331777351feb8a401
-rw-r--r--compiler/elf_writer_mclinker.cc5
-rw-r--r--runtime/base/mutex.h5
-rw-r--r--runtime/globals.h8
-rw-r--r--runtime/monitor.cc5
-rw-r--r--runtime/monitor.h3
5 files changed, 17 insertions, 9 deletions
diff --git a/compiler/elf_writer_mclinker.cc b/compiler/elf_writer_mclinker.cc
index 8e19ef6..f3fef23 100644
--- a/compiler/elf_writer_mclinker.cc
+++ b/compiler/elf_writer_mclinker.cc
@@ -358,10 +358,11 @@ void ElfWriterMclinker::FixupOatMethodOffsets(const std::vector<const DexFile*>&
mirror::ArtMethod* method = NULL;
if (compiler_driver_->IsImage()) {
ClassLinker* linker = Runtime::Current()->GetClassLinker();
- mirror::DexCache* dex_cache = linker->FindDexCache(dex_file);
// Unchecked as we hold mutator_lock_ on entry.
ScopedObjectAccessUnchecked soa(Thread::Current());
- method = linker->ResolveMethod(dex_file, method_idx, dex_cache, NULL, NULL, invoke_type);
+ SirtRef<mirror::DexCache> dex_cache(soa.Self(), linker->FindDexCache(dex_file));
+ SirtRef<mirror::ClassLoader> class_loader(soa.Self(), nullptr);
+ method = linker->ResolveMethod(dex_file, method_idx, dex_cache, class_loader, NULL, invoke_type);
CHECK(method != NULL);
}
const CompiledMethod* compiled_method =
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h
index a875017..feb8a6c 100644
--- a/runtime/base/mutex.h
+++ b/runtime/base/mutex.h
@@ -329,11 +329,6 @@ class ConditionVariable {
// TODO: remove this.
void WaitHoldingLocks(Thread* self) NO_THREAD_SAFETY_ANALYSIS;
- // Return the number of people that are waiting on this condition.
- int32_t GetNumWaiters() const NO_THREAD_SAFETY_ANALYSIS {
- return num_waiters_;
- }
-
private:
const char* const name_;
// The Mutex being used by waiters. It is an error to mix condition variables between different
diff --git a/runtime/globals.h b/runtime/globals.h
index 10426b0..1a25dfa 100644
--- a/runtime/globals.h
+++ b/runtime/globals.h
@@ -73,8 +73,14 @@ const bool kIsTargetBuild = true;
const bool kIsTargetBuild = false;
#endif
+#if defined(ART_USE_PORTABLE_COMPILER)
+constexpr bool kUsePortableCompiler = true;
+#else
+constexpr bool kUsePortableCompiler = false;
+#endif
+
// Garbage collector constants.
-static constexpr bool kMovingCollector = false;
+static constexpr bool kMovingCollector = false && !kUsePortableCompiler;
// True if we allow moving classes.
static constexpr bool kMovingClasses = false;
// True if we allow moving fields.
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index 7fada9e..af93a56 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -82,6 +82,7 @@ void Monitor::Init(uint32_t lock_profiling_threshold, bool (*is_sensitive_thread
Monitor::Monitor(Thread* owner, mirror::Object* obj, int32_t hash_code)
: monitor_lock_("a monitor lock", kMonitorLock),
monitor_contenders_("monitor contenders", monitor_lock_),
+ num_waiters_(0),
owner_(owner),
lock_count_(0),
obj_(obj),
@@ -225,7 +226,9 @@ void Monitor::Lock(Thread* self) {
ScopedThreadStateChange tsc(self, kBlocked); // Change to blocked and give up mutator_lock_.
MutexLock mu2(self, monitor_lock_); // Reacquire monitor_lock_ without mutator_lock_ for Wait.
if (owner_ != NULL) { // Did the owner_ give the lock up?
+ ++num_waiters_;
monitor_contenders_.Wait(self); // Still contended so wait.
+ --num_waiters_;
// Woken from contention.
if (log_contention) {
uint64_t wait_ms = MilliTime() - wait_start_ms;
@@ -581,7 +584,7 @@ bool Monitor::Deflate(Thread* self, mirror::Object* obj) {
return false;
}
// Can't deflate if we have anybody waiting on the CV.
- if (monitor->monitor_contenders_.GetNumWaiters() > 0) {
+ if (monitor->num_waiters_ > 0) {
return false;
}
// Deflate to a thin lock.
diff --git a/runtime/monitor.h b/runtime/monitor.h
index d7de8a5..bfd8545 100644
--- a/runtime/monitor.h
+++ b/runtime/monitor.h
@@ -174,6 +174,9 @@ class Monitor {
Mutex monitor_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
ConditionVariable monitor_contenders_ GUARDED_BY(monitor_lock_);
+ // Number of people waiting on the condition.
+ size_t num_waiters_ GUARDED_BY(monitor_lock_);
+
// Which thread currently owns the lock?
Thread* volatile owner_ GUARDED_BY(monitor_lock_);