Fix non-range String init calls
When the String constructor was called via invoke-direct, it is changed
to the new StringFactory which is static. That means that the args need
to be shifted by one to deal with the change from non-static to static.
However, the non-range version of the invoke-direct was not shifted
correctly causing unstarted runtime initialization to get the wrong
first_dest_reg argument.
(cherry picked from commit 788a0a157cb138c33882511ff09afacde99443b7)
Bug: 21036900
Change-Id: Ibd7a643d877514ea396d7e4ab0dea327207cb78f
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index ae67efb..59d3008 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -616,16 +616,17 @@
uint16_t regList = inst->Fetch16(2);
uint16_t count = num_ins;
size_t arg_index = 0;
- if (string_init) {
- // Skip the referrer for the new static StringFactory call.
- regList >>= 4;
- ++arg_index;
- }
if (count == 5) {
AssignRegister(new_shadow_frame, shadow_frame, first_dest_reg + 4U,
(inst_data >> 8) & 0x0f);
--count;
- }
+ }
+ if (string_init) {
+ // Skip the referrer for the new static StringFactory call.
+ regList >>= 4;
+ ++first_dest_reg;
+ --count;
+ }
for (; arg_index < count; ++arg_index, regList >>= 4) {
AssignRegister(new_shadow_frame, shadow_frame, first_dest_reg + arg_index, regList & 0x0f);
}