OSDN Git Service

ART: Check slow_paths_.Size() every time
authorChao-ying Fu <chao-ying.fu@intel.com>
Tue, 8 Jul 2014 00:13:52 +0000 (17:13 -0700)
committerMark Mendell <mark.p.mendell@intel.com>
Wed, 9 Jul 2014 18:31:42 +0000 (14:31 -0400)
This patch fixes a bug, when a new slow path is created
during slowpath->Compile().

Change-Id: I4896a82781102694c25f4483112c6de3c56e072c
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
compiler/dex/quick/gen_common.cc

index dafefea..b31e9a2 100644 (file)
@@ -766,8 +766,9 @@ void Mir2Lir::GenSget(MIR* mir, RegLocation rl_dest,
 
 // Generate code for all slow paths.
 void Mir2Lir::HandleSlowPaths() {
-  int n = slow_paths_.Size();
-  for (int i = 0; i < n; ++i) {
+  // We should check slow_paths_.Size() every time, because a new slow path
+  // may be created during slowpath->Compile().
+  for (size_t i = 0; i < slow_paths_.Size(); ++i) {
     LIRSlowPath* slowpath = slow_paths_.Get(i);
     slowpath->Compile();
   }