Basic Block
WIKI里面对BB的解释:
http://en.wikipedia.org/wiki/Basic_block
GCC文档对BB的解释:
http://gcc.gnu.org/onlinedocs/gccint/Basic-Blocks.html
看着还是GCC的容易理解一点:
A basic block is a straight-line sequence of code with only one entry point and only one exit. In GCC, basic blocks are represented using the basic_block data type. Special basic blocks represent possible entry and exit points of a function. These blocks are called ENTRY_BLOCK_PTR and EXIT_BLOCK_PTR. These blocks do not contain any code.
BB是一个线性的代码序列,有且仅有一个入口和出口。在函数中用于表示入口和出口的BB,不包含任何代码(实际上是一个指针),在GG里面叫 ENTRY_BLOCK_PTR和 EXIT_BLOCK_PTR。
dalvik里面用于描述BB的结构体是这样的:
typedef struct BasicBlock {int id;bool visited;bool hidden;unsigned int startOffset;const Method *containingMethod; // For blocks from the calleeBBType blockType;bool needFallThroughBranch; // For blocks ended due to length limitbool isFallThroughFromInvoke; // True means the block needs alignmentMIR *firstMIRInsn;MIR *lastMIRInsn;struct BasicBlock *fallThrough;struct BasicBlock *taken;struct BasicBlock *iDom; // Immediate dominatorstruct BasicBlockDataFlow *dataFlowInfo;BitVector *predecessors;BitVector *dominators;BitVector *iDominated; // Set nodes being immediately dominatedBitVector *domFrontier; // Dominance frontierstruct { // For one-to-many successors likeBlockListType blockListType; // switch and exception handlingGrowableList blocks;} successorBlockList;
} BasicBlock;
如果我没有猜错,MIR *firstMIRInsn 和 MIR *lastMIRInsn;就是出口和入口地址。
为何这里是MIR类型,而不是汇编,或者是机器码?
因为这是后仅仅是从java->dex->bytecode,dalvik是要先分析完MIR才会去做MIR2LIR。
从Dalvik的代码结果也可以看到,Dataflow.cpp里面的函数都是对BB进行分析的。
到了CodegenDriver(),才进行dvmCompilerMIR2LIR()。(本来这才就是人家google的设计思路)
在进行Frontend.cpp里面的三个大动作dvmCompileMethod(),compileLoop(),dvmCompileTrace()都会进行MIR2LIR的编译。但不一定都会调用dvmCompilerMIR2LIR(),例如method的编译调用的就是dvmCompilerMethodMIR2LIR() 。
但是Dalvik现在只支持trace based的编译,对于method based 的编译方式,是不支持的:-(。
google可能认为method based的方式效能不高?还是实现起来复杂度过高?又或者是由于专利等其它法律原因?
void dvmCompilerMethodMIR2LIR(CompilationUnit *cUnit) {// Method-based JIT not supported for ARM.
}
转载于:https://my.oschina.net/rinehart/blog/176255
Basic Block相关推荐
- 嵌入式操作系统内核原理和开发(等值block内存池设计)
[ 声明:版权所有,欢迎转载,请勿用于商业用途. 联系信箱:feixiaoxing @163.com] 内存池设计是嵌入式系统的一个重要环节,之前我们也讨论过相关的内容.但是,看了r ...
- Block Corrupt
Oracle有不同方法来监测及修复data block corruption,常用的修复方法 重建对象 对于表或索引它们自身包含数据,重建不能恢复数据,可以使用DBMS_REPAIR修复 DBMS_R ...
- 【论文分享】WindRanger: A Directed Greybox Fuzzer driven by Deviation Basic Blocks
论文基本信息 发表年份:2022 发表会议或期刊(简称,CCF级别):CCF A类会议 ICSE 论文标题(论文简称):WindRanger: A Directed Greybox Fuzzer dr ...
- 三段式LLVM编译器
三段式LLVM编译器 目录 概述 LLVM技术生态之编译器 一.传统编译器的设计 二.传统编译器模式的实现 三.LLVM的三段式实现 四.LLVM's Code Representation:LLVM ...
- LLVM Clang前端编译与调试
LLVM Clang前端编译与调试 iOS 关于编译 o 一.Objective-C 编译过程 o 为什么需要重新编译? o 编译步骤 o 二.编译步骤的详细说明 o 1.预处理 o 2.编译 o 词 ...
- TVM,Relay,Pass
TVM,Relay,Pass Relay介绍 主要结合TVM的文档(https://tvm.apache.org/docs/dev/relay_intro.html),介绍一下NNVM的第二代Rela ...
- LLVM Backend技术
LLVM Backend技术 LLVM编译器介绍 LLVM 是一个编译器基础设施的设计与实现,具有独特的多阶段优化系统.广泛支持过程间和配置文件驱动的优化,同时对于商业编译器系统也十分高效. LLVM ...
- 编译器设计-代码优化
编译器设计-代码优化 Compiler Design - Code Optimization 优化是一种程序转换技术,它试图通过使代码消耗更少的资源(如CPU.内存)来改进代码,并提供高速. 在优化中 ...
- yolov4源码_YOLOv4特征提取网络——CSPDarkNet结构解析及PyTorch实现
1 YOLOv4目标检测模型 自从Redmon说他不在更新YOLO系列之后,我一度以为这么好用的框架就要慢慢淡入历史了,事实是我多虑了.YOLOv4在使用YOLO Loss的基础上,使用了新的back ...
最新文章
- 小米电脑做开发java_JAVA学习系列之一-搭建开发环境
- ES6新增特性——Promise
- 用户操作拦截并作日志记录--自定义注解+AOP拦截
- leetcode剑指 Offer 29. 顺时针打印矩阵
- leetcode--Longest Substring Without Repeating Characters
- java生成随机验证图片的实现
- 如何打开.hdx文件
- ImportError: cannot import name ‘_validate_lengths‘ from ‘numpy.lib.arraypad的解决方法(简单粗暴)
- 树形动态规划(树状DP)小结
- 浅谈共轭梯度法的原理
- duck typing java_進一步思考Duck typing
- 安卓访客模式_Android 5.0利用访客模式设置双桌面教程
- oracle 命令操作
- Your “Flamingo“ is My “Bird”:Fine-Grained or Not
- Debian 10安装Xrdp远程桌面
- wordpress修复插件_关于WordPress及其修复方法的15个最烦人的事情
- 清除Winamp Bento皮肤中的浏览器地址栏历史
- SQL分页 查询6到10名等
- C#——窗体程序声明一个播放器接口IPlayer,包含5个接口方法:播放、停止、暂停、上一首和下一首。
- element plus+vue3.0 el-date-picker之panel-change无效果,为el-date-picker加标识。