interpreter: support for non-exact invokes.
Performs primitive argument conversions as well as boxing and unboxing
operations. Support for return value conversions will be added in a
follow up change.
Test: make test-art-host
Change-Id: I2e3348ff64a5826e477f87c12a7d5c390eb3a653
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index 7d54d0a..bdb6bd3 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -463,6 +463,24 @@
return branch_offset <= 0;
}
+// Assign register 'src_reg' from shadow_frame to register 'dest_reg' into new_shadow_frame.
+static inline void AssignRegister(ShadowFrame* new_shadow_frame, const ShadowFrame& shadow_frame,
+ size_t dest_reg, size_t src_reg)
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ // Uint required, so that sign extension does not make this wrong on 64b systems
+ uint32_t src_value = shadow_frame.GetVReg(src_reg);
+ mirror::Object* o = shadow_frame.GetVRegReference<kVerifyNone>(src_reg);
+
+ // If both register locations contains the same value, the register probably holds a reference.
+ // Note: As an optimization, non-moving collectors leave a stale reference value
+ // in the references array even after the original vreg was overwritten to a non-reference.
+ if (src_value == reinterpret_cast<uintptr_t>(o)) {
+ new_shadow_frame->SetVRegReference(dest_reg, o);
+ } else {
+ new_shadow_frame->SetVReg(dest_reg, src_value);
+ }
+}
+
void ArtInterpreterToCompiledCodeBridge(Thread* self,
ArtMethod* caller,
const DexFile::CodeItem* code_item,