Merge "Compile llvm.Module into ELF object file." into dalvik-dev
diff --git a/src/monitor.cc b/src/monitor.cc
index 3efdab6..e3c98bb 100644
--- a/src/monitor.cc
+++ b/src/monitor.cc
@@ -252,7 +252,7 @@
void Monitor::FailedUnlock(Object* obj, Thread* expected_owner, Thread* found_owner,
Monitor* mon) {
// Acquire thread list lock so threads won't disappear from under us
- ScopedThreadListLock tll;
+ ScopedThreadListLock thread_list_lock;
// Re-read owner now that we hold lock
Thread* current_owner = mon != NULL ? mon->owner_ : NULL;
if (current_owner == NULL) {
@@ -323,7 +323,7 @@
/*
* Converts the given relative waiting time into an absolute time.
*/
-void ToAbsoluteTime(int64_t ms, int32_t ns, struct timespec *ts) {
+static void ToAbsoluteTime(int64_t ms, int32_t ns, struct timespec *ts) {
int64_t endSec;
#ifdef HAVE_TIMEDWAIT_MONOTONIC
@@ -351,18 +351,6 @@
}
}
-int dvmRelativeCondWait(pthread_cond_t* cond, pthread_mutex_t* mutex, int64_t ms, int32_t ns) {
- struct timespec ts;
- ToAbsoluteTime(ms, ns, &ts);
-#if defined(HAVE_TIMEDWAIT_MONOTONIC)
- int rc = pthread_cond_timedwait_monotonic(cond, mutex, &ts);
-#else
- int rc = pthread_cond_timedwait(cond, mutex, &ts);
-#endif
- DCHECK(rc == 0 || rc == ETIMEDOUT);
- return rc;
-}
-
/*
* Wait on a monitor until timeout, interrupt, or notification. Used for
* Object.wait() and (somewhat indirectly) Thread.sleep() and Thread.join().
diff --git a/src/monitor.h b/src/monitor.h
index a79f6ce..b949921 100644
--- a/src/monitor.h
+++ b/src/monitor.h
@@ -147,9 +147,6 @@
DISALLOW_COPY_AND_ASSIGN(MonitorList);
};
-// Relative timed wait on condition
-int dvmRelativeCondWait(pthread_cond_t* cond, pthread_mutex_t* mutex, int64_t msec, int32_t nsec);
-
} // namespace art
#endif // ART_SRC_MONITOR_H_
diff --git a/src/object.cc b/src/object.cc
index c9e0929..85a2d0a 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -473,6 +473,21 @@
return result;
}
+static const void* GetOatCode(const Method* m) {
+ Runtime* runtime = Runtime::Current();
+ const void* code = m->GetCode();
+ // Peel off any method tracing trampoline.
+ if (runtime->IsMethodTracingActive() && runtime->GetTracer()->GetSavedCodeFromMap(m) != NULL) {
+ code = runtime->GetTracer()->GetSavedCodeFromMap(m);
+ }
+ // Peel off any resolution stub.
+ if (code == runtime->GetResolutionStubArray(Runtime::kStaticMethod)->GetData() ||
+ code == runtime->GetResolutionStubArray(Runtime::kInstanceMethod)->GetData()) {
+ code = runtime->GetClassLinker()->GetOatCodeFor(m);
+ }
+ return code;
+}
+
uint32_t Method::ToDexPC(const uintptr_t pc) const {
const uint32_t* mapping_table = GetMappingTable();
if (mapping_table == NULL) {
@@ -480,19 +495,7 @@
return DexFile::kDexNoIndex; // Special no mapping case
}
size_t mapping_table_length = GetMappingTableLength();
- const void* code_offset;
- Runtime* runtime = Runtime::Current();
- if (runtime->IsMethodTracingActive() &&
- runtime->GetTracer()->GetSavedCodeFromMap(this) != NULL) {
- code_offset = runtime->GetTracer()->GetSavedCodeFromMap(this);
- } else {
- code_offset = GetCode();
- }
- if (code_offset == runtime->GetResolutionStubArray(Runtime::kStaticMethod)->GetData() ||
- code_offset == runtime->GetResolutionStubArray(Runtime::kInstanceMethod)->GetData()) {
- code_offset = runtime->GetClassLinker()->GetOatCodeFor(this);
- }
- uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(code_offset);
+ uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(GetOatCode(this));
uint32_t best_offset = 0;
uint32_t best_dex_offset = 0;
for (size_t i = 0; i < mapping_table_length; i += 2) {
@@ -522,12 +525,7 @@
uint32_t map_offset = mapping_table[i];
uint32_t map_dex_offset = mapping_table[i + 1];
if (map_dex_offset == dex_pc) {
- if (Runtime::Current()->IsMethodTracingActive()) {
- Trace* tracer = Runtime::Current()->GetTracer();
- return reinterpret_cast<uintptr_t>(tracer->GetSavedCodeFromMap(this)) + map_offset;
- } else {
- return reinterpret_cast<uintptr_t>(GetCode()) + map_offset;
- }
+ return reinterpret_cast<uintptr_t>(GetOatCode(this)) + map_offset;
}
}
LOG(FATAL) << "Looking up Dex PC not contained in method";
diff --git a/src/runtime_support_arm.S b/src/runtime_support_arm.S
index 18f2ae3..3ee4dea 100644
--- a/src/runtime_support_arm.S
+++ b/src/runtime_support_arm.S
@@ -95,7 +95,7 @@
.global art_deliver_exception_from_code
/*
- * Called by managed code, saves mosts registers (forms basis of long jump context) and passes
+ * Called by managed code, saves most registers (forms basis of long jump context) and passes
* the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at
* the bottom of the thread. On entry r0 holds Throwable*
*/
diff --git a/test/084-class-init/src/Main.java b/test/084-class-init/src/Main.java
index de28ed9..4ca2dbc 100644
--- a/test/084-class-init/src/Main.java
+++ b/test/084-class-init/src/Main.java
@@ -15,6 +15,25 @@
*/
public class Main {
+ static {
+ staticMethod();
+ }
+
+ private static void staticMethod() {
+ // Test that DeliverException works when the handler -- this method -- is currently a
+ // resolution stub because it's running on behalf of <clinit>.
+ try {
+ throwDuringClinit();
+ System.err.println("didn't throw!");
+ } catch (NullPointerException ex) {
+ System.out.println("caught exception thrown during clinit");
+ }
+ }
+
+ private static void throwDuringClinit() {
+ throw new NullPointerException();
+ }
+
public static void main(String[] args) {
checkExceptions();
checkTiming();