diff options
author | 2013-02-27 16:03:41 -0800 | |
---|---|---|
committer | 2013-02-27 22:20:36 -0800 | |
commit | 76ae4fe651c77619aeeb4dd395c7ec8fc29685fc (patch) | |
tree | c9160ac0bfafe49d5b4a0c303e4767ee52b7abd3 | |
parent | 395116cae130c983498c0a2f42b89e42f75bb9d0 (diff) |
1 IR builder. Kill greenland. Remove JTypeSpace.
Change-Id: I7d08cfd8c1fec46df4ce5f51706dff2e246695b5
19 files changed, 755 insertions, 1318 deletions
diff --git a/build/Android.libart-compiler.mk b/build/Android.libart-compiler.mk index 7830f70005..fae6009a11 100644 --- a/build/Android.libart-compiler.mk +++ b/build/Android.libart-compiler.mk @@ -49,8 +49,6 @@ LIBART_COMPILER_SRC_FILES := \ src/compiler/dex/ssa_transformation.cc \ src/compiler/dex/write_elf.cc \ src/elf_writer.cc \ - src/greenland/intrinsic_helper.cc \ - src/greenland/ir_builder.cc \ src/oat/jni/arm/calling_convention_arm.cc \ src/oat/jni/arm/jni_internal_arm.cc \ src/oat/jni/calling_convention.cc \ @@ -70,6 +68,7 @@ ifeq ($(ART_USE_PORTABLE_COMPILER),true) src/compiler_llvm/compiler_llvm.cc \ src/compiler_llvm/gbc_expander.cc \ src/compiler_llvm/generated/art_module.cc \ + src/compiler_llvm/intrinsic_helper.cc \ src/compiler_llvm/ir_builder.cc \ src/compiler_llvm/jni_compiler.cc \ src/compiler_llvm/llvm_compilation_unit.cc \ diff --git a/src/compiler/dex/compiler_ir.h b/src/compiler/dex/compiler_ir.h index 246d200d16..c961d0baaf 100644 --- a/src/compiler/dex/compiler_ir.h +++ b/src/compiler/dex/compiler_ir.h @@ -23,7 +23,8 @@ #include "compiler_utility.h" #include "oat_compilation_unit.h" #include "safe_map.h" -#include "greenland/ir_builder.h" +#include "compiler_llvm/ir_builder.h" +#include "compiler_llvm/intrinsic_helper.h" #include "llvm/Module.h" #include "compiler_enums.h" @@ -510,8 +511,8 @@ struct CompilationUnit { llvm::LLVMContext* context; llvm::Module* module; llvm::Function* func; - greenland::IntrinsicHelper* intrinsic_helper; - greenland::IRBuilder* irb; + compiler_llvm::IntrinsicHelper* intrinsic_helper; + compiler_llvm::IRBuilder* irb; llvm::BasicBlock* placeholder_bb; llvm::BasicBlock* entry_bb; llvm::BasicBlock* entryTarget_bb; diff --git a/src/compiler/dex/frontend.cc b/src/compiler/dex/frontend.cc index 498600f4b2..4619052f4b 100644 --- a/src/compiler/dex/frontend.cc +++ b/src/compiler/dex/frontend.cc @@ -37,6 +37,9 @@ namespace { } namespace art { +namespace compiler_llvm { +llvm::Module* makeLLVMModuleContents(llvm::Module* module); +} LLVMInfo::LLVMInfo() { #if !defined(ART_USE_PORTABLE_COMPILER) @@ -46,8 +49,9 @@ LLVMInfo::LLVMInfo() { llvm_context_.reset(new llvm::LLVMContext()); llvm_module_ = new llvm::Module("art", *llvm_context_); llvm::StructType::create(*llvm_context_, "JavaObject"); - intrinsic_helper_.reset( new greenland::IntrinsicHelper(*llvm_context_, *llvm_module_)); - ir_builder_.reset(new greenland::IRBuilder(*llvm_context_, *llvm_module_, *intrinsic_helper_)); + compiler_llvm::makeLLVMModuleContents(llvm_module_); + intrinsic_helper_.reset( new compiler_llvm::IntrinsicHelper(*llvm_context_, *llvm_module_)); + ir_builder_.reset(new compiler_llvm::IRBuilder(*llvm_context_, *llvm_module_, *intrinsic_helper_)); } LLVMInfo::~LLVMInfo() { diff --git a/src/compiler/dex/frontend.h b/src/compiler/dex/frontend.h index b261c65a1c..f3e38c2246 100644 --- a/src/compiler/dex/frontend.h +++ b/src/compiler/dex/frontend.h @@ -26,7 +26,7 @@ namespace llvm { } namespace art { -namespace greenland { +namespace compiler_llvm { class IntrinsicHelper; class IRBuilder; } @@ -118,19 +118,19 @@ class LLVMInfo { return llvm_module_; } - art::greenland::IntrinsicHelper* GetIntrinsicHelper() { + art::compiler_llvm::IntrinsicHelper* GetIntrinsicHelper() { return intrinsic_helper_.get(); } - art::greenland::IRBuilder* GetIRBuilder() { + art::compiler_llvm::IRBuilder* GetIRBuilder() { return ir_builder_.get(); } private: UniquePtr<llvm::LLVMContext> llvm_context_; llvm::Module* llvm_module_; // Managed by context_. - UniquePtr<art::greenland::IntrinsicHelper> intrinsic_helper_; - UniquePtr<art::greenland::IRBuilder> ir_builder_; + UniquePtr<art::compiler_llvm::IntrinsicHelper> intrinsic_helper_; + UniquePtr<art::compiler_llvm::IRBuilder> ir_builder_; }; struct CompilationUnit; diff --git a/src/compiler/dex/portable/mir_to_gbc.cc b/src/compiler/dex/portable/mir_to_gbc.cc index 31fa96a41d..4cae511bb7 100644 --- a/src/compiler/dex/portable/mir_to_gbc.cc +++ b/src/compiler/dex/portable/mir_to_gbc.cc @@ -55,8 +55,8 @@ static llvm::Value* GetLLVMValue(CompilationUnit* cu, int s_reg) static void SetVregOnValue(CompilationUnit* cu, llvm::Value* val, int s_reg) { // Set vreg for debugging - greenland::IntrinsicHelper::IntrinsicId id = - greenland::IntrinsicHelper::SetVReg; + compiler_llvm::IntrinsicHelper::IntrinsicId id = + compiler_llvm::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); @@ -101,7 +101,7 @@ static llvm::Type* LlvmTypeFromLocRec(CompilationUnit* cu, RegLocation loc) res = cu->irb->getFloatTy(); } else { if (loc.ref) - res = cu->irb->GetJObjectTy(); + res = cu->irb->getJObjectTy(); else res = cu->irb->getInt32Ty(); } @@ -156,7 +156,7 @@ static void CreateLocFromValue(CompilationUnit* cu, llvm::Value* val) loc.location = kLocPhysReg; loc.home = true; } - } else if (ty == cu->irb->GetJObjectTy()) { + } else if (ty == cu->irb->getJObjectTy()) { loc.ref = true; if (p_map.core_location == kLocPhysReg) { loc.low_reg = p_map.core_reg; @@ -275,7 +275,7 @@ static void ConvertSparseSwitch(CompilationUnit* cu, BasicBlock* bb, } static void ConvertSget(CompilationUnit* cu, int32_t field_index, - greenland::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest) + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest) { llvm::Constant* field_idx = cu->irb->getInt32(field_index); llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); @@ -284,7 +284,7 @@ static void ConvertSget(CompilationUnit* cu, int32_t field_index, } static void ConvertSput(CompilationUnit* cu, int32_t field_index, - greenland::IntrinsicHelper::IntrinsicId id, RegLocation rl_src) + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_src) { llvm::SmallVector<llvm::Value*, 2> args; args.push_back(cu->irb->getInt32(field_index)); @@ -295,8 +295,8 @@ static void ConvertSput(CompilationUnit* cu, int32_t field_index, static void ConvertFillArrayData(CompilationUnit* cu, int32_t offset, RegLocation rl_array) { - greenland::IntrinsicHelper::IntrinsicId id; - id = greenland::IntrinsicHelper::HLFillArrayData; + compiler_llvm::IntrinsicHelper::IntrinsicId id; + id = compiler_llvm::IntrinsicHelper::HLFillArrayData; llvm::SmallVector<llvm::Value*, 2> args; args.push_back(cu->irb->getInt32(offset)); args.push_back(GetLLVMValue(cu, rl_array.orig_sreg)); @@ -307,20 +307,20 @@ static void ConvertFillArrayData(CompilationUnit* cu, int32_t offset, RegLocatio static llvm::Value* EmitConst(CompilationUnit* cu, llvm::ArrayRef<llvm::Value*> src, RegLocation loc) { - greenland::IntrinsicHelper::IntrinsicId id; + compiler_llvm::IntrinsicHelper::IntrinsicId id; if (loc.wide) { if (loc.fp) { - id = greenland::IntrinsicHelper::ConstDouble; + id = compiler_llvm::IntrinsicHelper::ConstDouble; } else { - id = greenland::IntrinsicHelper::ConstLong; + id = compiler_llvm::IntrinsicHelper::ConstLong; } } else { if (loc.fp) { - id = greenland::IntrinsicHelper::ConstFloat; + id = compiler_llvm::IntrinsicHelper::ConstFloat; } else if (loc.ref) { - id = greenland::IntrinsicHelper::ConstObj; + id = compiler_llvm::IntrinsicHelper::ConstObj; } else { - id = greenland::IntrinsicHelper::ConstInt; + id = compiler_llvm::IntrinsicHelper::ConstInt; } } llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); @@ -330,27 +330,27 @@ static llvm::Value* EmitConst(CompilationUnit* cu, llvm::ArrayRef<llvm::Value*> static void EmitPopShadowFrame(CompilationUnit* cu) { llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction( - greenland::IntrinsicHelper::PopShadowFrame); + compiler_llvm::IntrinsicHelper::PopShadowFrame); cu->irb->CreateCall(intr); } static llvm::Value* EmitCopy(CompilationUnit* cu, llvm::ArrayRef<llvm::Value*> src, RegLocation loc) { - greenland::IntrinsicHelper::IntrinsicId id; + compiler_llvm::IntrinsicHelper::IntrinsicId id; if (loc.wide) { if (loc.fp) { - id = greenland::IntrinsicHelper::CopyDouble; + id = compiler_llvm::IntrinsicHelper::CopyDouble; } else { - id = greenland::IntrinsicHelper::CopyLong; + id = compiler_llvm::IntrinsicHelper::CopyLong; } } else { if (loc.fp) { - id = greenland::IntrinsicHelper::CopyFloat; + id = compiler_llvm::IntrinsicHelper::CopyFloat; } else if (loc.ref) { - id = greenland::IntrinsicHelper::CopyObj; + id = compiler_llvm::IntrinsicHelper::CopyObj; } else { - id = greenland::IntrinsicHelper::CopyInt; + id = compiler_llvm::IntrinsicHelper::CopyInt; } } llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); @@ -360,7 +360,7 @@ static llvm::Value* EmitCopy(CompilationUnit* cu, llvm::ArrayRef<llvm::Value*> s static void ConvertMoveException(CompilationUnit* cu, RegLocation rl_dest) { llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction( - greenland::IntrinsicHelper::GetException); + compiler_llvm::IntrinsicHelper::GetException); llvm::Value* res = cu->irb->CreateCall(func); DefineValue(cu, res, rl_dest.orig_sreg); } @@ -369,12 +369,12 @@ static void ConvertThrow(CompilationUnit* cu, RegLocation rl_src) { llvm::Value* src = GetLLVMValue(cu, rl_src.orig_sreg); llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction( - greenland::IntrinsicHelper::HLThrowException); + compiler_llvm::IntrinsicHelper::HLThrowException); cu->irb->CreateCall(func, src); } static void ConvertMonitorEnterExit(CompilationUnit* cu, int opt_flags, - greenland::IntrinsicHelper::IntrinsicId id, + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_src) { llvm::SmallVector<llvm::Value*, 2> args; @@ -391,15 +391,15 @@ static void ConvertArrayLength(CompilationUnit* cu, int opt_flags, args.push_back(cu->irb->getInt32(opt_flags)); args.push_back(GetLLVMValue(cu, rl_src.orig_sreg)); llvm::Function* func = cu->intrinsic_helper->GetIntrinsicFunction( - greenland::IntrinsicHelper::OptArrayLength); + compiler_llvm::IntrinsicHelper::OptArrayLength); llvm::Value* res = cu->irb->CreateCall(func, args); DefineValue(cu, res, rl_dest.orig_sreg); } static void EmitSuspendCheck(CompilationUnit* cu) { - greenland::IntrinsicHelper::IntrinsicId id = - greenland::IntrinsicHelper::CheckSuspend; + compiler_llvm::IntrinsicHelper::IntrinsicId id = + compiler_llvm::IntrinsicHelper::CheckSuspend; llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); cu->irb->CreateCall(intr); } @@ -446,7 +446,7 @@ static void ConvertCompareZeroAndBranch(CompilationUnit* cu, BasicBlock* bb, llvm::Value* src1 = GetLLVMValue(cu, rl_src1.orig_sreg); llvm::Value* src2; if (rl_src1.ref) { - src2 = cu->irb->GetJNull(); + src2 = cu->irb->getJNull(); } else { src2 = cu->irb->getInt32(0); } @@ -460,18 +460,18 @@ static void ConvertCompareZeroAndBranch(CompilationUnit* cu, BasicBlock* bb, static llvm::Value* GenDivModOp(CompilationUnit* cu, bool is_div, bool is_long, llvm::Value* src1, llvm::Value* src2) { - greenland::IntrinsicHelper::IntrinsicId id; + compiler_llvm::IntrinsicHelper::IntrinsicId id; if (is_long) { if (is_div) { - id = greenland::IntrinsicHelper::DivLong; + id = compiler_llvm::IntrinsicHelper::DivLong; } else { - id = greenland::IntrinsicHelper::RemLong; + id = compiler_llvm::IntrinsicHelper::RemLong; } } else { if (is_div) { - id = greenland::IntrinsicHelper::DivInt; + id = compiler_llvm::IntrinsicHelper::DivInt; } else { - id = greenland::IntrinsicHelper::RemInt; + id = compiler_llvm::IntrinsicHelper::RemInt; } } llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); @@ -522,7 +522,7 @@ static void ConvertFPArithOp(CompilationUnit* cu, OpKind op, RegLocation rl_dest DefineValue(cu, res, rl_dest.orig_sreg); } -static void ConvertShift(CompilationUnit* cu, greenland::IntrinsicHelper::IntrinsicId id, +static void ConvertShift(CompilationUnit* cu, compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2) { llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); @@ -533,7 +533,7 @@ static void ConvertShift(CompilationUnit* cu, greenland::IntrinsicHelper::Intrin DefineValue(cu, res, rl_dest.orig_sreg); } -static void ConvertShiftLit(CompilationUnit* cu, greenland::IntrinsicHelper::IntrinsicId id, +static void ConvertShiftLit(CompilationUnit* cu, compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest, RegLocation rl_src, int shift_amount) { llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); @@ -591,24 +591,24 @@ static void ConvertInvoke(CompilationUnit* cu, BasicBlock* bb, MIR* mir, * be different than shorty. For example, if a function return value * is not used, we'll treat this as a void invoke. */ - greenland::IntrinsicHelper::IntrinsicId id; + compiler_llvm::IntrinsicHelper::IntrinsicId id; if (is_filled_new_array) { - id = greenland::IntrinsicHelper::HLFilledNewArray; + id = compiler_llvm::IntrinsicHelper::HLFilledNewArray; } else if (info->result.location == kLocInvalid) { - id = greenland::IntrinsicHelper::HLInvokeVoid; + id = compiler_llvm::IntrinsicHelper::HLInvokeVoid; } else { if (info->result.wide) { if (info->result.fp) { - id = greenland::IntrinsicHelper::HLInvokeDouble; + id = compiler_llvm::IntrinsicHelper::HLInvokeDouble; } else { - id = greenland::IntrinsicHelper::HLInvokeLong; + id = compiler_llvm::IntrinsicHelper::HLInvokeLong; } } else if (info->result.ref) { - id = greenland::IntrinsicHelper::HLInvokeObj; + id = compiler_llvm::IntrinsicHelper::HLInvokeObj; } else if (info->result.fp) { - id = greenland::IntrinsicHelper::HLInvokeFloat; + id = compiler_llvm::IntrinsicHelper::HLInvokeFloat; } else { - id = greenland::IntrinsicHelper::HLInvokeInt; + id = compiler_llvm::IntrinsicHelper::HLInvokeInt; } } llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); @@ -619,7 +619,7 @@ static void ConvertInvoke(CompilationUnit* cu, BasicBlock* bb, MIR* mir, } static void ConvertConstObject(CompilationUnit* cu, uint32_t idx, - greenland::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest) + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest) { llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); llvm::Value* index = cu->irb->getInt32(idx); @@ -629,8 +629,8 @@ static void ConvertConstObject(CompilationUnit* cu, uint32_t idx, static void ConvertCheckCast(CompilationUnit* cu, uint32_t type_idx, RegLocation rl_src) { - greenland::IntrinsicHelper::IntrinsicId id; - id = greenland::IntrinsicHelper::HLCheckCast; + compiler_llvm::IntrinsicHelper::IntrinsicId id; + id = compiler_llvm::IntrinsicHelper::HLCheckCast; llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); llvm::SmallVector<llvm::Value*, 2> args; args.push_back(cu->irb->getInt32(type_idx)); @@ -640,8 +640,8 @@ static void ConvertCheckCast(CompilationUnit* cu, uint32_t type_idx, RegLocation static void ConvertNewInstance(CompilationUnit* cu, uint32_t type_idx, RegLocation rl_dest) { - greenland::IntrinsicHelper::IntrinsicId id; - id = greenland::IntrinsicHelper::NewInstance; + compiler_llvm::IntrinsicHelper::IntrinsicId id; + id = compiler_llvm::IntrinsicHelper::NewInstance; llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); llvm::Value* index = cu->irb->getInt32(type_idx); llvm::Value* res = cu->irb->CreateCall(intr, index); @@ -651,8 +651,8 @@ static void ConvertNewInstance(CompilationUnit* cu, uint32_t type_idx, RegLocati static void ConvertNewArray(CompilationUnit* cu, uint32_t type_idx, RegLocation rl_dest, RegLocation rl_src) { - greenland::IntrinsicHelper::IntrinsicId id; - id = greenland::IntrinsicHelper::NewArray; + compiler_llvm::IntrinsicHelper::IntrinsicId id; + id = compiler_llvm::IntrinsicHelper::NewArray; llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); llvm::SmallVector<llvm::Value*, 2> args; args.push_back(cu->irb->getInt32(type_idx)); @@ -662,7 +662,7 @@ static void ConvertNewArray(CompilationUnit* cu, uint32_t type_idx, } static void ConvertAget(CompilationUnit* cu, int opt_flags, - greenland::IntrinsicHelper::IntrinsicId id, + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest, RegLocation rl_array, RegLocation rl_index) { llvm::SmallVector<llvm::Value*, 3> args; @@ -675,7 +675,7 @@ static void ConvertAget(CompilationUnit* cu, int opt_flags, } static void ConvertAput(CompilationUnit* cu, int opt_flags, - greenland::IntrinsicHelper::IntrinsicId id, + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_src, RegLocation rl_array, RegLocation rl_index) { llvm::SmallVector<llvm::Value*, 4> args; @@ -688,7 +688,7 @@ static void ConvertAput(CompilationUnit* cu, int opt_flags, } static void ConvertIget(CompilationUnit* cu, int opt_flags, - greenland::IntrinsicHelper::IntrinsicId id, + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest, RegLocation rl_obj, int field_index) { llvm::SmallVector<llvm::Value*, 3> args; @@ -701,7 +701,7 @@ static void ConvertIget(CompilationUnit* cu, int opt_flags, } static void ConvertIput(CompilationUnit* cu, int opt_flags, - greenland::IntrinsicHelper::IntrinsicId id, + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_src, RegLocation rl_obj, int field_index) { llvm::SmallVector<llvm::Value*, 4> args; @@ -716,8 +716,8 @@ static void ConvertIput(CompilationUnit* cu, int opt_flags, static void ConvertInstanceOf(CompilationUnit* cu, uint32_t type_idx, RegLocation rl_dest, RegLocation rl_src) { - greenland::IntrinsicHelper::IntrinsicId id; - id = greenland::IntrinsicHelper::InstanceOf; + compiler_llvm::IntrinsicHelper::IntrinsicId id; + id = compiler_llvm::IntrinsicHelper::InstanceOf; llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); llvm::SmallVector<llvm::Value*, 2> args; args.push_back(cu->irb->getInt32(type_idx)); @@ -755,7 +755,7 @@ static void ConvertDoubleToFloat(CompilationUnit* cu, RegLocation rl_dest, RegLo } static void ConvertWideComparison(CompilationUnit* cu, - greenland::IntrinsicHelper::IntrinsicId id, + compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest, RegLocation rl_src1, RegLocation rl_src2) { @@ -770,7 +770,7 @@ static void ConvertWideComparison(CompilationUnit* cu, } static void ConvertIntNarrowing(CompilationUnit* cu, RegLocation rl_dest, RegLocation rl_src, - greenland::IntrinsicHelper::IntrinsicId id) + compiler_llvm::IntrinsicHelper::IntrinsicId id) { llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); llvm::Value* res = @@ -792,7 +792,7 @@ static void ConvertIntToFP(CompilationUnit* cu, llvm::Type* ty, RegLocation rl_d DefineValue(cu, res, rl_dest.orig_sreg); } -static void ConvertFPToInt(CompilationUnit* cu, greenland::IntrinsicHelper::IntrinsicId id, +static void ConvertFPToInt(CompilationUnit* cu, compiler_llvm::IntrinsicHelper::IntrinsicId id, RegLocation rl_dest, RegLocation rl_src) { @@ -908,7 +908,7 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::CONST: case Instruction::CONST_4: case Instruction::CONST_16: { - llvm::Constant* imm_value = cu->irb->GetJInt(vB); + llvm::Constant* imm_value = cu->irb->getJInt(vB); llvm::Value* res = EmitConst(cu, imm_value, rl_dest); DefineValue(cu, res, rl_dest.orig_sreg); } @@ -918,14 +918,14 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::CONST_WIDE_32: { // Sign extend to 64 bits int64_t imm = static_cast<int32_t>(vB); - llvm::Constant* imm_value = cu->irb->GetJLong(imm); + llvm::Constant* imm_value = cu->irb->getJLong(imm); llvm::Value* res = EmitConst(cu, imm_value, rl_dest); DefineValue(cu, res, rl_dest.orig_sreg); } break; case Instruction::CONST_HIGH16: { - llvm::Constant* imm_value = cu->irb->GetJInt(vB << 16); + llvm::Constant* imm_value = cu->irb->getJInt(vB << 16); llvm::Value* res = EmitConst(cu, imm_value, rl_dest); DefineValue(cu, res, rl_dest.orig_sreg); } @@ -933,82 +933,82 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::CONST_WIDE: { llvm::Constant* imm_value = - cu->irb->GetJLong(mir->dalvikInsn.vB_wide); + cu->irb->getJLong(mir->dalvikInsn.vB_wide); llvm::Value* res = EmitConst(cu, imm_value, rl_dest); DefineValue(cu, res, rl_dest.orig_sreg); } break; case Instruction::CONST_WIDE_HIGH16: { int64_t imm = static_cast<int64_t>(vB) << 48; - llvm::Constant* imm_value = cu->irb->GetJLong(imm); + llvm::Constant* imm_value = cu->irb->getJLong(imm); llvm::Value* res = EmitConst(cu, imm_value, rl_dest); DefineValue(cu, res, rl_dest.orig_sreg); } break; case Instruction::SPUT_OBJECT: - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputObject, + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputObject, rl_src[0]); break; case Instruction::SPUT: if (rl_src[0].fp) { - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputFloat, + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputFloat, rl_src[0]); } else { - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSput, rl_src[0]); + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSput, rl_src[0]); } break; case Instruction::SPUT_BOOLEAN: - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputBoolean, + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputBoolean, rl_src[0]); break; case Instruction::SPUT_BYTE: - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputByte, rl_src[0]); + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputByte, rl_src[0]); break; case Instruction::SPUT_CHAR: - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputChar, rl_src[0]); + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputChar, rl_src[0]); break; case Instruction::SPUT_SHORT: - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputShort, rl_src[0]); + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputShort, rl_src[0]); break; case Instruction::SPUT_WIDE: if (rl_src[0].fp) { - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputDouble, + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputDouble, rl_src[0]); } else { - ConvertSput(cu, vB, greenland::IntrinsicHelper::HLSputWide, + ConvertSput(cu, vB, compiler_llvm::IntrinsicHelper::HLSputWide, rl_src[0]); } break; case Instruction::SGET_OBJECT: - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetObject, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetObject, rl_dest); break; case Instruction::SGET: if (rl_dest.fp) { - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetFloat, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetFloat, rl_dest); } else { - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSget, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSget, rl_dest); } break; case Instruction::SGET_BOOLEAN: - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetBoolean, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetBoolean, rl_dest); break; case Instruction::SGET_BYTE: - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetByte, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetByte, rl_dest); break; case Instruction::SGET_CHAR: - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetChar, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetChar, rl_dest); break; case Instruction::SGET_SHORT: - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetShort, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetShort, rl_dest); break; case Instruction::SGET_WIDE: if (rl_dest.fp) { - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetDouble, + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetDouble, rl_dest); } else { - ConvertSget(cu, vB, greenland::IntrinsicHelper::HLSgetWide, rl_dest); + ConvertSget(cu, vB, compiler_llvm::IntrinsicHelper::HLSgetWide, rl_dest); } break; @@ -1131,32 +1131,32 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, break; case Instruction::SHL_LONG: case Instruction::SHL_LONG_2ADDR: - ConvertShift(cu, greenland::IntrinsicHelper::SHLLong, + ConvertShift(cu, compiler_llvm::IntrinsicHelper::SHLLong, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::SHL_INT: case Instruction::SHL_INT_2ADDR: - ConvertShift(cu, greenland::IntrinsicHelper::SHLInt, + ConvertShift(cu, compiler_llvm::IntrinsicHelper::SHLInt, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::SHR_LONG: case Instruction::SHR_LONG_2ADDR: - ConvertShift(cu, greenland::IntrinsicHelper::SHRLong, + ConvertShift(cu, compiler_llvm::IntrinsicHelper::SHRLong, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::SHR_INT: case Instruction::SHR_INT_2ADDR: - ConvertShift(cu, greenland::IntrinsicHelper::SHRInt, + ConvertShift(cu, compiler_llvm::IntrinsicHelper::SHRInt, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::USHR_LONG: case Instruction::USHR_LONG_2ADDR: - ConvertShift(cu, greenland::IntrinsicHelper::USHRLong, + ConvertShift(cu, compiler_llvm::IntrinsicHelper::USHRLong, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::USHR_INT: case Instruction::USHR_INT_2ADDR: - ConvertShift(cu, greenland::IntrinsicHelper::USHRInt, + ConvertShift(cu, compiler_llvm::IntrinsicHelper::USHRInt, rl_dest, rl_src[0], rl_src[1]); break; @@ -1193,15 +1193,15 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, ConvertArithOpLit(cu, kOpXor, rl_dest, rl_src[0], vC); break; case Instruction::SHL_INT_LIT8: - ConvertShiftLit(cu, greenland::IntrinsicHelper::SHLInt, + ConvertShiftLit(cu, compiler_llvm::IntrinsicHelper::SHLInt, rl_dest, rl_src[0], vC & 0x1f); break; case Instruction::SHR_INT_LIT8: - ConvertShiftLit(cu, greenland::IntrinsicHelper::SHRInt, + ConvertShiftLit(cu, compiler_llvm::IntrinsicHelper::SHRInt, rl_dest, rl_src[0], vC & 0x1f); break; case Instruction::USHR_INT_LIT8: - ConvertShiftLit(cu, greenland::IntrinsicHelper::USHRInt, + ConvertShiftLit(cu, compiler_llvm::IntrinsicHelper::USHRInt, rl_dest, rl_src[0], vC & 0x1f); break; @@ -1295,12 +1295,12 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::CONST_STRING: case Instruction::CONST_STRING_JUMBO: - ConvertConstObject(cu, vB, greenland::IntrinsicHelper::ConstString, + ConvertConstObject(cu, vB, compiler_llvm::IntrinsicHelper::ConstString, rl_dest); break; case Instruction::CONST_CLASS: - ConvertConstObject(cu, vB, greenland::IntrinsicHelper::ConstClass, + ConvertConstObject(cu, vB, compiler_llvm::IntrinsicHelper::ConstClass, rl_dest); break; @@ -1342,13 +1342,13 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::MONITOR_ENTER: ConvertMonitorEnterExit(cu, opt_flags, - greenland::IntrinsicHelper::MonitorEnter, + compiler_llvm::IntrinsicHelper::MonitorEnter, rl_src[0]); break; case Instruction::MONITOR_EXIT: ConvertMonitorEnterExit(cu, opt_flags, - greenland::IntrinsicHelper::MonitorExit, + compiler_llvm::IntrinsicHelper::MonitorExit, rl_src[0]); break; @@ -1367,41 +1367,41 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::AGET: if (rl_dest.fp) { ConvertAget(cu, opt_flags, - greenland::IntrinsicHelper::HLArrayGetFloat, + compiler_llvm::IntrinsicHelper::HLArrayGetFloat, rl_dest, rl_src[0], rl_src[1]); } else { - ConvertAget(cu, opt_flags, greenland::IntrinsicHelper::HLArrayGet, + ConvertAget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayGet, rl_dest, rl_src[0], rl_src[1]); } break; case Instruction::AGET_OBJECT: - ConvertAget(cu, opt_flags, greenland::IntrinsicHelper::HLArrayGetObject, + ConvertAget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayGetObject, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::AGET_BOOLEAN: ConvertAget(cu, opt_flags, - greenland::IntrinsicHelper::HLArrayGetBoolean, + compiler_llvm::IntrinsicHelper::HLArrayGetBoolean, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::AGET_BYTE: - ConvertAget(cu, opt_flags, greenland::IntrinsicHelper::HLArrayGetByte, + ConvertAget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayGetByte, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::AGET_CHAR: - ConvertAget(cu, opt_flags, greenland::IntrinsicHelper::HLArrayGetChar, + ConvertAget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayGetChar, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::AGET_SHORT: - ConvertAget(cu, opt_flags, greenland::IntrinsicHelper::HLArrayGetShort, + ConvertAget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayGetShort, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::AGET_WIDE: if (rl_dest.fp) { ConvertAget(cu, opt_flags, - greenland::IntrinsicHelper::HLArrayGetDouble, + compiler_llvm::IntrinsicHelper::HLArrayGetDouble, rl_dest, rl_src[0], rl_src[1]); } else { - ConvertAget(cu, opt_flags, greenland::IntrinsicHelper::HLArrayGetWide, + ConvertAget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayGetWide, rl_dest, rl_src[0], rl_src[1]); } break; @@ -1409,118 +1409,118 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::APUT: if (rl_src[0].fp) { ConvertAput(cu, opt_flags, - greenland::IntrinsicHelper::HLArrayPutFloat, + compiler_llvm::IntrinsicHelper::HLArrayPutFloat, rl_src[0], rl_src[1], rl_src[2]); } else { - ConvertAput(cu, opt_flags, greenland::IntrinsicHelper::HLArrayPut, + ConvertAput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayPut, rl_src[0], rl_src[1], rl_src[2]); } break; case Instruction::APUT_OBJECT: - ConvertAput(cu, opt_flags, greenland::IntrinsicHelper::HLArrayPutObject, + ConvertAput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayPutObject, rl_src[0], rl_src[1], rl_src[2]); break; case Instruction::APUT_BOOLEAN: ConvertAput(cu, opt_flags, - greenland::IntrinsicHelper::HLArrayPutBoolean, + compiler_llvm::IntrinsicHelper::HLArrayPutBoolean, rl_src[0], rl_src[1], rl_src[2]); break; case Instruction::APUT_BYTE: - ConvertAput(cu, opt_flags, greenland::IntrinsicHelper::HLArrayPutByte, + ConvertAput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayPutByte, rl_src[0], rl_src[1], rl_src[2]); break; case Instruction::APUT_CHAR: - ConvertAput(cu, opt_flags, greenland::IntrinsicHelper::HLArrayPutChar, + ConvertAput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayPutChar, rl_src[0], rl_src[1], rl_src[2]); break; case Instruction::APUT_SHORT: - ConvertAput(cu, opt_flags, greenland::IntrinsicHelper::HLArrayPutShort, + ConvertAput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayPutShort, rl_src[0], rl_src[1], rl_src[2]); break; case Instruction::APUT_WIDE: if (rl_src[0].fp) { ConvertAput(cu, opt_flags, - greenland::IntrinsicHelper::HLArrayPutDouble, + compiler_llvm::IntrinsicHelper::HLArrayPutDouble, rl_src[0], rl_src[1], rl_src[2]); } else { - ConvertAput(cu, opt_flags, greenland::IntrinsicHelper::HLArrayPutWide, + ConvertAput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLArrayPutWide, rl_src[0], rl_src[1], rl_src[2]); } break; case Instruction::IGET: if (rl_dest.fp) { - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetFloat, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetFloat, rl_dest, rl_src[0], vC); } else { - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGet, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGet, rl_dest, rl_src[0], vC); } break; case Instruction::IGET_OBJECT: - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetObject, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetObject, rl_dest, rl_src[0], vC); break; case Instruction::IGET_BOOLEAN: - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetBoolean, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetBoolean, rl_dest, rl_src[0], vC); break; case Instruction::IGET_BYTE: - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetByte, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetByte, rl_dest, rl_src[0], vC); break; case Instruction::IGET_CHAR: - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetChar, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetChar, rl_dest, rl_src[0], vC); break; case Instruction::IGET_SHORT: - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetShort, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetShort, rl_dest, rl_src[0], vC); break; case Instruction::IGET_WIDE: if (rl_dest.fp) { - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetDouble, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetDouble, rl_dest, rl_src[0], vC); } else { - ConvertIget(cu, opt_flags, greenland::IntrinsicHelper::HLIGetWide, + ConvertIget(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIGetWide, rl_dest, rl_src[0], vC); } break; case Instruction::IPUT: if (rl_src[0].fp) { - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutFloat, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutFloat, rl_src[0], rl_src[1], vC); } else { - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPut, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPut, rl_src[0], rl_src[1], vC); } break; case Instruction::IPUT_OBJECT: - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutObject, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutObject, rl_src[0], rl_src[1], vC); break; case Instruction::IPUT_BOOLEAN: - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutBoolean, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutBoolean, rl_src[0], rl_src[1], vC); break; case Instruction::IPUT_BYTE: - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutByte, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutByte, rl_src[0], rl_src[1], vC); break; case Instruction::IPUT_CHAR: - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutChar, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutChar, rl_src[0], rl_src[1], vC); break; case Instruction::IPUT_SHORT: - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutShort, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutShort, rl_src[0], rl_src[1], vC); break; case Instruction::IPUT_WIDE: if (rl_src[0].fp) { - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutDouble, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutDouble, rl_src[0], rl_src[1], vC); } else { - ConvertIput(cu, opt_flags, greenland::IntrinsicHelper::HLIPutWide, + ConvertIput(cu, opt_flags, compiler_llvm::IntrinsicHelper::HLIPutWide, rl_src[0], rl_src[1], vC); } break; @@ -1539,15 +1539,15 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, case Instruction::INT_TO_CHAR: ConvertIntNarrowing(cu, rl_dest, rl_src[0], - greenland::IntrinsicHelper::IntToChar); + compiler_llvm::IntrinsicHelper::IntToChar); break; case Instruction::INT_TO_BYTE: ConvertIntNarrowing(cu, rl_dest, rl_src[0], - greenland::IntrinsicHelper::IntToByte); + compiler_llvm::IntrinsicHelper::IntToByte); break; case Instruction::INT_TO_SHORT: ConvertIntNarrowing(cu, rl_dest, rl_src[0], - greenland::IntrinsicHelper::IntToShort); + compiler_llvm::IntrinsicHelper::IntToShort); break; case Instruction::INT_TO_FLOAT: @@ -1584,39 +1584,39 @@ static bool ConvertMIRNode(CompilationUnit* cu, MIR* mir, BasicBlock* bb, break; case Instruction::FLOAT_TO_INT: - ConvertFPToInt(cu, greenland::IntrinsicHelper::F2I, rl_dest, rl_src[0]); + ConvertFPToInt(cu, compiler_llvm::IntrinsicHelper::F2I, rl_dest, rl_src[0]); break; case Instruction::DOUBLE_TO_INT: - ConvertFPToInt(cu, greenland::IntrinsicHelper::D2I, rl_dest, rl_src[0]); + ConvertFPToInt(cu, compiler_llvm::IntrinsicHelper::D2I, rl_dest, rl_src[0]); break; case Instruction::FLOAT_TO_LONG: - ConvertFPToInt(cu, greenland::IntrinsicHelper::F2L, rl_dest, rl_src[0]); + ConvertFPToInt(cu, compiler_llvm::IntrinsicHelper::F2L, rl_dest, rl_src[0]); break; case Instruction::DOUBLE_TO_LONG: - ConvertFPToInt(cu, greenland::IntrinsicHelper::D2L, rl_dest, rl_src[0]); + ConvertFPToInt(cu, compiler_llvm::IntrinsicHelper::D2L, rl_dest, rl_src[0]); break; case Instruction::CMPL_FLOAT: - ConvertWideComparison(cu, greenland::IntrinsicHelper::CmplFloat, + ConvertWideComparison(cu, compiler_llvm::IntrinsicHelper::CmplFloat, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::CMPG_FLOAT: - ConvertWideComparison(cu, greenland::IntrinsicHelper::CmpgFloat, + ConvertWideComparison(cu, compiler_llvm::IntrinsicHelper::CmpgFloat, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::CMPL_DOUBLE: - ConvertWideComparison(cu, greenland::IntrinsicHelper::CmplDouble, + ConvertWideComparison(cu, compiler_llvm::IntrinsicHelper::CmplDouble, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::CMPG_DOUBLE: - ConvertWideComparison(cu, greenland::IntrinsicHelper::CmpgDouble, + ConvertWideComparison(cu, compiler_llvm::IntrinsicHelper::CmpgDouble, rl_dest, rl_src[0], rl_src[1]); break; case Instruction::CMP_LONG: - ConvertWideComparison(cu, greenland::IntrinsicHelper::CmpLong, + ConvertWideComparison(cu, compiler_llvm::IntrinsicHelper::CmpLong, rl_dest, rl_src[0], rl_src[1]); break; @@ -1649,8 +1649,8 @@ static void SetMethodInfo(CompilationUnit* cu) { // We don't want dex offset on this cu->irb->SetDexOffset(NULL); - greenland::IntrinsicHelper::IntrinsicId id; - id = greenland::IntrinsicHelper::MethodInfo; + compiler_llvm::IntrinsicHelper::IntrinsicId id; + id = compiler_llvm::IntrinsicHelper::MethodInfo; llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction(id); llvm::Instruction* inst = cu->irb->CreateCall(intr); llvm::SmallVector<llvm::Value*, 2> reg_info; @@ -1801,8 +1801,8 @@ static bool BlockBitcodeConversion(CompilationUnit* cu, BasicBlock* bb) SetMethodInfo(cu); { // Allocate shadowframe. - greenland::IntrinsicHelper::IntrinsicId id = - greenland::IntrinsicHelper::AllocaShadowFrame; + compiler_llvm::IntrinsicHelper::IntrinsicId id = + compiler_llvm::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); @@ -1875,7 +1875,7 @@ static bool BlockBitcodeConversion(CompilationUnit* cu, BasicBlock* bb) work_half->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpNop); if (bb->successor_block_list.block_list_type == kCatch) { llvm::Function* intr = cu->intrinsic_helper->GetIntrinsicFunction( - greenland::IntrinsicHelper::CatchTargets); + compiler_llvm::IntrinsicHelper::CatchTargets); llvm::Value* switch_key = cu->irb->CreateCall(intr, cu->irb->getInt32(mir->offset)); GrowableListIterator iter; @@ -1950,23 +1950,21 @@ char RemapShorty(char shorty_type) { static llvm::FunctionType* GetFunctionType(CompilationUnit* cu) { // Get return type - llvm::Type* ret_type = cu->irb->GetJType(RemapShorty(cu->shorty[0]), - greenland::kAccurate); + llvm::Type* ret_type = cu->irb->getJType(RemapShorty(cu->shorty[0])); // Get argument type std::vector<llvm::Type*> args_type; // method object - args_type.push_back(cu->irb->GetJMethodTy()); + args_type.push_back(cu->irb->getJMethodTy()); // Do we have a "this"? if ((cu->access_flags & kAccStatic) == 0) { - args_type.push_back(cu->irb->GetJObjectTy()); + args_type.push_back(cu->irb->getJObjectTy()); } for (uint32_t i = 1; i < strlen(cu->shorty); ++i) { - args_type.push_back(cu->irb->GetJType(RemapShorty(cu->shorty[i]), - greenland::kAccurate)); + args_type.push_back(cu->irb->getJType(RemapShorty(cu->shorty[i]))); } return llvm::FunctionType::get(ret_type, args_type, false); @@ -2060,7 +2058,7 @@ void MethodMIR2Bitcode(CompilationUnit* cu) } else if ((i < cu->num_regs) || (i >= (cu->num_regs + cu->num_ins))) { llvm::Constant* imm_value = cu->reg_location[i].wide ? - cu->irb->GetJLong(0) : cu->irb->GetJInt(0); + cu->irb->getJLong(0) : cu->irb->getJInt(0); val = EmitConst(cu, imm_value, cu->reg_location[i]); val->setName(LlvmSSAName(cu, i)); InsertGrowableList(cu, &cu->llvm_values, reinterpret_cast<uintptr_t>(val)); @@ -3021,278 +3019,278 @@ static bool BitcodeBlockCodeGen(CompilationUnit* cu, llvm::BasicBlock* bb) case llvm::Instruction::Call: { llvm::CallInst* call_inst = llvm::dyn_cast<llvm::CallInst>(inst); llvm::Function* callee = call_inst->getCalledFunction(); - greenland::IntrinsicHelper::IntrinsicId id = + compiler_llvm::IntrinsicHelper::IntrinsicId id = cu->intrinsic_helper->GetIntrinsicId(callee); switch (id) { - case greenland::IntrinsicHelper::AllocaShadowFrame: - case greenland::IntrinsicHelper::PopShadowFrame: - case greenland::IntrinsicHelper::SetVReg: + case compiler_llvm::IntrinsicHelper::AllocaShadowFrame: + case compiler_llvm::IntrinsicHelper::PopShadowFrame: + case compiler_llvm::IntrinsicHelper::SetVReg: // Ignore shadow frame stuff for quick compiler break; - case greenland::IntrinsicHelper::CopyInt: - case greenland::IntrinsicHelper::CopyObj: - case greenland::IntrinsicHelper::CopyFloat: - case greenland::IntrinsicHelper::CopyLong: - case greenland::IntrinsicHelper::CopyDouble: + case compiler_llvm::IntrinsicHelper::CopyInt: + case compiler_llvm::IntrinsicHelper::CopyObj: + case compiler_llvm::IntrinsicHelper::CopyFloat: + case compiler_llvm::IntrinsicHelper::CopyLong: + case compiler_llvm::IntrinsicHelper::CopyDouble: CvtCopy(cu, call_inst); break; - case greenland::IntrinsicHelper::ConstInt: - case greenland::IntrinsicHelper::ConstObj: - case greenland::IntrinsicHelper::ConstLong: - case greenland::IntrinsicHelper::ConstFloat: - case greenland::IntrinsicHelper::ConstDouble: + case compiler_llvm::IntrinsicHelper::ConstInt: + case compiler_llvm::IntrinsicHelper::ConstObj: + case compiler_llvm::IntrinsicHelper::ConstLong: + case compiler_llvm::IntrinsicHelper::ConstFloat: + case compiler_llvm::IntrinsicHelper::ConstDouble: CvtConst(cu, call_inst); break; - case greenland::IntrinsicHelper::DivInt: - case greenland::IntrinsicHelper::DivLong: + case compiler_llvm::IntrinsicHelper::DivInt: + case compiler_llvm::IntrinsicHelper::DivLong: CvtBinOp(cu, kOpDiv, inst); break; - case greenland::IntrinsicHelper::RemInt: - case greenland::IntrinsicHelper::RemLong: + case compiler_llvm::IntrinsicHelper::RemInt: + case compiler_llvm::IntrinsicHelper::RemLong: CvtBinOp(cu, kOpRem, inst); break; - case greenland::IntrinsicHelper::MethodInfo: + case compiler_llvm::IntrinsicHelper::MethodInfo: // Already dealt with - just ignore it here. break; - case greenland::IntrinsicHelper::CheckSuspend: + case compiler_llvm::IntrinsicHelper::CheckSuspend: cg->GenSuspendTest(cu, 0 /* opt_flags already applied */); break; - case greenland::IntrinsicHelper::HLInvokeObj: - case greenland::IntrinsicHelper::HLInvokeFloat: - case greenland::IntrinsicHelper::HLInvokeDouble: - case greenland::IntrinsicHelper::HLInvokeLong: - case greenland::IntrinsicHelper::HLInvokeInt: + case compiler_llvm::IntrinsicHelper::HLInvokeObj: + case compiler_llvm::IntrinsicHelper::HLInvokeFloat: + case compiler_llvm::IntrinsicHelper::HLInvokeDouble: + case compiler_llvm::IntrinsicHelper::HLInvokeLong: + case compiler_llvm::IntrinsicHelper::HLInvokeInt: CvtInvoke(cu, call_inst, false /* is_void */, false /* new_array */); break; - case greenland::IntrinsicHelper::HLInvokeVoid: + case compiler_llvm::IntrinsicHelper::HLInvokeVoid: CvtInvoke(cu, call_inst, true /* is_void */, false /* new_array */); break; - case greenland::IntrinsicHelper::HLFilledNewArray: + case compiler_llvm::IntrinsicHelper::HLFilledNewArray: CvtInvoke(cu, call_inst, false /* is_void */, true /* new_array */); break; - case greenland::IntrinsicHelper::HLFillArrayData: + case compiler_llvm::IntrinsicHelper::HLFillArrayData: CvtFillArrayData(cu, call_inst); break; - case greenland::IntrinsicHelper::ConstString: + case compiler_llvm::IntrinsicHelper::ConstString: CvtConstObject(cu, call_inst, true /* is_string */); break; - case greenland::IntrinsicHelper::ConstClass: + case compiler_llvm::IntrinsicHelper::ConstClass: CvtConstObject(cu, call_inst, false /* is_string */); break; - case greenland::IntrinsicHelper::HLCheckCast: + case compiler_llvm::IntrinsicHelper::HLCheckCast: CvtCheckCast(cu, call_inst); break; - case greenland::IntrinsicHelper::NewInstance: + case compiler_llvm::IntrinsicHelper::NewInstance: CvtNewInstance(cu, call_inst); break; - case greenland::IntrinsicHelper::HLSgetObject: + case compiler_llvm::IntrinsicHelper::HLSgetObject: CvtSget(cu, call_inst, false /* wide */, true /* Object */); break; - case greenland::IntrinsicHelper::HLSget: - case greenland::IntrinsicHelper::HLSgetFloat: - case greenland::IntrinsicHelper::HLSgetBoolean: - case greenland::IntrinsicHelper::HLSgetByte: - case greenland::IntrinsicHelper::HLSgetChar: - case greenland::IntrinsicHelper::HLSgetShort: + case compiler_llvm::IntrinsicHelper::HLSget: + case compiler_llvm::IntrinsicHelper::HLSgetFloat: + case compiler_llvm::IntrinsicHelper::HLSgetBoolean: + case compiler_llvm::IntrinsicHelper::HLSgetByte: + case compiler_llvm::IntrinsicHelper::HLSgetChar: + case compiler_llvm::IntrinsicHelper::HLSgetShort: CvtSget(cu, call_inst, false /* wide */, false /* Object */); break; - case greenland::IntrinsicHelper::HLSgetWide: - case greenland::IntrinsicHelper::HLSgetDouble: + case compiler_llvm::IntrinsicHelper::HLSgetWide: + case compiler_llvm::IntrinsicHelper::HLSgetDouble: CvtSget(cu, call_inst, true /* wide */, false /* Object */); break; - case greenland::IntrinsicHelper::HLSput: - case greenland::IntrinsicHelper::HLSputFloat: - case greenland::IntrinsicHelper::HLSputBoolean: - case greenland::IntrinsicHelper::HLSputByte: - case greenland::IntrinsicHelper::HLSputChar: - case greenland::IntrinsicHelper::HLSputShort: + case compiler_llvm::IntrinsicHelper::HLSput: + case compiler_llvm::IntrinsicHelper::HLSputFloat: + case compiler_llvm::IntrinsicHelper::HLSputBoolean: + case compiler_llvm::IntrinsicHelper::HLSputByte: + case compiler_llvm::IntrinsicHelper::HLSputChar: + case compiler_llvm::IntrinsicHelper::HLSputShort: CvtSput(cu, call_inst, false /* wide */, false /* Object */); break; - case greenland::IntrinsicHelper::HLSputWide: - case greenland::IntrinsicHelper::HLSputDouble: + case compiler_llvm::IntrinsicHelper::HLSputWide: + case compiler_llvm::IntrinsicHelper::HLSputDouble: CvtSput(cu, call_inst, true /* wide */, false /* Object */); break; - case greenland::IntrinsicHelper::HLSputObject: + case compiler_llvm::IntrinsicHelper::HLSputObject: CvtSput(cu, call_inst, false /* wide */, true /* Object */); break; - case greenland::IntrinsicHelper::GetException: + case compiler_llvm::IntrinsicHelper::GetException: CvtMoveException(cu, call_inst); break; - case greenland::IntrinsicHelper::HLThrowException: + case compiler_llvm::IntrinsicHelper::HLThrowException: CvtThrow(cu, call_inst); break; - case greenland::IntrinsicHelper::MonitorEnter: + case compiler_llvm::IntrinsicHelper::MonitorEnter: CvtMonitorEnterExit(cu, true /* is_enter */, call_inst); break; - case greenland::IntrinsicHelper::MonitorExit: + case compiler_llvm::IntrinsicHelper::MonitorExit: CvtMonitorEnterExit(cu, false /* is_enter */, call_inst); break; - case greenland::IntrinsicHelper::OptArrayLength: + case compiler_llvm::IntrinsicHelper::OptArrayLength: CvtArrayLength(cu, call_inst); break; - case greenland::IntrinsicHelper::NewArray: + case compiler_llvm::IntrinsicHelper::NewArray: CvtNewArray(cu, call_inst); break; - case greenland::IntrinsicHelper::InstanceOf: + case compiler_llvm::IntrinsicHelper::InstanceOf: CvtInstanceOf(cu, call_inst); break; - case greenland::IntrinsicHelper::HLArrayGet: - case greenland::IntrinsicHelper::HLArrayGetObject: - case greenland::IntrinsicHelper::HLArrayGetFloat: + case compiler_llvm::IntrinsicHelper::HLArrayGet: + case compiler_llvm::IntrinsicHelper::HLArrayGetObject: + case compiler_llvm::IntrinsicHelper::HLArrayGetFloat: CvtAget(cu, call_inst, kWord, 2); break; - case greenland::IntrinsicHelper::HLArrayGetWide: - case greenland::IntrinsicHelper::HLArrayGetDouble: + case compiler_llvm::IntrinsicHelper::HLArrayGetWide: + case compiler_llvm::IntrinsicHelper::HLArrayGetDouble: CvtAget(cu, call_inst, kLong, 3); break; - case greenland::IntrinsicHelper::HLArrayGetBoolean: + case compiler_llvm::IntrinsicHelper::HLArrayGetBoolean: CvtAget(cu, call_inst, kUnsignedByte, 0); break; - case greenland::IntrinsicHelper::HLArrayGetByte: + case compiler_llvm::IntrinsicHelper::HLArrayGetByte: CvtAget(cu, call_inst, kSignedByte, 0); break; - case greenland::IntrinsicHelper::HLArrayGetChar: + case compiler_llvm::IntrinsicHelper::HLArrayGetChar: CvtAget(cu, call_inst, kUnsignedHalf, 1); break; - case greenland::IntrinsicHelper::HLArrayGetShort: + case compiler_llvm::IntrinsicHelper::HLArrayGetShort: CvtAget(cu, call_inst, kSignedHalf, 1); break; - case greenland::IntrinsicHelper::HLArrayPut: - case greenland::IntrinsicHelper::HLArrayPutFloat: + case compiler_llvm::IntrinsicHelper::HLArrayPut: + case compiler_llvm::IntrinsicHelper::HLArrayPutFloat: CvtAputPrimitive(cu, call_inst, kWord, 2); break; - case greenland::IntrinsicHelper::HLArrayPutObject: + case compiler_llvm::IntrinsicHelper::HLArrayPutObject: CvtAputObj(cu, call_inst); break; - case greenland::IntrinsicHelper::HLArrayPutWide: - case greenland::IntrinsicHelper::HLArrayPutDouble: + case compiler_llvm::IntrinsicHelper::HLArrayPutWide: + case compiler_llvm::IntrinsicHelper::HLArrayPutDouble: CvtAputPrimitive(cu, call_inst, kLong, 3); break; - case greenland::IntrinsicHelper::HLArrayPutBoolean: + case compiler_llvm::IntrinsicHelper::HLArrayPutBoolean: CvtAputPrimitive(cu, call_inst, kUnsignedByte, 0); break; - case greenland::IntrinsicHelper::HLArrayPutByte: + case compiler_llvm::IntrinsicHelper::HLArrayPutByte: CvtAputPrimitive(cu, call_inst, kSignedByte, 0); break; - case greenland::IntrinsicHelper::HLArrayPutChar: + case compiler_llvm::IntrinsicHelper::HLArrayPutChar: CvtAputPrimitive(cu, call_inst, kUnsignedHalf, 1); break; - case greenland::IntrinsicHelper::HLArrayPutShort: + case compiler_llvm::IntrinsicHelper::HLArrayPutShort: CvtAputPrimitive(cu, call_inst, kSignedHalf, 1); break; - case greenland::IntrinsicHelper::HLIGet: - case greenland::IntrinsicHelper::HLIGetFloat: + case compiler_llvm::IntrinsicHelper::HLIGet: + case compiler_llvm::IntrinsicHelper::HLIGetFloat: CvtIget(cu, call_inst, kWord, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIGetObject: + case compiler_llvm::IntrinsicHelper::HLIGetObject: CvtIget(cu, call_inst, kWord, false /* is_wide */, true /* obj */); break; - case greenland::IntrinsicHelper::HLIGetWide: - case greenland::IntrinsicHelper::HLIGetDouble: + case compiler_llvm::IntrinsicHelper::HLIGetWide: + case compiler_llvm::IntrinsicHelper::HLIGetDouble: CvtIget(cu, call_inst, kLong, true /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIGetBoolean: + case compiler_llvm::IntrinsicHelper::HLIGetBoolean: CvtIget(cu, call_inst, kUnsignedByte, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIGetByte: + case compiler_llvm::IntrinsicHelper::HLIGetByte: CvtIget(cu, call_inst, kSignedByte, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIGetChar: + case compiler_llvm::IntrinsicHelper::HLIGetChar: CvtIget(cu, call_inst, kUnsignedHalf, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIGetShort: + case compiler_llvm::IntrinsicHelper::HLIGetShort: CvtIget(cu, call_inst, kSignedHalf, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIPut: - case greenland::IntrinsicHelper::HLIPutFloat: + case compiler_llvm::IntrinsicHelper::HLIPut: + case compiler_llvm::IntrinsicHelper::HLIPutFloat: CvtIput(cu, call_inst, kWord, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIPutObject: + case compiler_llvm::IntrinsicHelper::HLIPutObject: CvtIput(cu, call_inst, kWord, false /* is_wide */, true /* obj */); break; - case greenland::IntrinsicHelper::HLIPutWide: - case greenland::IntrinsicHelper::HLIPutDouble: + case compiler_llvm::IntrinsicHelper::HLIPutWide: + case compiler_llvm::IntrinsicHelper::HLIPutDouble: CvtIput(cu, call_inst, kLong, true /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIPutBoolean: + case compiler_llvm::IntrinsicHelper::HLIPutBoolean: CvtIput(cu, call_inst, kUnsignedByte, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIPutByte: + case compiler_llvm::IntrinsicHelper::HLIPutByte: CvtIput(cu, call_inst, kSignedByte, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIPutChar: + case compiler_llvm::IntrinsicHelper::HLIPutChar: CvtIput(cu, call_inst, kUnsignedHalf, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::HLIPutShort: + case compiler_llvm::IntrinsicHelper::HLIPutShort: CvtIput(cu, call_inst, kSignedHalf, false /* is_wide */, false /* obj */); break; - case greenland::IntrinsicHelper::IntToChar: + case compiler_llvm::IntrinsicHelper::IntToChar: CvtIntNarrowing(cu, call_inst, Instruction::INT_TO_CHAR); break; - case greenland::IntrinsicHelper::IntToShort: + case compiler_llvm::IntrinsicHelper::IntToShort: CvtIntNarrowing(cu, call_inst, Instruction::INT_TO_SHORT); break; - case greenland::IntrinsicHelper::IntToByte: + case compiler_llvm::IntrinsicHelper::IntToByte: CvtIntNarrowing(cu, call_inst, Instruction::INT_TO_BYTE); break; - case greenland::IntrinsicHelper::F2I: - case greenland::IntrinsicHelper::D2I: - case greenland::IntrinsicHelper::F2L: - case greenland::IntrinsicHelper::D2L: + case compiler_llvm::IntrinsicHelper::F2I: + case compiler_llvm::IntrinsicHelper::D2I: + case compiler_llvm::IntrinsicHelper::F2L: + case compiler_llvm::IntrinsicHelper::D2L: CvtFPToInt(cu, call_inst); break; - case greenland::IntrinsicHelper::CmplFloat: + case compiler_llvm::IntrinsicHelper::CmplFloat: CvtFPCompare(cu, call_inst, Instruction::CMPL_FLOAT); break; - case greenland::IntrinsicHelper::CmpgFloat: + case compiler_llvm::IntrinsicHelper::CmpgFloat: CvtFPCompare(cu, call_inst, Instruction::CMPG_FLOAT); break; - case greenland::IntrinsicHelper::CmplDouble: + case compiler_llvm::IntrinsicHelper::CmplDouble: CvtFPCompare(cu, call_inst, Instruction::CMPL_DOUBLE); break; - case greenland::IntrinsicHelper::CmpgDouble: + case compiler_llvm::IntrinsicHelper::CmpgDouble: CvtFPCompare(cu, call_inst, Instruction::CMPG_DOUBLE); break; - case greenland::IntrinsicHelper::CmpLong: + case compiler_llvm::IntrinsicHelper::CmpLong: CvtLongCompare(cu, call_inst); break; - case greenland::IntrinsicHelper::SHLLong: + case compiler_llvm::IntrinsicHelper::SHLLong: CvtShiftOp(cu, Instruction::SHL_LONG, call_inst); break; - case greenland::IntrinsicHelper::SHRLong: + case compiler_llvm::IntrinsicHelper::SHRLong: CvtShiftOp(cu, Instruction::SHR_LONG, call_inst); break; - case greenland::IntrinsicHelper::USHRLong: + case compiler_llvm::IntrinsicHelper::USHRLong: CvtShiftOp(cu, Instruction::USHR_LONG, call_inst); break; - case greenland::IntrinsicHelper::SHLInt: + case compiler_llvm::IntrinsicHelper::SHLInt: CvtShiftOp(cu, Instruction::SHL_INT, call_inst); break; - case greenland::IntrinsicHelper::SHRInt: + case compiler_llvm::IntrinsicHelper::SHRInt: CvtShiftOp(cu, Instruction::SHR_INT, call_inst); break; - case greenland::IntrinsicHelper::USHRInt: + case compiler_llvm::IntrinsicHelper::USHRInt: CvtShiftOp(cu, Instruction::USHR_INT, call_inst); break; - case greenland::IntrinsicHelper::CatchTargets: { + case compiler_llvm::IntrinsicHelper::CatchTargets: { llvm::SwitchInst* sw_inst = llvm::dyn_cast<llvm::SwitchInst>(next_it); DCHECK(sw_inst != NULL); @@ -3456,9 +3454,9 @@ void MethodBitcode2LIR(CompilationUnit* cu) llvm::CallInst* call_inst = llvm::dyn_cast<llvm::CallInst>(&*i); if (call_inst != NULL) { llvm::Function* callee = call_inst->getCalledFunction(); - greenland::IntrinsicHelper::IntrinsicId id = + compiler_llvm::IntrinsicHelper::IntrinsicId id = cu->intrinsic_helper->GetIntrinsicId(callee); - if (id == greenland::IntrinsicHelper::MethodInfo) { + if (id == compiler_llvm::IntrinsicHelper::MethodInfo) { if (cu->verbose) { LOG(INFO) << "Found MethodInfo"; } diff --git a/src/compiler_llvm/backend_types.h b/src/compiler_llvm/backend_types.h index 14b8a664f9..cd889fa24e 100644 --- a/src/compiler_llvm/backend_types.h +++ b/src/compiler_llvm/backend_types.h @@ -38,15 +38,6 @@ enum JType { MAX_JTYPE }; - -enum JTypeSpace { - kAccurate, - kReg, - kField, - kArray, -}; - - enum RegCategory { kRegUnknown, kRegZero, diff --git a/src/compiler_llvm/gbc_expander.cc b/src/compiler_llvm/gbc_expander.cc index 3ed8cba35f..086d29db1e 100644 --- a/src/compiler_llvm/gbc_expander.cc +++ b/src/compiler_llvm/gbc_expander.cc @@ -18,7 +18,7 @@ #include "utils_llvm.h" #include "compiler.h" -#include "greenland/intrinsic_helper.h" +#include "intrinsic_helper.h" #include "mirror/abstract_method.h" #include "mirror/array.h" #include "oat_compilation_unit.h" @@ -43,7 +43,7 @@ using art::kMIRIgnoreRangeCheck; using namespace art::compiler_llvm; -using art::greenland::IntrinsicHelper; +using art::compiler_llvm::IntrinsicHelper; namespace art { extern char RemapShorty(char shortyType); @@ -125,6 +125,12 @@ class GBCExpanderPass : public llvm::FunctionPass { llvm::BasicBlock* new_basic_block); + // Sign or zero extend category 1 types < 32bits in size to 32bits. + llvm::Value* SignOrZeroExtendCat1Types(llvm::Value* value, JType jty); + + // Truncate category 1 types from 32bits to the given JType size. + llvm::Value* TruncateCat1Types(llvm::Value* value, JType jty); + //---------------------------------------------------------------------------- // Dex cache code generation helper function //---------------------------------------------------------------------------- @@ -752,7 +758,7 @@ llvm::Value* GBCExpanderPass::EmitArrayGEP(llvm::Value* array_addr, llvm::Constant* data_offset_value = irb_.getPtrEquivInt(data_offset); - llvm::Type* elem_type = irb_.getJType(elem_jty, kArray); + llvm::Type* elem_type = irb_.getJType(elem_jty); llvm::Value* array_data_addr = irb_.CreatePtrDisp(array_addr, data_offset_value, @@ -913,7 +919,7 @@ llvm::Value* GBCExpanderPass::Expand_IGetFast(llvm::Value* field_offset_value, DCHECK_GE(field_offset, 0); llvm::PointerType* field_type = - irb_.getJType(field_jty, kField)->getPointerTo(); + irb_.getJType(field_jty)->getPointerTo(); field_offset_value = irb_.getPtrEquivInt(field_offset); @@ -936,7 +942,7 @@ void GBCExpanderPass::Expand_IPutFast(llvm::Value* field_offset_value, DCHECK_GE(field_offset, 0); llvm::PointerType* field_type = - irb_.getJType(field_jty, kField)->getPointerTo(); + irb_.getJType(field_jty)->getPointerTo(); field_offset_value = irb_.getPtrEquivInt(field_offset); @@ -963,7 +969,7 @@ llvm::Value* GBCExpanderPass::Expand_SGetFast(llvm::Value* static_storage_addr, llvm::Value* static_field_addr = irb_.CreatePtrDisp(static_storage_addr, static_field_offset_value, - irb_.getJType(field_jty, kField)->getPointerTo()); + irb_.getJType(field_jty)->getPointerTo()); // TODO: Check is_volatile. We need to generate atomic store instruction // when is_volatile is true. @@ -984,7 +990,7 @@ void GBCExpanderPass::Expand_SPutFast(llvm::Value* static_storage_addr, llvm::Value* static_field_addr = irb_.CreatePtrDisp(static_storage_addr, static_field_offset_value, - irb_.getJType(field_jty, kField)->getPointerTo()); + irb_.getJType(field_jty)->getPointerTo()); // TODO: Check is_volatile. We need to generate atomic store instruction // when is_volatile is true. @@ -1070,7 +1076,7 @@ llvm::Value* GBCExpanderPass::Expand_DivRem(llvm::CallInst& call_inst, // That case will cause overflow, which is undefined behavior in llvm. // So we check the divisor is -1 or not, if the divisor is -1, we do // the special path to avoid undefined behavior. - llvm::Type* op_type = irb_.getJType(op_jty, kAccurate); + llvm::Type* op_type = irb_.getJType(op_jty); llvm::Value* zero = irb_.getJZero(op_jty); llvm::Value* neg_one = llvm::ConstantInt::getSigned(op_type, -1); @@ -1291,6 +1297,47 @@ llvm::Value* GBCExpanderPass::Expand_IntegerShift(llvm::Value* src1_value, } } +llvm::Value* GBCExpanderPass::SignOrZeroExtendCat1Types(llvm::Value* value, JType jty) { + switch (jty) { + case kBoolean: + case kChar: + return irb_.CreateZExt(value, irb_.getJType(kInt)); + case kByte: + case kShort: + return irb_.CreateSExt(value, irb_.getJType(kInt)); + case kVoid: + case kInt: + case kLong: + case kFloat: + case kDouble: + case kObject: + return value; // Nothing to do. + default: + LOG(FATAL) << "Unknown java type: " << jty; + return NULL; + } +} + +llvm::Value* GBCExpanderPass::TruncateCat1Types(llvm::Value* value, JType jty) { + switch (jty) { + case kBoolean: + case kChar: + case kByte: + case kShort: + return irb_.CreateTrunc(value, irb_.getJType(jty)); + case kVoid: + case kInt: + case kLong: + case kFloat: + case kDouble: + case kObject: + return value; // Nothing to do. + default: + LOG(FATAL) << "Unknown java type: " << jty; + return NULL; + } +} + llvm::Value* GBCExpanderPass::Expand_HLArrayGet(llvm::CallInst& call_inst, JType elem_jty) { uint32_t dex_pc = LV2UInt(call_inst.getMetadata("DexOff")->getOperand(0)); @@ -1309,32 +1356,7 @@ llvm::Value* GBCExpanderPass::Expand_HLArrayGet(llvm::CallInst& call_inst, llvm::Value* array_elem_value = irb_.CreateLoad(array_elem_addr, kTBAAHeapArray, elem_jty); - switch (elem_jty) { - case kVoid: - break; - - case kBoolean: - case kChar: - array_elem_value = irb_.CreateZExt(array_elem_value, irb_.getJType(elem_jty, kReg)); - break; - - case kByte: - case kShort: - array_elem_value = irb_.CreateSExt(array_elem_value, irb_.getJType(elem_jty, kReg)); - break; - - case kInt: - case kLong: - case kFloat: - case kDouble: - case kObject: - break; - - default: - LOG(FATAL) << "Unknown java type: " << elem_jty; - } - - return array_elem_value; + return SignOrZeroExtendCat1Types(array_elem_value, elem_jty); } @@ -1353,27 +1375,7 @@ void GBCExpanderPass::Expand_HLArrayPut(llvm::CallInst& call_inst, EmitGuard_ArrayIndexOutOfBoundsException(dex_pc, array_addr, index_value); } - switch (elem_jty) { - case kVoid: - break; - - case kBoolean: - case kChar: - case kByte: - case kShort: - new_value = irb_.CreateTrunc(new_value, irb_.getJType(elem_jty, kArray)); - break; - - case kInt: - case kLong: - case kFloat: - case kDouble: - case kObject: - break; - - default: - LOG(FATAL) << "Unknown java type: " << elem_jty; - } + new_value = TruncateCat1Types(new_value, elem_jty); llvm::Value* array_elem_addr = EmitArrayGEP(array_addr, index_value, elem_jty); @@ -1436,7 +1438,7 @@ llvm::Value* GBCExpanderPass::Expand_HLIGet(llvm::CallInst& call_inst, DCHECK_GE(field_offset, 0); llvm::PointerType* field_type = - irb_.getJType(field_jty, kField)->getPointerTo(); + irb_.getJType(field_jty)->getPointerTo(); llvm::ConstantInt* field_offset_value = irb_.getPtrEquivInt(field_offset); @@ -1446,10 +1448,11 @@ llvm::Value* GBCExpanderPass::Expand_HLIGet(llvm::CallInst& call_inst, // TODO: Check is_volatile. We need to generate atomic load instruction // when is_volatile is true. field_value = irb_.CreateLoad(field_addr, kTBAAHeapInstance, field_jty); + field_value = SignOrZeroExtendCat1Types(field_value, field_jty); } if (field_jty == kFloat || field_jty == kDouble) { - field_value = irb_.CreateBitCast(field_value, irb_.getJType(field_jty, kAccurate)); + field_value = irb_.CreateBitCast(field_value, irb_.getJType(field_jty)); } return field_value; @@ -1464,7 +1467,7 @@ void GBCExpanderPass::Expand_HLIPut(llvm::CallInst& call_inst, int opt_flags = LV2UInt(call_inst.getArgOperand(0)); if (field_jty == kFloat || field_jty == kDouble) { - new_value = irb_.CreateBitCast(new_value, irb_.getJType(field_jty, kField)); + new_value = irb_.CreateBitCast(new_value, irb_.getJType(field_jty)); } if (!(opt_flags & MIR_IGNORE_NULL_CHECK)) { @@ -1502,7 +1505,7 @@ void GBCExpanderPass::Expand_HLIPut(llvm::CallInst& call_inst, DCHECK_GE(field_offset, 0); llvm::PointerType* field_type = - irb_.getJType(field_jty, kField)->getPointerTo(); + irb_.getJType(field_jty)->getPointerTo(); llvm::Value* field_offset_value = irb_.getPtrEquivInt(field_offset); @@ -1511,6 +1514,7 @@ void GBCExpanderPass::Expand_HLIPut(llvm::CallInst& call_inst, // TODO: Check is_volatile. We need to generate atomic store instruction // when is_volatile is true. + new_value = TruncateCat1Types(new_value, field_jty); irb_.CreateStore(new_value, field_addr, kTBAAHeapInstance, field_jty); if (field_jty == kObject) { // If put an object, mark the GC card table. @@ -1718,16 +1722,17 @@ llvm::Value* GBCExpanderPass::Expand_HLSget(llvm::CallInst& call_inst, llvm::Value* static_field_addr = irb_.CreatePtrDisp(static_storage_addr, static_field_offset_value, - irb_.getJType(field_jty, kField)->getPointerTo()); + irb_.getJType(field_jty)->getPointerTo()); // TODO: Check is_volatile. We need to generate atomic load instruction // when is_volatile is true. static_field_value = irb_.CreateLoad(static_field_addr, kTBAAHeapStatic, field_jty); + static_field_value = SignOrZeroExtendCat1Types(static_field_value, field_jty); } if (field_jty == kFloat || field_jty == kDouble) { static_field_value = - irb_.CreateBitCast(static_field_value, irb_.getJType(field_jty, kAccurate)); + irb_.CreateBitCast(static_field_value, irb_.getJType(field_jty)); } return static_field_value; @@ -1740,7 +1745,7 @@ void GBCExpanderPass::Expand_HLSput(llvm::CallInst& call_inst, llvm::Value* new_value = call_inst.getArgOperand(1); if (field_jty == kFloat || field_jty == kDouble) { - new_value = irb_.CreateBitCast(new_value, irb_.getJType(field_jty, kField)); + new_value = irb_.CreateBitCast(new_value, irb_.getJType(field_jty)); } int field_offset; @@ -1799,10 +1804,11 @@ void GBCExpanderPass::Expand_HLSput(llvm::CallInst& call_inst, llvm::Value* static_field_addr = irb_.CreatePtrDisp(static_storage_addr, static_field_offset_value, - irb_.getJType(field_jty, kField)->getPointerTo()); + irb_.getJType(field_jty)->getPointerTo()); // TODO: Check is_volatile. We need to generate atomic store instruction // when is_volatile is true. + new_value = TruncateCat1Types(new_value, field_jty); irb_.CreateStore(new_value, static_field_addr, kTBAAHeapStatic, field_jty); if (field_jty == kObject) { // If put an object, mark the GC card table. @@ -2488,7 +2494,7 @@ llvm::FunctionType* GBCExpanderPass::GetFunctionType(uint32_t method_idx, char ret_shorty = shorty[0]; ret_shorty = art::RemapShorty(ret_shorty); - llvm::Type* ret_type = irb_.getJType(ret_shorty, kAccurate); + llvm::Type* ret_type = irb_.getJType(ret_shorty); // Get argument type std::vector<llvm::Type*> args_type; @@ -2496,12 +2502,12 @@ llvm::FunctionType* GBCExpanderPass::GetFunctionType(uint32_t method_idx, args_type.push_back(irb_.getJObjectTy()); // method object pointer if (!is_static) { - args_type.push_back(irb_.getJType('L', kAccurate)); // "this" object pointer + args_type.push_back(irb_.getJType('L')); // "this" object pointer } for (uint32_t i = 1; i < shorty_size; ++i) { char shorty_type = art::RemapShorty(shorty[i]); - args_type.push_back(irb_.getJType(shorty_type, kAccurate)); + args_type.push_back(irb_.getJType(shorty_type)); } return llvm::FunctionType::get(ret_type, args_type, false); diff --git a/src/greenland/intrinsic_func_list.def b/src/compiler_llvm/intrinsic_func_list.def index e6e3ec2f7c..b3ea3f9ed8 100644 --- a/src/greenland/intrinsic_func_list.def +++ b/src/compiler_llvm/intrinsic_func_list.def @@ -55,30 +55,30 @@ // Thread //---------------------------------------------------------------------------- -// Thread* dex_lang_get_current_thread() +// Thread* art_portable_get_current_thread() _EVAL_DEF_INTRINSICS_FUNC(GetCurrentThread, - dex_lang_get_current_thread, + art_portable_get_current_thread, kAttrReadNone | kAttrNoThrow, kJavaThreadTy, _EXPAND_ARG0()) -// void dex_lang_test_suspend(Thread* thread) +// void art_portable_test_suspend(Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(TestSuspend, - dex_lang_test_suspend, + art_portable_test_suspend, kAttrNoThrow, kVoidTy, _EXPAND_ARG1(kJavaThreadTy)) -// void dex_lang_check_suspend() /* Expands to GetCurrentThread/TestSuspend */ +// void art_portable_check_suspend() /* Expands to GetCurrentThread/TestSuspend */ _EVAL_DEF_INTRINSICS_FUNC(CheckSuspend, - dex_lang_check_suspend, + art_portable_check_suspend, kAttrNoThrow, kVoidTy, _EXPAND_ARG0()) -// void dex_lang_mark_gc_card(Object* new_value, Object* object) +// void art_portable_mark_gc_card(Object* new_value, Object* object) _EVAL_DEF_INTRINSICS_FUNC(MarkGCCard, - dex_lang_mark_gc_card, + art_portable_mark_gc_card, kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy)) @@ -92,65 +92,65 @@ _EVAL_DEF_INTRINSICS_FUNC(MarkGCCard, // instruction will be followed by a switch statement. The catch // targets will be enumerated as cases of the switch, with the fallthrough // designating the block containing the potentially throwing instruction. -// bool dex_lang_catch_targets(int dex_pc) +// bool art_portable_catch_targets(int dex_pc) _EVAL_DEF_INTRINSICS_FUNC(CatchTargets, - dex_lang_catch_targets, + art_portable_catch_targets, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32ConstantTy)) -// void dex_lang_throw_exception(JavaObject* exception) +// void art_portable_throw_exception(JavaObject* exception) _EVAL_DEF_INTRINSICS_FUNC(ThrowException, - dex_lang_throw_exception, + art_portable_throw_exception, kAttrDoThrow, kVoidTy, _EXPAND_ARG1(kJavaObjectTy)) -// void dex_lang_hl_throw_exception(JavaObject* exception) +// void art_portable_hl_throw_exception(JavaObject* exception) _EVAL_DEF_INTRINSICS_FUNC(HLThrowException, - dex_lang_hl_throw_exception, + art_portable_hl_throw_exception, kAttrDoThrow, kVoidTy, _EXPAND_ARG1(kJavaObjectTy)) -// JavaObject* dex_lang_get_current_exception() +// JavaObject* art_portable_get_current_exception() _EVAL_DEF_INTRINSICS_FUNC(GetException, - dex_lang_get_current_exception, + art_portable_get_current_exception, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG0()) -// bool dex_lang_is_exception_pending() +// bool art_portable_is_exception_pending() _EVAL_DEF_INTRINSICS_FUNC(IsExceptionPending, - dex_lang_is_exception_pending, + art_portable_is_exception_pending, kAttrReadOnly | kAttrNoThrow, kInt1Ty, _EXPAND_ARG0()) -// int dex_lang_find_catch_block(Method* method, int try_item_offset) +// int art_portable_find_catch_block(Method* method, int try_item_offset) _EVAL_DEF_INTRINSICS_FUNC(FindCatchBlock, - dex_lang_find_catch_block, + art_portable_find_catch_block, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kJavaMethodTy, kInt32ConstantTy)) -// void dex_lang_throw_div_zero() +// void art_portable_throw_div_zero() _EVAL_DEF_INTRINSICS_FUNC(ThrowDivZeroException, - dex_lang_throw_div_zero, + art_portable_throw_div_zero, kAttrDoThrow, kVoidTy, _EXPAND_ARG0()) -// void dex_lang_throw_null_pointer_exception(uint32_t dex_pc) +// void art_portable_throw_null_pointer_exception(uint32_t dex_pc) _EVAL_DEF_INTRINSICS_FUNC(ThrowNullPointerException, - dex_lang_throw_null_pointer_exception, + art_portable_throw_null_pointer_exception, kAttrDoThrow, kVoidTy, _EXPAND_ARG1(kInt32ConstantTy)) -// void dex_lang_throw_array_bounds(int index, int array_len) +// void art_portable_throw_array_bounds(int index, int array_len) _EVAL_DEF_INTRINSICS_FUNC(ThrowIndexOutOfBounds, - dex_lang_throw_array_bounds, + art_portable_throw_array_bounds, kAttrDoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) @@ -159,23 +159,23 @@ _EVAL_DEF_INTRINSICS_FUNC(ThrowIndexOutOfBounds, // ConstString //---------------------------------------------------------------------------- -// JavaObject* dex_lang_const_string(uint32_t string_idx) +// JavaObject* art_portable_const_string(uint32_t string_idx) _EVAL_DEF_INTRINSICS_FUNC(ConstString, - dex_lang_const_string, + art_portable_const_string, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kInt32ConstantTy)) -// JavaObject* dex_lang_load_string_from_dex_cache(Method* method, uint32_t string_idx) +// JavaObject* art_portable_load_string_from_dex_cache(Method* method, uint32_t string_idx) _EVAL_DEF_INTRINSICS_FUNC(LoadStringFromDexCache, - dex_lang_load_string_from_dex_cache, + art_portable_load_string_from_dex_cache, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kInt32ConstantTy)) -// JavaObject* dex_lang_resolve_string(Method* method, uint32_t string_idx) +// JavaObject* art_portable_resolve_string(Method* method, uint32_t string_idx) _EVAL_DEF_INTRINSICS_FUNC(ResolveString, - dex_lang_resolve_string, + art_portable_resolve_string, kAttrNone, kJavaObjectTy, _EXPAND_ARG2(kJavaMethodTy, kInt32ConstantTy)) @@ -184,34 +184,34 @@ _EVAL_DEF_INTRINSICS_FUNC(ResolveString, // ConstClass //---------------------------------------------------------------------------- -// JavaObject* dex_lang_const_class(uint32_t type_idx) +// JavaObject* art_portable_const_class(uint32_t type_idx) _EVAL_DEF_INTRINSICS_FUNC(ConstClass, - dex_lang_const_class, + art_portable_const_class, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kInt32ConstantTy)) -// JavaObject* dex_lang_initialize_type_and_verify_access(uint32_t type_idx, +// JavaObject* art_portable_initialize_type_and_verify_access(uint32_t type_idx, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(InitializeTypeAndVerifyAccess, - dex_lang_initialize_type_and_verify_access, + art_portable_initialize_type_and_verify_access, kAttrNone, kJavaObjectTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy)) -// JavaObject* dex_lang_load_type_from_dex_cache(uint32_t type_idx) +// JavaObject* art_portable_load_type_from_dex_cache(uint32_t type_idx) _EVAL_DEF_INTRINSICS_FUNC(LoadTypeFromDexCache, - dex_lang_load_type_from_dex_cache, + art_portable_load_type_from_dex_cache, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kInt32ConstantTy)) -// JavaObject* dex_lang_initialize_type(uint32_t type_idx, +// JavaObject* art_portable_initialize_type(uint32_t type_idx, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(InitializeType, - dex_lang_initialize_type, + art_portable_initialize_type, kAttrNone, kJavaObjectTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy)) @@ -220,16 +220,16 @@ _EVAL_DEF_INTRINSICS_FUNC(InitializeType, // Lock //---------------------------------------------------------------------------- -// void dex_lang_lock_object(JavaObject* obj, Thread* thread) +// void art_portable_lock_object(JavaObject* obj, Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(LockObject, - dex_lang_lock_object, + art_portable_lock_object, kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kJavaObjectTy, kJavaThreadTy)) -// void dex_lang_unlock_object(JavaObject* obj, Thread* thread) +// void art_portable_unlock_object(JavaObject* obj, Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(UnlockObject, - dex_lang_unlock_object, + art_portable_unlock_object, kAttrNone, kVoidTy, _EXPAND_ARG2(kJavaObjectTy, kJavaThreadTy)) @@ -238,23 +238,23 @@ _EVAL_DEF_INTRINSICS_FUNC(UnlockObject, // Cast //---------------------------------------------------------------------------- -// void dex_lang_check_cast(JavaObject* dest_type, JavaObject* src_type) +// void art_portable_check_cast(JavaObject* dest_type, JavaObject* src_type) _EVAL_DEF_INTRINSICS_FUNC(CheckCast, - dex_lang_check_cast, + art_portable_check_cast, kAttrNone, kVoidTy, _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy)) -// void dex_lang_hl_check_cast(uint32_t type_idx, JavaObject* obj) +// void art_portable_hl_check_cast(uint32_t type_idx, JavaObject* obj) _EVAL_DEF_INTRINSICS_FUNC(HLCheckCast, - dex_lang_hl_check_cast, + art_portable_hl_check_cast, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32ConstantTy, kJavaObjectTy)) -// int dex_lang_is_assignable(JavaObject* dest_type, JavaObject* src_type) +// int art_portable_is_assignable(JavaObject* dest_type, JavaObject* src_type) _EVAL_DEF_INTRINSICS_FUNC(IsAssignable, - dex_lang_is_assignable, + art_portable_is_assignable, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy)) @@ -263,20 +263,20 @@ _EVAL_DEF_INTRINSICS_FUNC(IsAssignable, // Allocation //---------------------------------------------------------------------------- -// JavaObject* dex_lang_alloc_object(uint32_t type_idx, +// JavaObject* art_portable_alloc_object(uint32_t type_idx, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(AllocObject, - dex_lang_alloc_object, + art_portable_alloc_object, kAttrNone, kJavaObjectTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy)) -// JavaObject* dex_lang_alloc_object_with_access_check(uint32_t type_idx, +// JavaObject* art_portable_alloc_object_with_access_check(uint32_t type_idx, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(AllocObjectWithAccessCheck, - dex_lang_alloc_object_with_access_check, + art_portable_alloc_object_with_access_check, kAttrNone, kJavaObjectTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy)) @@ -285,16 +285,16 @@ _EVAL_DEF_INTRINSICS_FUNC(AllocObjectWithAccessCheck, // Instance //---------------------------------------------------------------------------- -// JavaObject* dex_lang_new_instance(uint32_t type_idx) +// JavaObject* art_portable_new_instance(uint32_t type_idx) _EVAL_DEF_INTRINSICS_FUNC(NewInstance, - dex_lang_new_instance, + art_portable_new_instance, kAttrNone, kJavaObjectTy, _EXPAND_ARG1(kInt32Ty)) -// bool dex_lang_instance_of(uint32_t type_idx, JavaObject* ref) +// bool art_portable_instance_of(uint32_t type_idx, JavaObject* ref) _EVAL_DEF_INTRINSICS_FUNC(InstanceOf, - dex_lang_instance_of, + art_portable_instance_of, kAttrNone, kInt32Ty, _EXPAND_ARG2(kInt32Ty, kJavaObjectTy)) @@ -303,185 +303,185 @@ _EVAL_DEF_INTRINSICS_FUNC(InstanceOf, // Array //---------------------------------------------------------------------------- -// JavaObject* dex_lang_new_array(uint32_t type_idx, uint32_t array_size) +// JavaObject* art_portable_new_array(uint32_t type_idx, uint32_t array_size) _EVAL_DEF_INTRINSICS_FUNC(NewArray, - dex_lang_new_array, + art_portable_new_array, kAttrNone, kJavaObjectTy, _EXPAND_ARG2(kInt32ConstantTy, kInt32Ty)) -// uint32_t dex_lang_opt_array_length(int32_t opt_flags, JavaObject* array) +// uint32_t art_portable_opt_array_length(int32_t opt_flags, JavaObject* array) _EVAL_DEF_INTRINSICS_FUNC(OptArrayLength, - dex_lang_opt_array_length, + art_portable_opt_array_length, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kInt32Ty, kJavaObjectTy)) -// uint32_t dex_lang_array_length(JavaObject* array) +// uint32_t art_portable_array_length(JavaObject* array) _EVAL_DEF_INTRINSICS_FUNC(ArrayLength, - dex_lang_array_length, + art_portable_array_length, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kJavaObjectTy)) -// JavaObject* dex_lang_alloc_array(uint32_t type_idx, +// JavaObject* art_portable_alloc_array(uint32_t type_idx, // Method* referrer, // uint32_t length, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(AllocArray, - dex_lang_alloc_array, + art_portable_alloc_array, kAttrNone, kJavaObjectTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32Ty, kJavaThreadTy)) -// JavaObject* dex_lang_alloc_array_with_access_check(uint32_t type_idx, +// JavaObject* art_portable_alloc_array_with_access_check(uint32_t type_idx, // Method* referrer, // uint32_t length, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(AllocArrayWithAccessCheck, - dex_lang_alloc_array_with_access_check, + art_portable_alloc_array_with_access_check, kAttrNone, kJavaObjectTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32Ty, kJavaThreadTy)) -// JavaObject* dex_lang_check_and_alloc_array(uint32_t type_idx, +// JavaObject* art_portable_check_and_alloc_array(uint32_t type_idx, // Method* referrer, // uint32_t length, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(CheckAndAllocArray, - dex_lang_check_and_alloc_array, + art_portable_check_and_alloc_array, kAttrNone, kJavaObjectTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32ConstantTy, kJavaThreadTy)) -// JavaObject* dex_lang_check_and_alloc_array_with_access_check(uint32_t type_idx, +// JavaObject* art_portable_check_and_alloc_array_with_access_check(uint32_t type_idx, // Method* referrer, // uint32_t length, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(CheckAndAllocArrayWithAccessCheck, - dex_lang_check_and_alloc_array_with_access_check, + art_portable_check_and_alloc_array_with_access_check, kAttrNone, kJavaObjectTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kInt32ConstantTy, kJavaThreadTy)) -// dex_lang_aget_* and dex_lang_aput_* never generate exception since the +// art_portable_aget_* and art_portable_aput_* never generate exception since the // necessary checking on arguments (e.g., array and index) has already done // before invocation of these intrinsics. // -// [type] void dex_lang_aget_[type](JavaObject* array, uint32_t index) +// [type] void art_portable_aget_[type](JavaObject* array, uint32_t index) _EVAL_DEF_INTRINSICS_FUNC(ArrayGet, - dex_lang_aget, + art_portable_aget, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt32Ty, kArray), _EXPAND_ARG2(kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayGetWide, - dex_lang_aget_wide, + art_portable_aget_wide, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt64Ty, kArray), _EXPAND_ARG2(kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayGetObject, - dex_lang_aget_object, + art_portable_aget_object, kAttrReadOnly | kAttrNoThrow, _JTYPE(kJavaObjectTy, kArray), _EXPAND_ARG2(kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayGetBoolean, - dex_lang_aget_boolean, + art_portable_aget_boolean, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt1Ty, kArray), _EXPAND_ARG2(kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayGetByte, - dex_lang_aget_byte, + art_portable_aget_byte, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt8Ty, kArray), _EXPAND_ARG2(kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayGetChar, - dex_lang_aget_char, + art_portable_aget_char, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt16Ty, kArray), _EXPAND_ARG2(kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayGetShort, - dex_lang_aget_short, + art_portable_aget_short, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt16Ty, kArray), _EXPAND_ARG2(kJavaObjectTy, kInt32Ty)) -// void dex_lang_aput_[type]([type] value, JavaObject* array, uint32_t index) +// void art_portable_aput_[type]([type] value, JavaObject* array, uint32_t index) _EVAL_DEF_INTRINSICS_FUNC(ArrayPut, - dex_lang_aput, + art_portable_aput, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(_JTYPE(kInt32Ty, kArray), kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayPutWide, - dex_lang_aput_wide, + art_portable_aput_wide, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(_JTYPE(kInt64Ty, kArray), kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayPutObject, - dex_lang_aput_object, + art_portable_aput_object, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(_JTYPE(kJavaObjectTy, kArray), kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayPutBoolean, - dex_lang_aput_boolean, + art_portable_aput_boolean, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(_JTYPE(kInt1Ty, kArray), kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayPutByte, - dex_lang_aput_byte, + art_portable_aput_byte, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(_JTYPE(kInt8Ty, kArray), kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayPutChar, - dex_lang_aput_char, + art_portable_aput_char, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(_JTYPE(kInt16Ty, kArray), kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(ArrayPutShort, - dex_lang_aput_short, + art_portable_aput_short, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(_JTYPE(kInt16Ty, kArray), kJavaObjectTy, kInt32Ty)) -// void dex_lang_check_put_array_element(JavaObject* value, JavaObject* array) +// void art_portable_check_put_array_element(JavaObject* value, JavaObject* array) _EVAL_DEF_INTRINSICS_FUNC(CheckPutArrayElement, - dex_lang_check_put_array_element, + art_portable_check_put_array_element, kAttrNone, kVoidTy, _EXPAND_ARG2(kJavaObjectTy, kJavaObjectTy)) -// void dex_lang_filled_new_array(Array* array, +// void art_portable_filled_new_array(Array* array, // uint32_t elem_jty, ...) _EVAL_DEF_INTRINSICS_FUNC(FilledNewArray, - dex_lang_filled_new_array, + art_portable_filled_new_array, kAttrNoThrow, kVoidTy, _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kVarArgTy)) -// void dex_lang_fill_array_data(Method* referrer, +// void art_portable_fill_array_data(Method* referrer, // uint32_t dex_pc, // Array* array, // uint32_t payload_offset) _EVAL_DEF_INTRINSICS_FUNC(FillArrayData, - dex_lang_fill_array_data, + art_portable_fill_array_data, kAttrNone, kVoidTy, _EXPAND_ARG4(kJavaMethodTy, kInt32ConstantTy, kJavaObjectTy, kInt32ConstantTy)) -// void dex_lang_hl_fill_array_data(int32_t offset, JavaObject* array) +// void art_portable_hl_fill_array_data(int32_t offset, JavaObject* array) _EVAL_DEF_INTRINSICS_FUNC(HLFillArrayData, - dex_lang_hl_fill_array_data, + art_portable_hl_fill_array_data, kAttrNone, kVoidTy, _EXPAND_ARG2(kInt32ConstantTy, kJavaObjectTy)) @@ -490,184 +490,184 @@ _EVAL_DEF_INTRINSICS_FUNC(HLFillArrayData, // Instance Field //---------------------------------------------------------------------------- -// [type] dex_lang_iget_[type](uint32_t field_idx, +// [type] art_portable_iget_[type](uint32_t field_idx, // Method* referrer, // JavaObject* obj) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGet, - dex_lang_iget, + art_portable_iget, kAttrNone, _JTYPE(kInt32Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetWide, - dex_lang_iget_wide, + art_portable_iget_wide, kAttrNone, _JTYPE(kInt64Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetObject, - dex_lang_iget_object, + art_portable_iget_object, kAttrNone, _JTYPE(kJavaObjectTy, kField), _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetBoolean, - dex_lang_iget_boolean, + art_portable_iget_boolean, kAttrNone, _JTYPE(kInt1Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetByte, - dex_lang_iget_byte, + art_portable_iget_byte, kAttrNone, _JTYPE(kInt8Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetChar, - dex_lang_iget_char, + art_portable_iget_char, kAttrNone, _JTYPE(kInt16Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetShort, - dex_lang_iget_short, + art_portable_iget_short, kAttrNone, _JTYPE(kInt16Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy)) -// [type] dex_lang_iget_[type].fast(int field_offset, +// [type] art_portable_iget_[type].fast(int field_offset, // bool is_volatile, // JavaObject* obj) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetFast, - dex_lang_iget.fast, + art_portable_iget.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt32Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetWideFast, - dex_lang_iget_wide.fast, + art_portable_iget_wide.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt64Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetObjectFast, - dex_lang_iget_object.fast, + art_portable_iget_object.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kJavaObjectTy, kField), _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetBooleanFast, - dex_lang_iget_boolean.fast, + art_portable_iget_boolean.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt1Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetByteFast, - dex_lang_iget_byte.fast, + art_portable_iget_byte.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt8Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetCharFast, - dex_lang_iget_char.fast, + art_portable_iget_char.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt16Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy)) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldGetShortFast, - dex_lang_iget_short.fast, + art_portable_iget_short.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt16Ty, kField), _EXPAND_ARG3(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy)) -// void dex_lang_iput_[type](uint32_t field_idx, +// void art_portable_iput_[type](uint32_t field_idx, // Method* referrer, // JavaObject* obj, // [type] new_value) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPut, - dex_lang_iput, + art_portable_iput, kAttrNone, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt32Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutWide, - dex_lang_iput_wide, + art_portable_iput_wide, kAttrNone, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt64Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutObject, - dex_lang_iput_object, + art_portable_iput_object, kAttrNone, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kJavaObjectTy, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutBoolean, - dex_lang_iput_boolean, + art_portable_iput_boolean, kAttrNone, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt1Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutByte, - dex_lang_iput_byte, + art_portable_iput_byte, kAttrNone, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt8Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutChar, - dex_lang_iput_char, + art_portable_iput_char, kAttrNone, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutShort, - dex_lang_iput_short, + art_portable_iput_short, kAttrNone, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaMethodTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField))) -// void dex_lang_iput_[type].fast(int field_offset, +// void art_portable_iput_[type].fast(int field_offset, // bool is_volatile, // JavaObject* obj, // [type] new_value) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutFast, - dex_lang_iput.fast, + art_portable_iput.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt32Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutWideFast, - dex_lang_iput_wide.fast, + art_portable_iput_wide.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt64Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutObjectFast, - dex_lang_iput_object.fast, + art_portable_iput_object.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kJavaObjectTy, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutBooleanFast, - dex_lang_iput_boolean.fast, + art_portable_iput_boolean.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt1Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutByteFast, - dex_lang_iput_byte.fast, + art_portable_iput_byte.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt8Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutCharFast, - dex_lang_iput_char.fast, + art_portable_iput_char.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutShortFast, - dex_lang_iput_short.fast, + art_portable_iput_short.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32ConstantTy, kInt1ConstantTy, kJavaObjectTy, _JTYPE(kInt16Ty, kField))) @@ -676,205 +676,205 @@ _EVAL_DEF_INTRINSICS_FUNC(InstanceFieldPutShortFast, // Static Field //---------------------------------------------------------------------------- -// [type] dex_lang_sget_[type](uint32_t field_idx, Method* referrer) +// [type] art_portable_sget_[type](uint32_t field_idx, Method* referrer) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGet, - dex_lang_sget, + art_portable_sget, kAttrNone, _JTYPE(kInt32Ty, kField), _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetWide, - dex_lang_sget_wide, + art_portable_sget_wide, kAttrNone, _JTYPE(kInt64Ty, kField), _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetObject, - dex_lang_sget_object, + art_portable_sget_object, kAttrNone, _JTYPE(kJavaObjectTy, kField), _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetBoolean, - dex_lang_sget_boolean, + art_portable_sget_boolean, kAttrNone, _JTYPE(kInt1Ty, kField), _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetByte, - dex_lang_sget_byte, + art_portable_sget_byte, kAttrNone, _JTYPE(kInt8Ty, kField), _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetChar, - dex_lang_sget_char, + art_portable_sget_char, kAttrNone, _JTYPE(kInt16Ty, kField), _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetShort, - dex_lang_sget_short, + art_portable_sget_short, kAttrNone, _JTYPE(kInt16Ty, kField), _EXPAND_ARG2(kInt32ConstantTy, kJavaMethodTy)) -// [type] dex_lang_sget_[type].fast(JavaObject* ssb, +// [type] art_portable_sget_[type].fast(JavaObject* ssb, // int field_offset, // bool is_volatile) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetFast, - dex_lang_sget.fast, + art_portable_sget.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt32Ty, kField), _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetWideFast, - dex_lang_sget_wide.fast, + art_portable_sget_wide.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt64Ty, kField), _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetObjectFast, - dex_lang_sget_object.fast, + art_portable_sget_object.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kJavaObjectTy, kField), _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetBooleanFast, - dex_lang_sget_boolean.fast, + art_portable_sget_boolean.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt1Ty, kField), _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetByteFast, - dex_lang_sget_byte.fast, + art_portable_sget_byte.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt8Ty, kField), _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetCharFast, - dex_lang_sget_char.fast, + art_portable_sget_char.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt16Ty, kField), _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy)) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldGetShortFast, - dex_lang_sget_short.fast, + art_portable_sget_short.fast, kAttrReadOnly | kAttrNoThrow, _JTYPE(kInt16Ty, kField), _EXPAND_ARG3(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy)) -// void dex_lang_sput_[type](uint32_t field_idx, +// void art_portable_sput_[type](uint32_t field_idx, // Method* referrer, // [type] new_value) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPut, - dex_lang_sput, + art_portable_sput, kAttrNone, kVoidTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt32Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutWide, - dex_lang_sput_wide, + art_portable_sput_wide, kAttrNone, kVoidTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt64Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutObject, - dex_lang_sput_object, + art_portable_sput_object, kAttrNone, kVoidTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kJavaObjectTy, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutBoolean, - dex_lang_sput_boolean, + art_portable_sput_boolean, kAttrNone, kVoidTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt1Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutByte, - dex_lang_sput_byte, + art_portable_sput_byte, kAttrNone, kVoidTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt8Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutChar, - dex_lang_sput_char, + art_portable_sput_char, kAttrNone, kVoidTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt16Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutShort, - dex_lang_sput_short, + art_portable_sput_short, kAttrNone, kVoidTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, _JTYPE(kInt16Ty, kField))) -// void dex_lang_sput_[type].fast(JavaObject* ssb, +// void art_portable_sput_[type].fast(JavaObject* ssb, // int field_offset, // bool is_volatile, // [type] new_value) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutFast, - dex_lang_sput.fast, + art_portable_sput.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt32Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutWideFast, - dex_lang_sput_wide.fast, + art_portable_sput_wide.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt64Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutObjectFast, - dex_lang_sput_object.fast, + art_portable_sput_object.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kJavaObjectTy, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutBooleanFast, - dex_lang_sput_boolean.fast, + art_portable_sput_boolean.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt1Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutByteFast, - dex_lang_sput_byte.fast, + art_portable_sput_byte.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt8Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutCharFast, - dex_lang_sput_char.fast, + art_portable_sput_char.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt16Ty, kField))) _EVAL_DEF_INTRINSICS_FUNC(StaticFieldPutShortFast, - dex_lang_sput_short.fast, + art_portable_sput_short.fast, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kJavaObjectTy, kInt32ConstantTy, kInt1ConstantTy, _JTYPE(kInt16Ty, kField))) -// JavaObject* dex_lang_load_declaring_class_ssb(Method* method) +// JavaObject* art_portable_load_declaring_class_ssb(Method* method) // Load the static storage base of the class that given method resides _EVAL_DEF_INTRINSICS_FUNC(LoadDeclaringClassSSB, - dex_lang_load_declaring_class_ssb, + art_portable_load_declaring_class_ssb, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kJavaMethodTy)) -// JavaObject* dex_lang_load_class_ssb_from_dex_cache(uint32_t type_idx) +// JavaObject* art_portable_load_class_ssb_from_dex_cache(uint32_t type_idx) _EVAL_DEF_INTRINSICS_FUNC(LoadClassSSBFromDexCache, - dex_lang_load_class_ssb_from_dex_cache, + art_portable_load_class_ssb_from_dex_cache, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kInt32ConstantTy)) -// JavaObject* dex_lang_init_and_load_class_ssb(uint32_t type_idx, +// JavaObject* art_portable_init_and_load_class_ssb(uint32_t type_idx, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(InitializeAndLoadClassSSB, - dex_lang_init_and_load_class_ssb, + art_portable_init_and_load_class_ssb, kAttrNone, kJavaObjectTy, _EXPAND_ARG3(kInt32ConstantTy, kJavaMethodTy, kJavaThreadTy)) @@ -882,116 +882,116 @@ _EVAL_DEF_INTRINSICS_FUNC(InitializeAndLoadClassSSB, //---------------------------------------------------------------------------- // High-level Array get/put // -// Similar to dex_lang_aget/aput_xxx, but checks not yet performed. +// Similar to art_portable_aget/aput_xxx, but checks not yet performed. // OptFlags contain info describing whether frontend has determined that // null check and/or array bounds check may be skipped. // -// [type] void dex_lang_hl_aget_[type](int optFlags, JavaObject* array, uint32_t index) +// [type] void art_portable_hl_aget_[type](int optFlags, JavaObject* array, uint32_t index) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGet, - dex_lang_hl_aget, + art_portable_hl_aget, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetFloat, - dex_lang_hl_aget_float, + art_portable_hl_aget_float, kAttrReadOnly | kAttrNoThrow, kFloatTy, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetWide, - dex_lang_hl_aget_wide, + art_portable_hl_aget_wide, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetDouble, - dex_lang_hl_aget_double, + art_portable_hl_aget_double, kAttrReadOnly | kAttrNoThrow, kDoubleTy, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetObject, - dex_lang_hl_aget_object, + art_portable_hl_aget_object, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetBoolean, - dex_lang_hl_aget_boolean, + art_portable_hl_aget_boolean, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetByte, - dex_lang_hl_aget_byte, + art_portable_hl_aget_byte, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetChar, - dex_lang_hl_aget_char, + art_portable_hl_aget_char, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayGetShort, - dex_lang_hl_aget_short, + art_portable_hl_aget_short, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) -// void dex_lang_aput_[type](int optFlags, [type] value, JavaObject* array, uint32_t index) +// void art_portable_aput_[type](int optFlags, [type] value, JavaObject* array, uint32_t index) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPut, - dex_lang_hl_aput, + art_portable_hl_aput, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutFloat, - dex_lang_hl_aput_float, + art_portable_hl_aput_float, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kFloatTy, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutWide, - dex_lang_hl_aput_wide, + art_portable_hl_aput_wide, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt64Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutDouble, - dex_lang_hl_aput_double, + art_portable_hl_aput_double, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kDoubleTy, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutObject, - dex_lang_hl_aput_object, + art_portable_hl_aput_object, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kJavaObjectTy, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutBoolean, - dex_lang_hl_aput_boolean, + art_portable_hl_aput_boolean, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutByte, - dex_lang_hl_aput_byte, + art_portable_hl_aput_byte, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutChar, - dex_lang_hl_aput_char, + art_portable_hl_aput_char, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutShort, - dex_lang_hl_aput_short, + art_portable_hl_aput_short, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) @@ -999,116 +999,116 @@ _EVAL_DEF_INTRINSICS_FUNC(HLArrayPutShort, //---------------------------------------------------------------------------- // High-level Instance get/put // -// Similar to dex_lang_iget/iput_xxx, but checks not yet performed. +// Similar to art_portable_iget/iput_xxx, but checks not yet performed. // OptFlags contain info describing whether frontend has determined that // null check may be skipped. // -// [type] void dex_lang_hl_iget_[type](int optFlags, JavaObject* obj, uint32_t field_idx) +// [type] void art_portable_hl_iget_[type](int optFlags, JavaObject* obj, uint32_t field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLIGet, - dex_lang_hl_iget, + art_portable_hl_iget, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetFloat, - dex_lang_hl_iget_float, + art_portable_hl_iget_float, kAttrReadOnly | kAttrNoThrow, kFloatTy, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetWide, - dex_lang_hl_iget_wide, + art_portable_hl_iget_wide, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetDouble, - dex_lang_hl_iget_double, + art_portable_hl_iget_double, kAttrReadOnly | kAttrNoThrow, kDoubleTy, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetObject, - dex_lang_hl_iget_object, + art_portable_hl_iget_object, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetBoolean, - dex_lang_hl_iget_boolean, + art_portable_hl_iget_boolean, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetByte, - dex_lang_hl_iget_byte, + art_portable_hl_iget_byte, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetChar, - dex_lang_hl_iget_char, + art_portable_hl_iget_char, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIGetShort, - dex_lang_hl_iget_short, + art_portable_hl_iget_short, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG3(kInt32Ty, kJavaObjectTy, kInt32Ty)) -// void dex_lang_iput_[type](int optFlags, [type] value, JavaObject* obj, uint32_t field_idx) +// void art_portable_iput_[type](int optFlags, [type] value, JavaObject* obj, uint32_t field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLIPut, - dex_lang_hl_iput, + art_portable_hl_iput, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutFloat, - dex_lang_hl_iput_float, + art_portable_hl_iput_float, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kFloatTy, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutWide, - dex_lang_hl_iput_wide, + art_portable_hl_iput_wide, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt64Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutDouble, - dex_lang_hl_iput_double, + art_portable_hl_iput_double, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kDoubleTy, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutObject, - dex_lang_hl_iput_object, + art_portable_hl_iput_object, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kJavaObjectTy, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutBoolean, - dex_lang_hl_iput_boolean, + art_portable_hl_iput_boolean, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutByte, - dex_lang_hl_iput_byte, + art_portable_hl_iput_byte, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutChar, - dex_lang_hl_iput_char, + art_portable_hl_iput_char, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(HLIPutShort, - dex_lang_hl_iput_short, + art_portable_hl_iput_short, kAttrNoThrow, kVoidTy, _EXPAND_ARG4(kInt32Ty, kInt32Ty, kJavaObjectTy, kInt32Ty)) @@ -1128,49 +1128,49 @@ _EVAL_DEF_INTRINSICS_FUNC(HLIPutShort, //---------------------------------------------------------------------------- // INVOKE method returns void _EVAL_DEF_INTRINSICS_FUNC(HLInvokeVoid, - dex_lang_hl_invoke.void, + art_portable_hl_invoke.void, kAttrNone, kVoidTy, _EXPAND_ARG1(kVarArgTy)) // INVOKE method returns object _EVAL_DEF_INTRINSICS_FUNC(HLInvokeObj, - dex_lang_hl_invoke.obj, + art_portable_hl_invoke.obj, kAttrNone, kJavaObjectTy, _EXPAND_ARG1(kVarArgTy)) // INVOKE method returns int _EVAL_DEF_INTRINSICS_FUNC(HLInvokeInt, - dex_lang_hl_invoke.i32, + art_portable_hl_invoke.i32, kAttrNone, kInt32Ty, _EXPAND_ARG1(kVarArgTy)) // INVOKE method returns float _EVAL_DEF_INTRINSICS_FUNC(HLInvokeFloat, - dex_lang_hl_invoke.f32, + art_portable_hl_invoke.f32, kAttrNone, kFloatTy, _EXPAND_ARG1(kVarArgTy)) // INVOKE method returns long _EVAL_DEF_INTRINSICS_FUNC(HLInvokeLong, - dex_lang_hl_invoke.i64, + art_portable_hl_invoke.i64, kAttrNone, kInt64Ty, _EXPAND_ARG1(kVarArgTy)) // INVOKE method returns double _EVAL_DEF_INTRINSICS_FUNC(HLInvokeDouble, - dex_lang_hl_invoke.f64, + art_portable_hl_invoke.f64, kAttrNone, kDoubleTy, _EXPAND_ARG1(kVarArgTy)) // FILLED_NEW_ARRAY returns object _EVAL_DEF_INTRINSICS_FUNC(HLFilledNewArray, - dex_lang_hl_filled_new_array, + art_portable_hl_filled_new_array, kAttrNone, kJavaObjectTy, _EXPAND_ARG1(kVarArgTy)) @@ -1179,148 +1179,148 @@ _EVAL_DEF_INTRINSICS_FUNC(HLFilledNewArray, // Invoke //---------------------------------------------------------------------------- -// Method* dex_lang_find_static_method_with_access_check(uint32_t method_idx, +// Method* art_portable_find_static_method_with_access_check(uint32_t method_idx, // JavaObject* this, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(FindStaticMethodWithAccessCheck, - dex_lang_find_static_method_with_access_check, + art_portable_find_static_method_with_access_check, kAttrNone, kJavaMethodTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy)) -// Method* dex_lang_find_direct_method_with_access_check(uint32_t method_idx, +// Method* art_portable_find_direct_method_with_access_check(uint32_t method_idx, // JavaObject* this, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(FindDirectMethodWithAccessCheck, - dex_lang_find_direct_method_with_access_check, + art_portable_find_direct_method_with_access_check, kAttrNone, kJavaMethodTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy)) -// Method* dex_lang_find_virtual_method_with_access_check(uint32_t method_idx, +// Method* art_portable_find_virtual_method_with_access_check(uint32_t method_idx, // JavaObject* this, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(FindVirtualMethodWithAccessCheck, - dex_lang_find_virtual_method_with_access_check, + art_portable_find_virtual_method_with_access_check, kAttrNone, kJavaMethodTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy)) -// Method* dex_lang_find_super_method_with_access_check(uint32_t method_idx, +// Method* art_portable_find_super_method_with_access_check(uint32_t method_idx, // JavaObject* this, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(FindSuperMethodWithAccessCheck, - dex_lang_find_super_method_with_access_check, + art_portable_find_super_method_with_access_check, kAttrNone, kJavaMethodTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy)) -// Method* dex_lang_find_interface_method_with_access_check(uint32_t method_idx, +// Method* art_portable_find_interface_method_with_access_check(uint32_t method_idx, // JavaObject* this, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(FindInterfaceMethodWithAccessCheck, - dex_lang_find_interface_method_with_access_check, + art_portable_find_interface_method_with_access_check, kAttrNone, kJavaMethodTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy)) -// Method* dex_lang_get_sd_callee_method_obj_addr(uint32_t method_idx) +// Method* art_portable_get_sd_callee_method_obj_addr(uint32_t method_idx) _EVAL_DEF_INTRINSICS_FUNC(GetSDCalleeMethodObjAddrFast, - dex_lang_get_sd_callee_method_obj_addr_fast, + art_portable_get_sd_callee_method_obj_addr_fast, kAttrReadOnly | kAttrNoThrow, kJavaMethodTy, _EXPAND_ARG1(kInt32ConstantTy)) -// Method* dex_lang_get_virtual_callee_method_obj_addr(uint32_t vtable_idx, +// Method* art_portable_get_virtual_callee_method_obj_addr(uint32_t vtable_idx, // JavaObject* this) _EVAL_DEF_INTRINSICS_FUNC(GetVirtualCalleeMethodObjAddrFast, - dex_lang_get_virtual_callee_method_obj_addr_fast, + art_portable_get_virtual_callee_method_obj_addr_fast, kAttrReadOnly | kAttrNoThrow, kJavaMethodTy, _EXPAND_ARG2(kInt32ConstantTy, kJavaObjectTy)) -// Method* dex_lang_get_interface_callee_method_obj_addr(uint32_t method_idx, +// Method* art_portable_get_interface_callee_method_obj_addr(uint32_t method_idx, // JavaObject* this, // Method* referrer, // Thread* thread) _EVAL_DEF_INTRINSICS_FUNC(GetInterfaceCalleeMethodObjAddrFast, - dex_lang_get_interface_callee_method_obj_addr_fast, + art_portable_get_interface_callee_method_obj_addr_fast, kAttrNone, kJavaMethodTy, _EXPAND_ARG4(kInt32ConstantTy, kJavaObjectTy, kJavaMethodTy, kJavaThreadTy)) -// [type] dex_lang_invoke.[type](Method* callee, ...) +// [type] art_portable_invoke.[type](Method* callee, ...) // INVOKE method returns void _EVAL_DEF_INTRINSICS_FUNC(InvokeRetVoid, - dex_lang_invoke.void, + art_portable_invoke.void, kAttrNone, kVoidTy, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type boolean _EVAL_DEF_INTRINSICS_FUNC(InvokeRetBoolean, - dex_lang_invoke.bool, + art_portable_invoke.bool, kAttrNone, kInt1Ty, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type byte _EVAL_DEF_INTRINSICS_FUNC(InvokeRetByte, - dex_lang_invoke.byte, + art_portable_invoke.byte, kAttrNone, kInt8Ty, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type char _EVAL_DEF_INTRINSICS_FUNC(InvokeRetChar, - dex_lang_invoke.char, + art_portable_invoke.char, kAttrNone, kInt16Ty, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type short _EVAL_DEF_INTRINSICS_FUNC(InvokeRetShort, - dex_lang_invoke.short, + art_portable_invoke.short, kAttrNone, kInt16Ty, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type int _EVAL_DEF_INTRINSICS_FUNC(InvokeRetInt, - dex_lang_invoke.int, + art_portable_invoke.int, kAttrNone, kInt32Ty, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type long _EVAL_DEF_INTRINSICS_FUNC(InvokeRetLong, - dex_lang_invoke.long, + art_portable_invoke.long, kAttrNone, kInt64Ty, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type float _EVAL_DEF_INTRINSICS_FUNC(InvokeRetFloat, - dex_lang_invoke.float, + art_portable_invoke.float, kAttrNone, kFloatTy, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type double _EVAL_DEF_INTRINSICS_FUNC(InvokeRetDouble, - dex_lang_invoke.double, + art_portable_invoke.double, kAttrNone, kDoubleTy, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) // INVOKE method returns the value of type "object" _EVAL_DEF_INTRINSICS_FUNC(InvokeRetObject, - dex_lang_invoke.object, + art_portable_invoke.object, kAttrNone, kJavaObjectTy, _EXPAND_ARG2(kJavaMethodTy, kVarArgTy)) @@ -1329,56 +1329,56 @@ _EVAL_DEF_INTRINSICS_FUNC(InvokeRetObject, // Math //---------------------------------------------------------------------------- -// int dex_lang_{div,rem}_int(int a, int b) +// int art_portable_{div,rem}_int(int a, int b) _EVAL_DEF_INTRINSICS_FUNC(DivInt, - dex_lang_div_int, + art_portable_div_int, kAttrReadNone | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) _EVAL_DEF_INTRINSICS_FUNC(RemInt, - dex_lang_rem_int, + art_portable_rem_int, kAttrReadNone | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) -// long dex_lang_{div,rem}_long(long a, long b) +// long art_portable_{div,rem}_long(long a, long b) _EVAL_DEF_INTRINSICS_FUNC(DivLong, - dex_lang_div_long, + art_portable_div_long, kAttrReadNone | kAttrNoThrow, kInt64Ty, _EXPAND_ARG2(kInt64Ty, kInt64Ty)) _EVAL_DEF_INTRINSICS_FUNC(RemLong, - dex_lang_rem_long, + art_portable_rem_long, kAttrReadNone | kAttrNoThrow, kInt64Ty, _EXPAND_ARG2(kInt64Ty, kInt64Ty)) -// int64_t dex_lang_d2l(double f) +// int64_t art_portable_d2l(double f) _EVAL_DEF_INTRINSICS_FUNC(D2L, - dex_lang_d2l, + art_portable_d2l, kAttrReadNone | kAttrNoThrow, kInt64Ty, _EXPAND_ARG1(kDoubleTy)) -// int32_t dex_lang_d2l(double f) +// int32_t art_portable_d2l(double f) _EVAL_DEF_INTRINSICS_FUNC(D2I, - dex_lang_d2i, + art_portable_d2i, kAttrReadNone | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kDoubleTy)) -// int64_t dex_lang_f2l(float f) +// int64_t art_portable_f2l(float f) _EVAL_DEF_INTRINSICS_FUNC(F2L, - dex_lang_f2l, + art_portable_f2l, kAttrReadNone | kAttrNoThrow, kInt64Ty, _EXPAND_ARG1(kFloatTy)) -// int32_t dex_lang_f2i(float f) +// int32_t art_portable_f2i(float f) _EVAL_DEF_INTRINSICS_FUNC(F2I, - dex_lang_f2i, + art_portable_f2i, kAttrReadNone | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kFloatTy)) @@ -1391,63 +1391,63 @@ _EVAL_DEF_INTRINSICS_FUNC(F2I, // void sput_hl(int field_idx, int val) _EVAL_DEF_INTRINSICS_FUNC(HLSput, - dex_lang_hl_sput, + art_portable_hl_sput, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) // void sput_hl_object(int field_idx, object* val) _EVAL_DEF_INTRINSICS_FUNC(HLSputObject, - dex_lang_hl_sput_object, + art_portable_hl_sput_object, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kJavaObjectTy)) // void sput_hl_boolean(int field_idx, kInt1Ty) _EVAL_DEF_INTRINSICS_FUNC(HLSputBoolean, - dex_lang_hl_sput_boolean, + art_portable_hl_sput_boolean, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) // void sput_hl_byte(int field_idx, int val) _EVAL_DEF_INTRINSICS_FUNC(HLSputByte, - dex_lang_hl_sput_byte, + art_portable_hl_sput_byte, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) // void sput_hl_char(int field_idx, kInt16Ty val) _EVAL_DEF_INTRINSICS_FUNC(HLSputChar, - dex_lang_hl_sput_char, + art_portable_hl_sput_char, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) // void sput_hl_short(int field_idx, int val) _EVAL_DEF_INTRINSICS_FUNC(HLSputShort, - dex_lang_hl_sput_short, + art_portable_hl_sput_short, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kInt32Ty)) // void sput_hl_wide(int field_idx, long val) _EVAL_DEF_INTRINSICS_FUNC(HLSputWide, - dex_lang_hl_sput_wide, + art_portable_hl_sput_wide, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kInt64Ty)) // void sput_hl_double(int field_idx, double val) _EVAL_DEF_INTRINSICS_FUNC(HLSputDouble, - dex_lang_hl_sput_double, + art_portable_hl_sput_double, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kDoubleTy)) // void sput_hl_float(int field_idx, float val) _EVAL_DEF_INTRINSICS_FUNC(HLSputFloat, - dex_lang_hl_sput_float, + art_portable_hl_sput_float, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kFloatTy)) @@ -1460,79 +1460,79 @@ _EVAL_DEF_INTRINSICS_FUNC(HLSputFloat, // int sget_hl(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSget, - dex_lang_hl_sget, + art_portable_hl_sget, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // object* sget_hl_object(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetObject, - dex_lang_hl_sget_object, + art_portable_hl_sget_object, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kInt32Ty)) // boolean sget_hl_boolean(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetBoolean, - dex_lang_hl_sget_boolean, + art_portable_hl_sget_boolean, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // byte sget_hl_byte(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetByte, - dex_lang_hl_sget_byte, + art_portable_hl_sget_byte, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // char sget_hl_char(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetChar, - dex_lang_hl_sget_char, + art_portable_hl_sget_char, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // char sget_hl_short(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetShort, - dex_lang_hl_sget_short, + art_portable_hl_sget_short, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // char sget_hl_wide(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetWide, - dex_lang_hl_sget_wide, + art_portable_hl_sget_wide, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG1(kInt32Ty)) // char sget_hl_double(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetDouble, - dex_lang_hl_sget_double, + art_portable_hl_sget_double, kAttrReadOnly | kAttrNoThrow, kDoubleTy, _EXPAND_ARG1(kInt32Ty)) // char sget_hl_float(int field_idx) _EVAL_DEF_INTRINSICS_FUNC(HLSgetFloat, - dex_lang_hl_sget_float, + art_portable_hl_sget_float, kAttrReadOnly | kAttrNoThrow, kFloatTy, _EXPAND_ARG1(kInt32Ty)) //---------------------------------------------------------------------------- // Monitor enter/exit //---------------------------------------------------------------------------- -// uint32_t dex_lang_monitor_enter(int optFlags, JavaObject* obj) +// uint32_t art_portable_monitor_enter(int optFlags, JavaObject* obj) _EVAL_DEF_INTRINSICS_FUNC(MonitorEnter, - dex_lang_monitor_enter, + art_portable_monitor_enter, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kJavaObjectTy)) -// uint32_t dex_lang_monitor_exit(int optFlags, JavaObject* obj) +// uint32_t art_portable_monitor_exit(int optFlags, JavaObject* obj) _EVAL_DEF_INTRINSICS_FUNC(MonitorExit, - dex_lang_monitor_exit, + art_portable_monitor_exit, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32Ty, kJavaObjectTy)) @@ -1541,30 +1541,30 @@ _EVAL_DEF_INTRINSICS_FUNC(MonitorExit, // Shadow Frame //---------------------------------------------------------------------------- -// void dex_lang_alloca_shadow_frame(int num_entry) +// void art_portable_alloca_shadow_frame(int num_entry) _EVAL_DEF_INTRINSICS_FUNC(AllocaShadowFrame, - dex_lang_alloca_shadow_frame, + art_portable_alloca_shadow_frame, kAttrNoThrow, kVoidTy, _EXPAND_ARG1(kInt32ConstantTy)) -// void dex_lang_set_vreg(int entry_idx, ...) +// void art_portable_set_vreg(int entry_idx, ...) _EVAL_DEF_INTRINSICS_FUNC(SetVReg, - dex_lang_set_vreg, + art_portable_set_vreg, kAttrNoThrow, kVoidTy, _EXPAND_ARG2(kInt32ConstantTy, kVarArgTy)) -// void dex_lang_pop_shadow_frame() +// void art_portable_pop_shadow_frame() _EVAL_DEF_INTRINSICS_FUNC(PopShadowFrame, - dex_lang_pop_shadow_frame, + art_portable_pop_shadow_frame, kAttrNoThrow, kVoidTy, _EXPAND_ARG0()) -// void dex_lang_update_dex_pc(uint32_t dex_pc) +// void art_portable_update_dex_pc(uint32_t dex_pc) _EVAL_DEF_INTRINSICS_FUNC(UpdateDexPC, - dex_lang_update_dex_pc, + art_portable_update_dex_pc, kAttrNoThrow, kVoidTy, _EXPAND_ARG1(kInt32ConstantTy)) @@ -1574,28 +1574,28 @@ _EVAL_DEF_INTRINSICS_FUNC(UpdateDexPC, //---------------------------------------------------------------------------- // int cmpl_float(float, float) _EVAL_DEF_INTRINSICS_FUNC(CmplFloat, - dex_lang_cmpl_float, + art_portable_cmpl_float, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kFloatTy, kFloatTy)) // int cmpg_float(float, float) _EVAL_DEF_INTRINSICS_FUNC(CmpgFloat, - dex_lang_cmpg_float, + art_portable_cmpg_float, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kFloatTy, kFloatTy)) // int cmpl_double(double, double) _EVAL_DEF_INTRINSICS_FUNC(CmplDouble, - dex_lang_cmpl_double, + art_portable_cmpl_double, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kDoubleTy, kDoubleTy)) // int cmpg_double(double, double) _EVAL_DEF_INTRINSICS_FUNC(CmpgDouble, - dex_lang_cmpg_double, + art_portable_cmpg_double, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kDoubleTy, kDoubleTy)) @@ -1605,7 +1605,7 @@ _EVAL_DEF_INTRINSICS_FUNC(CmpgDouble, //---------------------------------------------------------------------------- // int cmp_long(long, long) _EVAL_DEF_INTRINSICS_FUNC(CmpLong, - dex_lang_cmp_long, + art_portable_cmp_long, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kInt64Ty, kInt64Ty)) @@ -1616,35 +1616,35 @@ _EVAL_DEF_INTRINSICS_FUNC(CmpLong, //---------------------------------------------------------------------------- // int const_int(int) _EVAL_DEF_INTRINSICS_FUNC(ConstInt, - dex_lang_const_int, + art_portable_const_int, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // JavaObject* const_obj(int) _EVAL_DEF_INTRINSICS_FUNC(ConstObj, - dex_lang_const_obj, + art_portable_const_obj, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kInt32Ty)) // long const_long(long) _EVAL_DEF_INTRINSICS_FUNC(ConstLong, - dex_lang_const_long, + art_portable_const_long, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG1(kInt64Ty)) // float const_float(int) _EVAL_DEF_INTRINSICS_FUNC(ConstFloat, - dex_lang_const_Float, + art_portable_const_Float, kAttrReadOnly | kAttrNoThrow, kFloatTy, _EXPAND_ARG1(kInt32Ty)) // double const_double(long) _EVAL_DEF_INTRINSICS_FUNC(ConstDouble, - dex_lang_const_Double, + art_portable_const_Double, kAttrReadOnly | kAttrNoThrow, kDoubleTy, _EXPAND_ARG1(kInt64Ty)) @@ -1656,42 +1656,42 @@ _EVAL_DEF_INTRINSICS_FUNC(ConstDouble, // void method_info(void) _EVAL_DEF_INTRINSICS_FUNC(MethodInfo, - dex_lang_method_info, + art_portable_method_info, kAttrReadOnly | kAttrNoThrow, kVoidTy, _EXPAND_ARG0()) // int copy_int(int) _EVAL_DEF_INTRINSICS_FUNC(CopyInt, - dex_lang_copy_int, + art_portable_copy_int, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // JavaObject* copy_obj(obj) _EVAL_DEF_INTRINSICS_FUNC(CopyObj, - dex_lang_copy_obj, + art_portable_copy_obj, kAttrReadOnly | kAttrNoThrow, kJavaObjectTy, _EXPAND_ARG1(kJavaObjectTy)) // long copy_long(long) _EVAL_DEF_INTRINSICS_FUNC(CopyLong, - dex_lang_copy_long, + art_portable_copy_long, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG1(kInt64Ty)) // float copy_float(float) _EVAL_DEF_INTRINSICS_FUNC(CopyFloat, - dex_lang_copy_Float, + art_portable_copy_Float, kAttrReadOnly | kAttrNoThrow, kFloatTy, _EXPAND_ARG1(kFloatTy)) // double copy_double(double) _EVAL_DEF_INTRINSICS_FUNC(CopyDouble, - dex_lang_copy_Double, + art_portable_copy_Double, kAttrReadOnly | kAttrNoThrow, kDoubleTy, _EXPAND_ARG1(kDoubleTy)) @@ -1706,37 +1706,37 @@ _EVAL_DEF_INTRINSICS_FUNC(CopyDouble, //---------------------------------------------------------------------------- // long shl_long(long,int) _EVAL_DEF_INTRINSICS_FUNC(SHLLong, - dex_lang_shl_long, + art_portable_shl_long, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG2(kInt64Ty,kInt32Ty)) // long shr_long(long,int) _EVAL_DEF_INTRINSICS_FUNC(SHRLong, - dex_lang_shr_long, + art_portable_shr_long, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG2(kInt64Ty,kInt32Ty)) // long ushr_long(long,int) _EVAL_DEF_INTRINSICS_FUNC(USHRLong, - dex_lang_ushl_long, + art_portable_ushl_long, kAttrReadOnly | kAttrNoThrow, kInt64Ty, _EXPAND_ARG2(kInt64Ty,kInt32Ty)) // int shl_int(int,int) _EVAL_DEF_INTRINSICS_FUNC(SHLInt, - dex_lang_shl_int, + art_portable_shl_int, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kInt32Ty,kInt32Ty)) // long shr_int(int,int) _EVAL_DEF_INTRINSICS_FUNC(SHRInt, - dex_lang_shr_int, + art_portable_shr_int, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kInt32Ty,kInt32Ty)) // int ushr_long(int,int) _EVAL_DEF_INTRINSICS_FUNC(USHRInt, - dex_lang_ushl_int, + art_portable_ushl_int, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG2(kInt32Ty,kInt32Ty)) @@ -1749,21 +1749,21 @@ _EVAL_DEF_INTRINSICS_FUNC(USHRInt, //---------------------------------------------------------------------------- // int int_to_byte(int) _EVAL_DEF_INTRINSICS_FUNC(IntToByte, - dex_lang_int_to_byte, + art_portable_int_to_byte, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // int int_to_char(int) _EVAL_DEF_INTRINSICS_FUNC(IntToChar, - dex_lang_int_to_char, + art_portable_int_to_char, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) // int int_to_short(int) _EVAL_DEF_INTRINSICS_FUNC(IntToShort, - dex_lang_int_to_short, + art_portable_int_to_short, kAttrReadOnly | kAttrNoThrow, kInt32Ty, _EXPAND_ARG1(kInt32Ty)) diff --git a/src/greenland/intrinsic_helper.cc b/src/compiler_llvm/intrinsic_helper.cc index 7e926d6025..3bb6948ab4 100644 --- a/src/greenland/intrinsic_helper.cc +++ b/src/compiler_llvm/intrinsic_helper.cc @@ -24,7 +24,7 @@ #include <llvm/Support/IRBuilder.h> using namespace art; -using namespace greenland; +using namespace compiler_llvm; namespace { @@ -36,13 +36,13 @@ GetLLVMTypeOfIntrinsicValType(IRBuilder& irb, return irb.getVoidTy(); } case IntrinsicHelper::kJavaObjectTy: { - return irb.GetJObjectTy(); + return irb.getJObjectTy(); } case IntrinsicHelper::kJavaMethodTy: { - return irb.GetJMethodTy(); + return irb.getJMethodTy(); } case IntrinsicHelper::kJavaThreadTy: { - return irb.GetJThreadTy(); + return irb.getJThreadTy(); } case IntrinsicHelper::kInt1Ty: case IntrinsicHelper::kInt1ConstantTy: { @@ -85,7 +85,7 @@ GetLLVMTypeOfIntrinsicValType(IRBuilder& irb, } // anonymous namespace namespace art { -namespace greenland { +namespace compiler_llvm { const IntrinsicHelper::IntrinsicInfo IntrinsicHelper::Info[] = { #define DEF_INTRINSICS_FUNC(_, NAME, ATTR, RET_TYPE, ARG1_TYPE, ARG2_TYPE, \ @@ -172,5 +172,5 @@ IntrinsicHelper::IntrinsicHelper(llvm::LLVMContext& context, return; } -} // namespace greenland +} // namespace compiler_llvm } // namespace art diff --git a/src/greenland/intrinsic_helper.h b/src/compiler_llvm/intrinsic_helper.h index 1fe8855837..319127d673 100644 --- a/src/greenland/intrinsic_helper.h +++ b/src/compiler_llvm/intrinsic_helper.h @@ -29,7 +29,7 @@ namespace llvm { } namespace art { -namespace greenland { +namespace compiler_llvm { class IRBuilder; @@ -109,7 +109,7 @@ class IntrinsicHelper { public: static const IntrinsicInfo& GetInfo(IntrinsicId id) { - DCHECK(id >= 0 && id < MaxIntrinsicId) << "Unknown Dalvik intrinsics ID: " + DCHECK(id >= 0 && id < MaxIntrinsicId) << "Unknown ART intrinsics ID: " << id; return Info[id]; } @@ -126,7 +126,7 @@ class IntrinsicHelper { IntrinsicHelper(llvm::LLVMContext& context, llvm::Module& module); inline llvm::Function* GetIntrinsicFunction(IntrinsicId id) { - DCHECK(id >= 0 && id < MaxIntrinsicId) << "Unknown Dalvik intrinsics ID: " + DCHECK(id >= 0 && id < MaxIntrinsicId) << "Unknown ART intrinsics ID: " << id; return intrinsic_funcs_[id]; } @@ -151,7 +151,7 @@ class IntrinsicHelper { llvm::DenseMap<const llvm::Function*, IntrinsicId> intrinsic_funcs_map_; }; -} // namespace greenland +} // namespace compiler_llvm } // namespace art #endif // ART_SRC_GREENLAND_INTRINSIC_HELPER_H_ diff --git a/src/compiler_llvm/ir_builder.cc b/src/compiler_llvm/ir_builder.cc index 51a8170d38..88af166fbf 100644 --- a/src/compiler_llvm/ir_builder.cc +++ b/src/compiler_llvm/ir_builder.cc @@ -28,13 +28,30 @@ namespace compiler_llvm { // General //---------------------------------------------------------------------------- -IRBuilder::IRBuilder(llvm::LLVMContext& context, llvm::Module& module) -: LLVMIRBuilder(context), module_(&module), mdb_(context) { - +IRBuilder::IRBuilder(llvm::LLVMContext& context, llvm::Module& module, + IntrinsicHelper& intrinsic_helper) + : LLVMIRBuilder(context), module_(&module), mdb_(context), java_object_type_(NULL), + java_method_type_(NULL), java_thread_type_(NULL), intrinsic_helper_(intrinsic_helper) { // Get java object type from module llvm::Type* jobject_struct_type = module.getTypeByName("JavaObject"); CHECK(jobject_struct_type != NULL); - jobject_type_ = jobject_struct_type->getPointerTo(); + java_object_type_ = jobject_struct_type->getPointerTo(); + + // If type of Method is not explicitly defined in the module, use JavaObject* + llvm::Type* type = module.getTypeByName("Method"); + if (type != NULL) { + java_method_type_ = type->getPointerTo(); + } else { + java_method_type_ = java_object_type_; + } + + // If type of Thread is not explicitly defined in the module, use JavaObject* + type = module.getTypeByName("Thread"); + if (type != NULL) { + java_thread_type_ = type->getPointerTo(); + } else { + java_thread_type_ = java_object_type_; + } // Create JEnv* type llvm::Type* jenv_struct_type = llvm::StructType::create(context, "JEnv"); @@ -52,7 +69,7 @@ IRBuilder::IRBuilder(llvm::LLVMContext& context, llvm::Module& module) // Type Helper Function //---------------------------------------------------------------------------- -llvm::Type* IRBuilder::getJTypeInAccurateSpace(JType jty) { +llvm::Type* IRBuilder::getJType(JType jty) { switch (jty) { case kVoid: return getJVoidTy(); @@ -90,68 +107,6 @@ llvm::Type* IRBuilder::getJTypeInAccurateSpace(JType jty) { } } - -llvm::Type* IRBuilder::getJTypeInRegSpace(JType jty) { - RegCategory regcat = GetRegCategoryFromJType(jty); - - switch (regcat) { - case kRegUnknown: - case kRegZero: - LOG(FATAL) << "Register category \"Unknown\" or \"Zero\" does not have " - << "the LLVM type"; - return NULL; - - case kRegCat1nr: - return getInt32Ty(); - - case kRegCat2: - return getInt64Ty(); - - case kRegObject: - return getJObjectTy(); - } - - LOG(FATAL) << "Unknown register category: " << regcat; - return NULL; -} - - -llvm::Type* IRBuilder::getJTypeInArraySpace(JType jty) { - switch (jty) { - case kVoid: - LOG(FATAL) << "void type should not be used in array type space"; - return NULL; - - case kBoolean: - case kByte: - return getInt8Ty(); - - case kChar: - case kShort: - return getInt16Ty(); - - case kInt: - return getInt32Ty(); - - case kLong: - return getInt64Ty(); - - case kFloat: - return getFloatTy(); - - case kDouble: - return getDoubleTy(); - - case kObject: - return getJObjectTy(); - - default: - LOG(FATAL) << "Unknown java type: " << jty; - return NULL; - } -} - - llvm::StructType* IRBuilder::getShadowFrameTy(uint32_t vreg_size) { std::string name(StringPrintf("ShadowFrame%u", vreg_size)); diff --git a/src/compiler_llvm/ir_builder.h b/src/compiler_llvm/ir_builder.h index 60a0f2ad39..85506e44a9 100644 --- a/src/compiler_llvm/ir_builder.h +++ b/src/compiler_llvm/ir_builder.h @@ -18,6 +18,7 @@ #define ART_SRC_COMPILER_LLVM_IR_BUILDER_H_ #include "backend_types.h" +#include "intrinsic_helper.h" #include "md_builder.h" #include "runtime_support_builder.h" #include "runtime_support_func.h" @@ -26,6 +27,7 @@ #include <llvm/DerivedTypes.h> #include <llvm/LLVMContext.h> #include <llvm/Support/IRBuilder.h> +#include <llvm/Support/NoFolder.h> #include <llvm/Type.h> #include <stdint.h> @@ -34,8 +36,26 @@ namespace art { namespace compiler_llvm { +class InserterWithDexOffset + : public llvm::IRBuilderDefaultInserter<true> { + public: + InserterWithDexOffset() : node_(NULL) {} + void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name, + llvm::BasicBlock *BB, + llvm::BasicBlock::iterator InsertPt) const { + llvm::IRBuilderDefaultInserter<true>::InsertHelper(I, Name, BB, InsertPt); + if (node_ != NULL) { + I->setMetadata("DexOff", node_); + } + } + void SetDexOffset(llvm::MDNode* node) { + node_ = node; + } + private: + llvm::MDNode* node_; +}; -typedef llvm::IRBuilder<> LLVMIRBuilder; +typedef llvm::IRBuilder<true, llvm::ConstantFolder, InserterWithDexOffset> LLVMIRBuilder; // NOTE: Here we define our own LLVMIRBuilder type alias, so that we can // switch "preserveNames" template parameter easily. @@ -46,7 +66,7 @@ class IRBuilder : public LLVMIRBuilder { // General //-------------------------------------------------------------------------- - IRBuilder(llvm::LLVMContext& context, llvm::Module& module); + IRBuilder(llvm::LLVMContext& context, llvm::Module& module, IntrinsicHelper& intrinsic_helper); //-------------------------------------------------------------------------- @@ -273,33 +293,18 @@ class IRBuilder : public LLVMIRBuilder { // Type Helper Function //-------------------------------------------------------------------------- - llvm::Type* getJType(char shorty_jty, JTypeSpace space) { - return getJType(GetJTypeFromShorty(shorty_jty), space); + llvm::Type* getJType(char shorty_jty) { + return getJType(GetJTypeFromShorty(shorty_jty)); } - llvm::Type* getJType(JType jty, JTypeSpace space) { - switch (space) { - case kAccurate: - return getJTypeInAccurateSpace(jty); - - case kReg: - case kField: // Currently field space is equivalent to register space. - return getJTypeInRegSpace(jty); - - case kArray: - return getJTypeInArraySpace(jty); - } - - LOG(FATAL) << "Unknown type space: " << space; - return NULL; - } + llvm::Type* getJType(JType jty); llvm::Type* getJVoidTy() { return getVoidTy(); } llvm::IntegerType* getJBooleanTy() { - return getInt1Ty(); + return getInt8Ty(); } llvm::IntegerType* getJByteTy() { @@ -331,7 +336,15 @@ class IRBuilder : public LLVMIRBuilder { } llvm::PointerType* getJObjectTy() { - return jobject_type_; + return java_object_type_; + } + + llvm::PointerType* getJMethodTy() { + return java_method_type_; + } + + llvm::PointerType* getJThreadTy() { + return java_thread_type_; } llvm::Type* getArtFrameTy() { @@ -438,27 +451,21 @@ class IRBuilder : public LLVMIRBuilder { private: - //-------------------------------------------------------------------------- - // Type Helper Function (Private) - //-------------------------------------------------------------------------- - - llvm::Type* getJTypeInAccurateSpace(JType jty); - llvm::Type* getJTypeInRegSpace(JType jty); - llvm::Type* getJTypeInArraySpace(JType jty); - - - private: llvm::Module* module_; - llvm::PointerType* jobject_type_; + MDBuilder mdb_; + + llvm::PointerType* java_object_type_; + llvm::PointerType* java_method_type_; + llvm::PointerType* java_thread_type_; llvm::PointerType* jenv_type_; llvm::StructType* art_frame_type_; - MDBuilder mdb_; - RuntimeSupportBuilder* runtime_support_; + + IntrinsicHelper& intrinsic_helper_; }; diff --git a/src/compiler_llvm/jni_compiler.cc b/src/compiler_llvm/jni_compiler.cc index 8d49aba971..c23c5e20da 100644 --- a/src/compiler_llvm/jni_compiler.cc +++ b/src/compiler_llvm/jni_compiler.cc @@ -268,7 +268,7 @@ llvm::FunctionType* JniCompiler::GetFunctionType(uint32_t method_idx, CHECK_GE(shorty_size, 1u); // Get return type - llvm::Type* ret_type = irb_.getJType(shorty[0], kAccurate); + llvm::Type* ret_type = irb_.getJType(shorty[0]); // Get argument type std::vector<llvm::Type*> args_type; @@ -278,11 +278,11 @@ llvm::FunctionType* JniCompiler::GetFunctionType(uint32_t method_idx, if (!is_static || is_native_function) { // "this" object pointer for non-static // "class" object pointer for static naitve - args_type.push_back(irb_.getJType('L', kAccurate)); + args_type.push_back(irb_.getJType('L')); } for (uint32_t i = 1; i < shorty_size; ++i) { - args_type.push_back(irb_.getJType(shorty[i], kAccurate)); + args_type.push_back(irb_.getJType(shorty[i])); } return llvm::FunctionType::get(ret_type, args_type, false); diff --git a/src/compiler_llvm/llvm_compilation_unit.cc b/src/compiler_llvm/llvm_compilation_unit.cc index 5f653c68cc..1c0218f0e3 100644 --- a/src/compiler_llvm/llvm_compilation_unit.cc +++ b/src/compiler_llvm/llvm_compilation_unit.cc @@ -81,7 +81,7 @@ namespace art { namespace compiler_llvm { llvm::FunctionPass* -CreateGBCExpanderPass(const greenland::IntrinsicHelper& intrinsic_helper, IRBuilder& irb, +CreateGBCExpanderPass(const IntrinsicHelper& intrinsic_helper, IRBuilder& irb, Compiler* compiler, OatCompilationUnit* oat_compilation_unit); llvm::Module* makeLLVMModuleContents(llvm::Module* module); @@ -99,8 +99,11 @@ LlvmCompilationUnit::LlvmCompilationUnit(const CompilerLLVM* compiler_llvm, // Include the runtime function declaration makeLLVMModuleContents(module_); + + intrinsic_helper_.reset(new IntrinsicHelper(*context_, *module_)); + // Create IRBuilder - irb_.reset(new IRBuilder(*context_, *module_)); + irb_.reset(new IRBuilder(*context_, *module_, *intrinsic_helper_)); // We always need a switch case, so just use a normal function. switch(GetInstructionSet()) { diff --git a/src/compiler_llvm/llvm_compilation_unit.h b/src/compiler_llvm/llvm_compilation_unit.h index 5951061ae3..8ea4ea2445 100644 --- a/src/compiler_llvm/llvm_compilation_unit.h +++ b/src/compiler_llvm/llvm_compilation_unit.h @@ -107,6 +107,7 @@ class LlvmCompilationUnit { UniquePtr<IRBuilder> irb_; UniquePtr<RuntimeSupportBuilder> runtime_support_; llvm::Module* module_; // Managed by context_ + UniquePtr<IntrinsicHelper> intrinsic_helper_; UniquePtr<LLVMInfo> llvm_info_; Compiler* compiler_; OatCompilationUnit* oat_compilation_unit_; diff --git a/src/compiler_llvm/stub_compiler.cc b/src/compiler_llvm/stub_compiler.cc index 77f5d8e680..e0a3b3c8a3 100644 --- a/src/compiler_llvm/stub_compiler.cc +++ b/src/compiler_llvm/stub_compiler.cc @@ -92,7 +92,7 @@ CompiledInvokeStub* StubCompiler::CreateInvokeStub(bool is_static, llvm::Value* old_thread_register = irb_.Runtime().EmitSetCurrentThread(thread_object_addr); // Accurate function type - llvm::Type* accurate_ret_type = irb_.getJType(shorty[0], kAccurate); + llvm::Type* accurate_ret_type = irb_.getJType(shorty[0]); std::vector<llvm::Type*> accurate_arg_types; @@ -103,7 +103,7 @@ CompiledInvokeStub* StubCompiler::CreateInvokeStub(bool is_static, } for (size_t i = 1; i < shorty_size; ++i) { - accurate_arg_types.push_back(irb_.getJType(shorty[i], kAccurate)); + accurate_arg_types.push_back(irb_.getJType(shorty[i])); } llvm::FunctionType* accurate_func_type = @@ -126,7 +126,7 @@ CompiledInvokeStub* StubCompiler::CreateInvokeStub(bool is_static, arg_shorty == 'F' || arg_shorty == 'D' || arg_shorty == 'L') { llvm::Type* arg_type = - irb_.getJType(shorty[i], kAccurate)->getPointerTo(); + irb_.getJType(shorty[i])->getPointerTo(); llvm::Value* arg_jvalue_addr = irb_.CreateConstGEP1_32(actual_args_array_addr, i - 1); @@ -197,14 +197,14 @@ CompiledInvokeStub* StubCompiler::CreateProxyStub(const char* shorty) { std::string func_name(ElfFuncName(cunit_->GetIndex())); // Accurate function type - llvm::Type* accurate_ret_type = irb_.getJType(shorty[0], kAccurate); + llvm::Type* accurate_ret_type = irb_.getJType(shorty[0]); std::vector<llvm::Type*> accurate_arg_types; accurate_arg_types.push_back(irb_.getJObjectTy()); // method accurate_arg_types.push_back(irb_.getJObjectTy()); // this for (size_t i = 1; i < shorty_size; ++i) { - accurate_arg_types.push_back(irb_.getJType(shorty[i], kAccurate)); + accurate_arg_types.push_back(irb_.getJType(shorty[i])); } llvm::FunctionType* accurate_func_type = diff --git a/src/greenland/backend_types.h b/src/greenland/backend_types.h deleted file mode 100644 index 6a4a473eab..0000000000 --- a/src/greenland/backend_types.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ART_SRC_GREENLAND_BACKEND_TYPES_H_ -#define ART_SRC_GREENLAND_BACKEND_TYPES_H_ - -#include "base/logging.h" - -namespace art { -namespace greenland { - -enum JType { - kVoid, - kBoolean, - kByte, - kChar, - kShort, - kInt, - kLong, - kFloat, - kDouble, - kObject, - MAX_JTYPE -}; - - -enum JTypeSpace { - kAccurate, - kReg, - kField, - kArray, -}; - - -enum RegCategory { - kRegUnknown, - kRegZero, - kRegCat1nr, - kRegCat2, - kRegObject, -}; - - -inline JType GetJTypeFromShorty(char shorty_jty) { - switch (shorty_jty) { - case 'V': - return kVoid; - - case 'Z': - return kBoolean; - - case 'B': - return kByte; - - case 'C': - return kChar; - - case 'S': - return kShort; - - case 'I': - return kInt; - - case 'J': - return kLong; - - case 'F': - return kFloat; - - case 'D': - return kDouble; - - case 'L': - return kObject; - - default: - LOG(FATAL) << "Unknown Dalvik shorty descriptor: " << shorty_jty; - return kVoid; - } -} - - -inline RegCategory GetRegCategoryFromJType(JType jty) { - switch (jty) { - case kVoid: - return kRegUnknown; - - case kBoolean: - case kByte: - case kChar: - case kShort: - case kInt: - case kFloat: - return kRegCat1nr; - - case kLong: - case kDouble: - return kRegCat2; - - case kObject: - return kRegObject; - - default: - LOG(FATAL) << "Unknown java type: " << jty; - return kRegUnknown; - } -} - - -inline RegCategory GetRegCategoryFromShorty(char shorty) { - return GetRegCategoryFromJType(GetJTypeFromShorty(shorty)); -} - - -} // namespace greenland -} // namespace art - -#endif // ART_SRC_GREENLAND_BACKEND_TYPES_H_ diff --git a/src/greenland/ir_builder.cc b/src/greenland/ir_builder.cc deleted file mode 100644 index 12f9dfab19..0000000000 --- a/src/greenland/ir_builder.cc +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ir_builder.h" - -#include <llvm/Module.h> - -namespace art { -namespace greenland { - -IRBuilder::IRBuilder(llvm::LLVMContext& context, llvm::Module& module, - IntrinsicHelper& intrinsic_helper) - : LLVMIRBuilder(context), java_object_type_(NULL), java_method_type_(NULL), - java_thread_type_(NULL), intrinsic_helper_(intrinsic_helper) { - // JavaObject must be defined in the module - java_object_type_ = module.getTypeByName("JavaObject")->getPointerTo(); - - // If type of Method is not explicitly defined in the module, use JavaObject* - llvm::Type* type = module.getTypeByName("Method"); - if (type != NULL) { - java_method_type_ = type->getPointerTo(); - } else { - java_method_type_ = java_object_type_; - } - - // If type of Thread is not explicitly defined in the module, use JavaObject* - type = module.getTypeByName("Thread"); - if (type != NULL) { - java_thread_type_ = type->getPointerTo(); - } else { - java_thread_type_ = java_object_type_; - } -} - -llvm::Type* IRBuilder::GetJTypeInAccurateSpace(JType jty) { - switch (jty) { - case kVoid: - return GetJVoidTy(); - - case kBoolean: - return GetJBooleanTy(); - - case kByte: - return GetJByteTy(); - - case kChar: - return GetJCharTy(); - - case kShort: - return GetJShortTy(); - - case kInt: - return GetJIntTy(); - - case kLong: - return GetJLongTy(); - - case kFloat: - return GetJFloatTy(); - - case kDouble: - return GetJDoubleTy(); - - case kObject: - return GetJObjectTy(); - - default: - LOG(FATAL) << "Unknown java type: " << jty; - return NULL; - } -} - -llvm::Type* IRBuilder::GetJTypeInRegSpace(JType jty) { - RegCategory regcat = GetRegCategoryFromJType(jty); - - switch (regcat) { - case kRegUnknown: - case kRegZero: - LOG(FATAL) << "Register category \"Unknown\" or \"Zero\" does not have " - << "the LLVM type"; - return NULL; - - case kRegCat1nr: - return getInt32Ty(); - - case kRegCat2: - return getInt64Ty(); - - case kRegObject: - return GetJObjectTy(); - } - - LOG(FATAL) << "Unknown register category: " << regcat; - return NULL; -} - -llvm::Type* IRBuilder::GetJTypeInArraySpace(JType jty) { - switch (jty) { - case kVoid: - LOG(FATAL) << "void type should not be used in array type space"; - return NULL; - - case kBoolean: - case kByte: - return getInt8Ty(); - - case kChar: - case kShort: - return getInt16Ty(); - - case kInt: - return getInt32Ty(); - - case kLong: - return getInt64Ty(); - - case kFloat: - return getFloatTy(); - - case kDouble: - return getDoubleTy(); - - case kObject: - return GetJObjectTy(); - - default: - LOG(FATAL) << "Unknown java type: " << jty; - return NULL; - } -} - -} // namespace greenland -} // namespace art diff --git a/src/greenland/ir_builder.h b/src/greenland/ir_builder.h deleted file mode 100644 index ff98dbaec8..0000000000 --- a/src/greenland/ir_builder.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ART_SRC_GREENLAND_IR_BUILDER_H_ -#define ART_SRC_GREENLAND_IR_BUILDER_H_ - -#include "backend_types.h" -#include "intrinsic_helper.h" - -#include "base/logging.h" - -#include <llvm/Support/IRBuilder.h> -#include <llvm/Support/NoFolder.h> -#include <llvm/Metadata.h> - -namespace llvm { - class Module; -} - -namespace art { -namespace greenland { - -class InserterWithDexOffset - : public llvm::IRBuilderDefaultInserter<true> { - public: - InserterWithDexOffset() : node_(NULL) {} - void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name, - llvm::BasicBlock *BB, - llvm::BasicBlock::iterator InsertPt) const { - llvm::IRBuilderDefaultInserter<true>::InsertHelper(I, Name, BB, InsertPt); - if (node_ != NULL) { - I->setMetadata("DexOff", node_); - } - } - void SetDexOffset(llvm::MDNode* node) { - node_ = node; - } - private: - llvm::MDNode* node_; -}; - -typedef llvm::IRBuilder<true, llvm::NoFolder, InserterWithDexOffset> LLVMIRBuilder; - -class IRBuilder : public LLVMIRBuilder { - public: - IRBuilder(llvm::LLVMContext& context, llvm::Module& module, - IntrinsicHelper& intrinsic_helper); - ~IRBuilder() { } - - public: - //-------------------------------------------------------------------------- - // Pointer Arithmetic Helper Function - //-------------------------------------------------------------------------- - llvm::IntegerType* GetPtrEquivIntTy() { - return getInt32Ty(); - } - - llvm::ConstantInt* GetPtrEquivInt(int64_t i) { - return llvm::ConstantInt::get(GetPtrEquivIntTy(), i); - } - - //-------------------------------------------------------------------------- - // Intrinsic Helper Functions - //-------------------------------------------------------------------------- - llvm::Function* GetIntrinsics(IntrinsicHelper::IntrinsicId instr_id) { - return intrinsic_helper_.GetIntrinsicFunction(instr_id); - } - - //-------------------------------------------------------------------------- - // Type Helper Functions - //-------------------------------------------------------------------------- - llvm::Type* GetJType(char shorty_jty, JTypeSpace space) { - return GetJType(GetJTypeFromShorty(shorty_jty), space); - } - - llvm::Type* GetJType(JType jty, JTypeSpace space) { - switch (space) { - case kAccurate: - return GetJTypeInAccurateSpace(jty); - - case kReg: - case kField: // Currently field space is equivalent to register space. - return GetJTypeInRegSpace(jty); - - case kArray: - return GetJTypeInArraySpace(jty); - } - - LOG(FATAL) << "Unknown type space: " << space; - return NULL; - } - - llvm::Type* GetJVoidTy() { - return getVoidTy(); - } - - llvm::IntegerType* GetJBooleanTy() { - return getInt1Ty(); - } - - llvm::IntegerType* GetJByteTy() { - return getInt8Ty(); - } - - llvm::IntegerType* GetJCharTy() { - return getInt16Ty(); - } - - llvm::IntegerType* GetJShortTy() { - return getInt16Ty(); - } - - llvm::IntegerType* GetJIntTy() { - return getInt32Ty(); - } - - llvm::IntegerType* GetJLongTy() { - return getInt64Ty(); - } - - llvm::Type* GetJFloatTy() { - return getFloatTy(); - } - - llvm::Type* GetJDoubleTy() { - return getDoubleTy(); - } - - llvm::PointerType* GetJObjectTy() { - return java_object_type_; - } - - llvm::PointerType* GetJMethodTy() { - return java_method_type_; - } - - llvm::PointerType* GetJThreadTy() { - return java_thread_type_; - } - - //-------------------------------------------------------------------------- - // Constant Value Helper Function - //-------------------------------------------------------------------------- - llvm::ConstantInt* GetJBoolean(bool is_true) { - return (is_true) ? getTrue() : getFalse(); - } - - llvm::ConstantInt* GetJByte(int8_t i) { - return llvm::ConstantInt::getSigned(GetJByteTy(), i); - } - - llvm::ConstantInt* GetJChar(int16_t i) { - return llvm::ConstantInt::getSigned(GetJCharTy(), i); - } - - llvm::ConstantInt* GetJShort(int16_t i) { - return llvm::ConstantInt::getSigned(GetJShortTy(), i); - } - - llvm::ConstantInt* GetJInt(int32_t i) { - return llvm::ConstantInt::getSigned(GetJIntTy(), i); - } - - llvm::ConstantInt* GetJLong(int64_t i) { - return llvm::ConstantInt::getSigned(GetJLongTy(), i); - } - - llvm::Constant* GetJFloat(float f) { - return llvm::ConstantFP::get(GetJFloatTy(), f); - } - - llvm::Constant* GetJDouble(double d) { - return llvm::ConstantFP::get(GetJDoubleTy(), d); - } - - llvm::ConstantPointerNull* GetJNull() { - return llvm::ConstantPointerNull::get(GetJObjectTy()); - } - - llvm::Constant* GetJZero(char shorty_jty) { - return GetJZero(GetJTypeFromShorty(shorty_jty)); - } - - llvm::Constant* GetJZero(JType jty) { - switch (jty) { - case kVoid: - LOG(FATAL) << "Zero is not a value of void type"; - return NULL; - - case kBoolean: - return GetJBoolean(false); - - case kByte: - return GetJByte(0); - - case kChar: - return GetJChar(0); - - case kShort: - return GetJShort(0); - - case kInt: - return GetJInt(0); - - case kLong: - return GetJLong(0); - - case kFloat: - return GetJFloat(0.0f); - - case kDouble: - return GetJDouble(0.0); - - case kObject: - return GetJNull(); - - default: - LOG(FATAL) << "Unknown java type: " << jty; - return NULL; - } - } - - private: - llvm::Type* GetJTypeInAccurateSpace(JType jty); - llvm::Type* GetJTypeInRegSpace(JType jty); - llvm::Type* GetJTypeInArraySpace(JType jty); - - llvm::PointerType* java_object_type_; - llvm::PointerType* java_method_type_; - llvm::PointerType* java_thread_type_; - - IntrinsicHelper& intrinsic_helper_; -}; - -} // namespace greenland -} // namespace art - -#endif // ART_SRC_GREENLAND_IR_BUILDER_H_ |