循环优化 Oracle Java 7-8 Hotspot VM
Loop optimizations Oracle Java 7-8 Hotspot VM
我想知道 Oracle Java 7(或 8)Hotspot VM 执行的循环优化是什么?
- Range Check Elimination - eliminates range checks for loop-invariant arrays. See PhaseIdealLoop::do_range_check 了解详情。优化由标志
-XX:+RangeCheckElimination
控制
- Loop Peeling - splits first iteration from the loop and performs it outside of the loop body. See amazing description here PhaseIdealLoop::do_peeling。此优化由标志
-XX:PartialPeelLoop=true
控制
- Loop Predication - eliminates the condition checks from inside the loop body. Currently, loop predication optimization has been applied to remove array range check and loop invariant checks (such as null checks and array checks). Loop predication is controlled by the
-XX:+UseLoopPredicate
. See code PhaseIdealLoop::loop_predication_impl
- Loop Unrolling - is used as first step of Superword Level Parallelism. See PhaseIdealLoop::do_unroll。循环展开由以下属性控制:
-XX:LoopMaxUnroll=16
和 -XX:LoopUnrollMin=4
- Array Filling - 用 intrisc 替换任何填充图案。参见 PhaseIdealLoop::do_intrinsify_fill。 JVM 选项
-XX:+OptimizeFill
- 矢量化 - 在展开的循环中用矢量运算替换数组初始化、复制和算术。 Hotspot 编译器实现了 Superword Level Parallelism in superword.cpp 的概念。另见 JVM 选项
-XX:+UseSuperWord
我想知道 Oracle Java 7(或 8)Hotspot VM 执行的循环优化是什么?
- Range Check Elimination - eliminates range checks for loop-invariant arrays. See PhaseIdealLoop::do_range_check 了解详情。优化由标志
-XX:+RangeCheckElimination
控制
- Loop Peeling - splits first iteration from the loop and performs it outside of the loop body. See amazing description here PhaseIdealLoop::do_peeling。此优化由标志
-XX:PartialPeelLoop=true
控制
- Loop Predication - eliminates the condition checks from inside the loop body. Currently, loop predication optimization has been applied to remove array range check and loop invariant checks (such as null checks and array checks). Loop predication is controlled by the
-XX:+UseLoopPredicate
. See code PhaseIdealLoop::loop_predication_impl - Loop Unrolling - is used as first step of Superword Level Parallelism. See PhaseIdealLoop::do_unroll。循环展开由以下属性控制:
-XX:LoopMaxUnroll=16
和-XX:LoopUnrollMin=4
- Array Filling - 用 intrisc 替换任何填充图案。参见 PhaseIdealLoop::do_intrinsify_fill。 JVM 选项
-XX:+OptimizeFill
- 矢量化 - 在展开的循环中用矢量运算替换数组初始化、复制和算术。 Hotspot 编译器实现了 Superword Level Parallelism in superword.cpp 的概念。另见 JVM 选项
-XX:+UseSuperWord