Java 编译器的转换
Transformations of Java Compiler
根据 section 17.4 of JLS8,编译器执行了 Java 代码的两个转换:
- 语句重新排序
- 前锋换人
Java 编译器是否可以执行任何其他转换?
对,还有其他变换,根据JLS:
[The memory model] provides a great deal of freedom for the implementor to perform a myriad of code transformations, including the reordering of actions and removal of unnecessary synchronization.
只要遵守内存模型,就允许编译器实现执行任何转换。
根据 section 17.4 of JLS8,编译器执行了 Java 代码的两个转换:
- 语句重新排序
- 前锋换人
Java 编译器是否可以执行任何其他转换?
对,还有其他变换,根据JLS:
[The memory model] provides a great deal of freedom for the implementor to perform a myriad of code transformations, including the reordering of actions and removal of unnecessary synchronization.
只要遵守内存模型,就允许编译器实现执行任何转换。