diff options
| author | 2013-01-09 21:31:37 +0800 | |
|---|---|---|
| committer | 2013-01-09 22:19:23 +0800 | |
| commit | dc5daa0db249f8cfb8290bc8f7068cb2a0383393 (patch) | |
| tree | d8cafc924aa1c0d6a91ded76685828565400464a /src/compiler/codegen | |
| parent | 162fd33474038f0de0388338ca007ecf400bb3df (diff) | |
Fix portable path.
Change-Id: Ie5d64bd851a6ad55d4eef051704916c8318fa2f9
Diffstat (limited to 'src/compiler/codegen')
| -rw-r--r-- | src/compiler/codegen/codegen_util.cc | 6 | ||||
| -rw-r--r-- | src/compiler/codegen/gen_common.cc | 10 | ||||
| -rw-r--r-- | src/compiler/codegen/gen_invoke.cc | 6 | ||||
| -rw-r--r-- | src/compiler/codegen/mir_to_gbc.cc | 71 |
4 files changed, 51 insertions, 42 deletions
diff --git a/src/compiler/codegen/codegen_util.cc b/src/compiler/codegen/codegen_util.cc index 77a2269aaf..389a41380f 100644 --- a/src/compiler/codegen/codegen_util.cc +++ b/src/compiler/codegen/codegen_util.cc @@ -34,9 +34,9 @@ bool FastInstance(CompilationUnit* cu, uint32_t field_idx, int& field_offset, bool& is_volatile, bool is_put) { OatCompilationUnit m_unit(cu->class_loader, cu->class_linker, - *cu->dex_file, - cu->code_item, cu->method_idx, - cu->access_flags); + *cu->dex_file, cu->code_item, + cu->class_def_idx, cu->method_idx, + cu->access_flags); return cu->compiler->ComputeInstanceFieldInfo(field_idx, &m_unit, field_offset, is_volatile, is_put); } diff --git a/src/compiler/codegen/gen_common.cc b/src/compiler/codegen/gen_common.cc index 275aee5a68..57cf2a5597 100644 --- a/src/compiler/codegen/gen_common.cc +++ b/src/compiler/codegen/gen_common.cc @@ -370,8 +370,8 @@ void Codegen::GenSput(CompilationUnit* cu, uint32_t field_idx, RegLocation rl_sr bool is_volatile; bool is_referrers_class; - OatCompilationUnit m_unit(cu->class_loader, cu->class_linker, *cu->dex_file, - cu->code_item, cu->method_idx, cu->access_flags); + OatCompilationUnit m_unit(cu->class_loader, cu->class_linker, *cu->dex_file, cu->code_item, + cu->class_def_idx, cu->method_idx, cu->access_flags); bool fast_path = cu->compiler->ComputeStaticFieldInfo(field_idx, &m_unit, @@ -463,9 +463,9 @@ void Codegen::GenSget(CompilationUnit* cu, uint32_t field_idx, RegLocation rl_de bool is_referrers_class; OatCompilationUnit m_unit(cu->class_loader, cu->class_linker, - *cu->dex_file, - cu->code_item, cu->method_idx, - cu->access_flags); + *cu->dex_file, cu->code_item, + cu->class_def_idx, cu->method_idx, + cu->access_flags); bool fast_path = cu->compiler->ComputeStaticFieldInfo(field_idx, &m_unit, diff --git a/src/compiler/codegen/gen_invoke.cc b/src/compiler/codegen/gen_invoke.cc index f35415259f..a1537191e1 100644 --- a/src/compiler/codegen/gen_invoke.cc +++ b/src/compiler/codegen/gen_invoke.cc @@ -1219,9 +1219,9 @@ void Codegen::GenInvoke(CompilationUnit* cu, CallInfo* info) LockCallTemps(cu); OatCompilationUnit m_unit(cu->class_loader, cu->class_linker, - *cu->dex_file, - cu->code_item, cu->method_idx, - cu->access_flags); + *cu->dex_file, cu->code_item, + cu->class_def_idx, cu->method_idx, + cu->access_flags); uint32_t dex_method_idx = info->index; int vtable_idx; diff --git a/src/compiler/codegen/mir_to_gbc.cc b/src/compiler/codegen/mir_to_gbc.cc index 766a630a0c..e38977ad10 100644 --- a/src/compiler/codegen/mir_to_gbc.cc +++ b/src/compiler/codegen/mir_to_gbc.cc @@ -53,15 +53,13 @@ static llvm::Value* GetLLVMValue(CompilationUnit* cu, int s_reg) static void SetVregOnValue(CompilationUnit* cu, llvm::Value* val, int s_reg) { // Set vreg for debugging - if (cu->compiler->IsDebuggingSupported()) { - greenland::IntrinsicHelper::IntrinsicId id = - greenland::IntrinsicHelper::SetVReg; - llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction(id); - int v_reg = SRegToVReg(cu, s_reg); - llvm::Value* table_slot = cu->irb->getInt32(v_reg); - llvm::Value* args[] = { table_slot, val }; - cu->irb->CreateCall(func, args); - } + greenland::IntrinsicHelper::IntrinsicId id = + greenland::IntrinsicHelper::SetVReg; + llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction(id); + int v_reg = SRegToVReg(cu, s_reg); + llvm::Value* table_slot = cu->irb->getInt32(v_reg); + llvm::Value* args[] = { table_slot, val }; + cu->irb->CreateCall(func, args); } // Replace the placeholder value with the real definition @@ -1799,33 +1797,44 @@ static bool BlockBitcodeConversion(CompilationUnit* cu, BasicBlock* bb) if (bb->block_type == kEntryBlock) { SetMethodInfo(cu); - bool *can_be_ref = static_cast<bool*>(NewMem(cu, sizeof(bool) * cu->num_dalvik_registers, - true, kAllocMisc)); - for (int i = 0; i < cu->num_ssa_regs; i++) { - int v_reg = SRegToVReg(cu, i); - if (v_reg > SSA_METHOD_BASEREG) { - can_be_ref[SRegToVReg(cu, i)] |= cu->reg_location[i].ref; - } + + { // Allocate shadowframe. + greenland::IntrinsicHelper::IntrinsicId id = + greenland::IntrinsicHelper::AllocaShadowFrame; + llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction(id); + llvm::Value* entries = cu->irb->getInt32(cu->num_dalvik_registers); + cu->irb->CreateCall(func, entries); } - for (int i = 0; i < cu->num_dalvik_registers; i++) { - if (can_be_ref[i]) { - cu->num_shadow_frame_entries++; + + { // Store arguments to vregs. + uint16_t arg_reg = cu->num_regs; + + llvm::Function::arg_iterator arg_iter(cu->func->arg_begin()); + llvm::Function::arg_iterator arg_end(cu->func->arg_end()); + + const char* shorty = cu->shorty; + uint32_t shorty_size = strlen(shorty); + CHECK_GE(shorty_size, 1u); + + ++arg_iter; // skip method object + + if ((cu->access_flags & kAccStatic) == 0) { + SetVregOnValue(cu, arg_iter, arg_reg); + ++arg_iter; + ++arg_reg; } - } - if (cu->num_shadow_frame_entries > 0) { - cu->shadow_map = static_cast<int*>(NewMem(cu, sizeof(int) * cu->num_shadow_frame_entries, - true, kAllocMisc)); - for (int i = 0, j = 0; i < cu->num_dalvik_registers; i++) { - if (can_be_ref[i]) { - cu->shadow_map[j++] = i; + + for (uint32_t i = 1; i < shorty_size; ++i, ++arg_iter) { + SetVregOnValue(cu, arg_iter, arg_reg); + + ++arg_reg; + if (shorty[i] == 'J' || shorty[i] == 'D') { + // Wide types, such as long and double, are using a pair of registers + // to store the value, so we have to increase arg_reg again. + ++arg_reg; } } } - greenland::IntrinsicHelper::IntrinsicId id = - greenland::IntrinsicHelper::AllocaShadowFrame; - llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction(id); - llvm::Value* entries = cu->irb->getInt32(cu->num_shadow_frame_entries); - cu->irb->CreateCall(func, entries); } else if (bb->block_type == kExitBlock) { /* * Because of the differences between how MIR/LIR and llvm handle exit |