code_generator中的CompileBaseline(无优化)

本文详细解析了在code_generator中初始化CompileBaseline的过程,特别是针对非叶子方法时,如何计算所需的frame_size_。涉及到的方法包括:Initialize()、判断是否为64位架构,以及计算local VRegs、temporaries VReg Slots等。对于x86/x86_64架构,frame大小可能为GetWordSize(),而arm64则为0。同时,介绍了frame size的计算逻辑,涉及到kVRegSize、GetFloatingPointSpillSlotSize()、GetWordSize()等。文章最后提到了GenerateFrameEntry()函数的架构依赖性,预示着进入编译内部阶段。
摘要由CSDN通过智能技术生成
//~/android-6.0.1_r62/art/compiler/optimizing/code_generator.cc中
123 void CodeGenerator::CompileBaseline(CodeAllocator* allocator, bool is_leaf) {
124   Initialize();
125   if (!is_leaf) {
126     MarkNotLeaf();
127   }
128   const bool is_64_bit = Is64BitInstructionSet(GetInstructionSet());
129   InitializeCodeGeneration(GetGraph()->GetNumberOfLocalVRegs()
130                              + GetGraph()->GetTemporariesVRegSlots()
131                              + 1 /* filler */,
132                            0, /* the baseline compiler does not have live registers at slow path */
133                            0, /* the baseline compiler does not have live registers at slow path */
134                            GetGraph()->GetMaximumNumberOfOutVRegs()
135                              + (is_64_bit ? 2 : 1) /* current method */,
136                            GetGraph()->GetBlocks());
137   CompileInternal(allocator, /* is_baseline */ true);
138 }

1/先进行Initialize()
2/判断是否是叶子方法,如果不是,则:

242   void MarkNotLeaf() {
243     is_leaf_ = false;
244     requires_current_method_ = true;
245   } 

3/判断是否是64位架构
4/

233 void CodeGenerator::InitializeCodeGeneration(size_t number_of_spill_slots,
234                                              size_t maximum_number_of_live_core_registers,
235                                              size_t maximum_number_of_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值