首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >JIT热编译

JIT热编译
EN

Stack Overflow用户
提问于 2013-09-01 15:05:57
回答 1查看 137关注 0票数 1

我的问题类似于这一个,但是不同,因为我不问EditAndContinue。

我已经意识到一个热门的重新编译存在。我是说,例如,我们有这样的代码

代码语言:javascript
运行
复制
if (a > 0 && b >0 && c > 0 && d > 0)

我们假设我们有一个监视可执行文件并启动JIT的环境(例如CLR)。因此,这个环境看到条件d > 0很少见(我们在编译时不知道a b cd的实际值,只能在运行时收集一些统计信息)。所以它可以像这样重新编译它

代码语言:javascript
运行
复制
if (d > 0 && a > 0 && b >0 && c > 0)

所以我们得到了一个优化,因为最不可能的条件,首先检查。那么,这个热重编译实际上是如何命名的呢?它是如何在哪里起作用的?

EN

回答 1

Stack Overflow用户

发布于 2013-12-17 04:54:33

可以叫做分支重排

GCC似乎也支持类似的分支分析选项,这可能会帮助你找到真名。

代码语言:javascript
运行
复制
-fbranch-probabilities
   After running a program compiled with -fprofile-arcs
   (see Options for Debugging Your Program or gcc), you can compile it a second
   time using -fbranch-probabilities, to improve optimizations based on the number
   of times each branch was taken. When a program compiled with -fprofile-arcs
   exits, it saves arc execution counts to a file called sourcename.gcda for each
   source file. The information in this data file is very dependent on the
   structure of the generated code, so you must use the same source code and the
   same optimization options for both compilations. 

   With -fbranch-probabilities, GCC puts a ‘REG_BR_PROB’ note on each ‘JUMP_INSN’
   and ‘CALL_INSN’. These can be used to improve optimization. Currently, they are
   only used in one place: in reorg.c, instead of guessing which path a branch is
   most likely to take, the ‘REG_BR_PROB’ values are used to exactly determine
   which path is taken more often. 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18559702

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档