V2EX  ›  英汉词典
Enqueued related words: Unreachable Code

Dead-code Elimination

Definition / 定义

dead-code elimination(死代码消除)是一种编译器优化:删除那些不会影响程序可观察行为的代码,例如计算结果从未被使用的表达式、永远不会执行到的分支、对最终输出无影响的赋值等(在不改变程序语义的前提下)。该术语也常被简称为 DCE
注:在有副作用(如 I/O、抛异常、写共享内存)的情况下,相关代码通常不能被视为“死代码”。

Pronunciation / 发音

/ˌdɛd ˈkoʊd ɪˌlɪməˈneɪʃən/

Examples / 例句

The compiler performed dead-code elimination to remove unused variables.
编译器进行了死代码消除,移除了未使用的变量。

After inlining functions, the optimizer applies dead-code elimination so that computations whose results are never observed are dropped without changing the program’s output.
在内联函数之后,优化器会应用死代码消除,把那些结果从未被观察到的计算删除,同时不改变程序的输出。

Etymology / 词源

该术语由 dead code(死代码) + elimination(消除) 组成:

  • dead code 指“对程序最终可见结果没有贡献、等同于不存在”的代码;
  • elimination 来自拉丁语词根 eliminare,有“移除、排除”的含义。
    合起来就是“把无效/无贡献的代码移除”的优化方法。

Related Words / 相关词

Literary Works / 文学作品

  • Compilers: Principles, Techniques, and Tools(Aho, Lam, Sethi, Ullman,“龙书”)
  • Engineering a Compiler(Cooper & Torczon)
  • Modern Compiler Implementation(Andrew W. Appel)
  • Advanced Compiler Design and Implementation(Steven S. Muchnick)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1035 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 17:45 · PVG 01:45 · LAX 09:45 · JFK 12:45
♥ Do have faith in what you're doing.