summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/codegen/codegen.h1
-rw-r--r--src/compiler/codegen/gen_invoke.cc18
-rw-r--r--src/compiler/codegen/local_optimizations.cc2
-rw-r--r--src/compiler/codegen/x86/codegen_x86.h1
-rw-r--r--src/compiler/codegen/x86/int_x86.cc1
-rw-r--r--src/thread.cc1
-rw-r--r--src/thread.h4
7 files changed, 27 insertions, 1 deletions
diff --git a/src/compiler/codegen/codegen.h b/src/compiler/codegen/codegen.h
index 06981568b8..e512803258 100644
--- a/src/compiler/codegen/codegen.h
+++ b/src/compiler/codegen/codegen.h
@@ -211,6 +211,7 @@ class Codegen {
bool GenInlinedDoubleCvt(CompilationUnit *cu, CallInfo* info);
bool GenInlinedIndexOf(CompilationUnit* cu, CallInfo* info, bool zero_based);
bool GenInlinedStringCompareTo(CompilationUnit* cu, CallInfo* info);
+ bool GenInlinedCurrentThread(CompilationUnit* cu, CallInfo* info);
bool GenIntrinsic(CompilationUnit* cu, CallInfo* info);
// Shared by all targets - implemented in gen_loadstore.cc.
diff --git a/src/compiler/codegen/gen_invoke.cc b/src/compiler/codegen/gen_invoke.cc
index 41924e228e..afaa053f95 100644
--- a/src/compiler/codegen/gen_invoke.cc
+++ b/src/compiler/codegen/gen_invoke.cc
@@ -18,6 +18,7 @@
#include "../compiler_ir.h"
#include "ralloc_util.h"
#include "codegen_util.h"
+#include "x86/codegen_x86.h"
namespace art {
@@ -1105,6 +1106,20 @@ bool Codegen::GenInlinedStringCompareTo(CompilationUnit* cu, CallInfo* info)
return true;
}
+bool Codegen::GenInlinedCurrentThread(CompilationUnit* cu, CallInfo* info) {
+ RegLocation rl_dest = InlineTarget(cu, info);
+ RegLocation rl_result = EvalLoc(cu, rl_dest, kCoreReg, true);
+ int offset = Thread::PeerOffset().Int32Value();
+ if (cu->instruction_set == kThumb2) {
+ LoadWordDisp(cu, TargetReg(kSelf), offset, rl_result.low_reg);
+ } else {
+ CHECK(cu->instruction_set == kX86);
+ ((X86Codegen*)this)->OpRegThreadMem(cu, kOpMov, rl_result.low_reg, offset);
+ }
+ StoreValue(cu, rl_dest, rl_result);
+ return true;
+}
+
bool Codegen::GenIntrinsic(CompilationUnit* cu, CallInfo* info)
{
if (info->opt_flags & MIR_INLINED) {
@@ -1172,6 +1187,9 @@ bool Codegen::GenIntrinsic(CompilationUnit* cu, CallInfo* info)
if (tgt_method == "int java.lang.String.length()") {
return GenInlinedStringIsEmptyOrLength(cu, info, false /* is_empty */);
}
+ if (tgt_method == "java.lang.Thread java.lang.Thread.currentThread()") {
+ return GenInlinedCurrentThread(cu, info);
+ }
} else if (tgt_method.find("boolean sun.misc.Unsafe.compareAndSwap") != std::string::npos) {
if (tgt_method == "boolean sun.misc.Unsafe.compareAndSwapInt(java.lang.Object, long, int, int)") {
return GenInlinedCas32(cu, info, false);
diff --git a/src/compiler/codegen/local_optimizations.cc b/src/compiler/codegen/local_optimizations.cc
index ec915f03fa..69b5d8ef36 100644
--- a/src/compiler/codegen/local_optimizations.cc
+++ b/src/compiler/codegen/local_optimizations.cc
@@ -20,7 +20,7 @@ namespace art {
#define DEBUG_OPT(X)
-/* Check RAW, WAR, and WAR dependency on the register operands */
+/* Check RAW, WAR, and RAW dependency on the register operands */
#define CHECK_REG_DEP(use, def, check) ((def & check->use_mask) || \
((use | def) & check->def_mask))
diff --git a/src/compiler/codegen/x86/codegen_x86.h b/src/compiler/codegen/x86/codegen_x86.h
index dba4953c61..4ef186a221 100644
--- a/src/compiler/codegen/x86/codegen_x86.h
+++ b/src/compiler/codegen/x86/codegen_x86.h
@@ -18,6 +18,7 @@
#define ART_SRC_COMPILER_CODEGEN_X86_CODEGENX86_H_
#include "../../compiler_internals.h"
+#include "x86_lir.h"
namespace art {
diff --git a/src/compiler/codegen/x86/int_x86.cc b/src/compiler/codegen/x86/int_x86.cc
index 190208ba12..f8e18ec9f4 100644
--- a/src/compiler/codegen/x86/int_x86.cc
+++ b/src/compiler/codegen/x86/int_x86.cc
@@ -431,6 +431,7 @@ void X86Codegen::OpRegThreadMem(CompilationUnit* cu, OpKind op, int r_dest, int
X86OpCode opcode = kX86Bkpt;
switch (op) {
case kOpCmp: opcode = kX86Cmp32RT; break;
+ case kOpMov: opcode = kX86Mov32RT; break;
default:
LOG(FATAL) << "Bad opcode: " << op;
break;
diff --git a/src/thread.cc b/src/thread.cc
index 72ceaf0be0..75d0468dab 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1636,6 +1636,7 @@ void Thread::DumpThreadOffset(std::ostream& os, uint32_t offset, size_t size_of_
DO_THREAD_OFFSET(state_and_flags_);
DO_THREAD_OFFSET(card_table_);
DO_THREAD_OFFSET(exception_);
+ DO_THREAD_OFFSET(opeer_);
DO_THREAD_OFFSET(jni_env_);
DO_THREAD_OFFSET(self_);
DO_THREAD_OFFSET(stack_end_);
diff --git a/src/thread.h b/src/thread.h
index 4c065c51fe..8b9c81d068 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -442,6 +442,10 @@ class PACKED(4) Thread {
return ThreadOffset(OFFSETOF_MEMBER(Thread, exception_));
}
+ static ThreadOffset PeerOffset() {
+ return ThreadOffset(OFFSETOF_MEMBER(Thread, opeer_));
+ }
+
static ThreadOffset ThinLockIdOffset() {
return ThreadOffset(OFFSETOF_MEMBER(Thread, thin_lock_id_));
}