From 788a0a157cb138c33882511ff09afacde99443b7 Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Thu, 14 May 2015 16:48:22 -0700 Subject: [PATCH] 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. Bug: 21036900 Change-Id: Ibd7a643d877514ea396d7e4ab0dea327207cb78f --- runtime/interpreter/interpreter_common.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index ae67efbcd..59d3008fc 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -616,16 +616,17 @@ bool DoCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame, 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); } -- 2.11.0