OSDN Git Service

Quick compiler: fix Arm64 inline locking code
authorbuzbee <buzbee@google.com>
Tue, 19 Aug 2014 23:47:06 +0000 (16:47 -0700)
committerbuzbee <buzbee@google.com>
Wed, 20 Aug 2014 00:40:22 +0000 (17:40 -0700)
The Arm64 monitor enter code was incorrectly comparing the
thread ID to zero rather than the lock value to determine if the
inline fast path was doable.  As a result, we ended up always
using the out-of-line case.

This fix delivers a 6% improvement to DeltaBlue.

b/16707253

Change-Id: I499530da84beecf1f3f5c5ebb666e3eb12599ac0

compiler/dex/quick/arm64/call_arm64.cc

index 0538c31..eddc3a3 100644 (file)
@@ -208,9 +208,9 @@ void Arm64Mir2Lir::GenMonitorEnter(int opt_flags, RegLocation rl_src) {
   OpRegRegImm(kOpAdd, rs_x2, rs_x0, mirror::Object::MonitorOffset().Int32Value());
   NewLIR2(kA64Ldxr2rX, rw3, rx2);
   MarkPossibleNullPointerException(opt_flags);
-  LIR* not_unlocked_branch = OpCmpImmBranch(kCondNe, rs_x1, 0, NULL);
+  LIR* not_unlocked_branch = OpCmpImmBranch(kCondNe, rs_w3, 0, NULL);
   NewLIR3(kA64Stxr3wrX, rw3, rw1, rx2);
-  LIR* lock_success_branch = OpCmpImmBranch(kCondEq, rs_x1, 0, NULL);
+  LIR* lock_success_branch = OpCmpImmBranch(kCondEq, rs_w3, 0, NULL);
 
   LIR* slow_path_target = NewLIR0(kPseudoTargetLabel);
   not_unlocked_branch->target = slow_path_target;