Fix compiler_llvm bugs.
2 bugs:
The size of new-array should be in the register.
LoadConstantString branches to the wrong, opposite label.
Change-Id: Ie6b1fab98e253a2f229d0e81fa3240dc73a1f8d2
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 2269be7..890eeab 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -1321,7 +1321,7 @@
// Test: Is the string resolved and in the dex cache?
llvm::Value* equal_null = irb_.CreateICmpEQ(string_addr, irb_.getJNull());
- irb_.CreateCondBr(equal_null, block_str_exist, block_str_resolve);
+ irb_.CreateCondBr(equal_null, block_str_resolve, block_str_exist);
// String is resolved, go to next basic block.
irb_.SetInsertPoint(block_str_exist);
@@ -1677,22 +1677,24 @@
compiler_->CanAccessTypeWithoutChecks(method_idx_, dex_cache_,
*dex_file_, type_idx);
+ llvm::Value* array_length_value;
+
if (is_filled_new_array) {
runtime_func = skip_access_check ?
irb_.GetRuntime(CheckAndAllocArray) :
irb_.GetRuntime(CheckAndAllocArrayWithAccessCheck);
+ array_length_value = irb_.getInt32(length);
} else {
runtime_func = skip_access_check ?
irb_.GetRuntime(AllocArray) :
irb_.GetRuntime(AllocArrayWithAccessCheck);
+ array_length_value = EmitLoadDalvikReg(length, kInt, kAccurate);
}
llvm::Constant* type_index_value = irb_.getInt32(type_idx);
llvm::Value* method_object_addr = EmitLoadMethodObjectAddr();
- llvm::Value* array_length_value = irb_.getInt32(length);
-
EmitUpdateLineNumFromDexPC(dex_pc);
llvm::Value* object_addr =