Cleanup invoke's receiver handling in interpreter.
To comply with a moving collector, we used to load invoke's receiver (for non
static methods only) from the caller shadow frame after resolving the method
itself (in case the garbage collector is triggered inside) but before passing
invoke arguments, including loading receiver from the caller's shadow frame
into the callee's shadow frame. Therefore, we used to load the receiver 3 times
in the fast path but only twice in the slow path.
The slow path is rarely used (only in method requiring extra runtime checks) so
we now move this extra reload to the slow path. Therefore an invoke using the
fast path loads the receiver twice while the slow path loads it 3 times.
I don't expect much improvement here. The main reason is to keep extra code in
the slow path.
Change-Id: I10e96b10de4b8c2992e276bd564bc3e2f191779c
diff --git a/runtime/stack.h b/runtime/stack.h
index 3d6b06a..590f406 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -160,7 +160,7 @@
<< ") is in protected space, reference array " << true;
}
// If the vreg reference is not equal to the vreg then the vreg reference is stale.
- if (reinterpret_cast<uint32_t>(ref) != vregs_[i]) {
+ if (UNLIKELY(reinterpret_cast<uint32_t>(ref) != vregs_[i])) {
return nullptr;
}
return ref;