diff --git a/reference/opcache/ini.xml b/reference/opcache/ini.xml index 1ffeea399538..67ec0550ffcb 100644 --- a/reference/opcache/ini.xml +++ b/reference/opcache/ini.xml @@ -592,10 +592,155 @@ A bitmask that controls which optimisation passes are executed. - The default is to apply all safe optimizations. - Changing the default is mostly useful for debugging/developing the optimizer - (see also opcache.opt_debug_level). - + The default value is 0x7FFEBFFF, which enables all + safe optimizations. Disabling optimizations or enabling unsafe optimizations + is mostly useful for debugging/developing the optimizer. + + + Each bit in the bitmask enables a specific optimization pass: + + + Optimization Pass Bitmask + + + + Bit + Pass Name + Description + Default + + + + + 0 + PASS_1 + Simple peephole optimizations + On + + + 1 + PASS_2 + Unused (got merged into PASS_1) + On + + + 2 + PASS_3 + Simple jump optimization + On + + + 3 + PASS_4 + Call optimization + On + + + 4 + PASS_5 + Control Flow Graph based optimization + On + + + 5 + PASS_6 + Data Flow Analysis based optimization + On + + + 6 + PASS_7 + Whether call graph should be used for SSA-based optimizations + On + + + 7 + PASS_8 + Sparse conditional constant propagation + On + + + 8 + PASS_9 + Temporary variable optimization + On + + + 9 + PASS_10 + Removal of NOP opcodes + On + + + 10 + PASS_11 + Literal optimization + On + + + 11 + PASS_12 + Call stack adjustment + On + + + 12 + PASS_13 + Unused variable removal + On + + + 13 + PASS_14 + Dead code elimination + On + + + 14 + PASS_15 + Collect and substitute constant declarations (unsafe) + Off + + + 15 + PASS_16 + Trivial function inlining (part of call optimization) + On + + + 16 + (Flag) + Ignore possibility of operator overloading (unsafe) + Off + + + +
+ + Safe vs Unsafe Optimizations + + Safe optimizations (enabled by default) preserve the exact + behavior of PHP code while improving performance. They include dead code elimination, + constant folding, and jump optimization. + + + Unsafe optimizations (disabled by default) may alter behavior + in edge cases: + + + + + Bit 14: Aggressive constant collection may not preserve + exact behavior in all cases + + + + + Bit 16: Ignoring operator overloading + + + +
@@ -843,8 +988,21 @@ Produces opcode dumps for debugging different stages of optimizations. - 0x10000 will output opcodes as the compiler produced them before any optimization occurs - while 0x20000 will output optimized codes. + Accepts bit flags from + opcache.optimization_level for optimization passes, plus + additional debugging dump points: + + + 0x10000: Dump before optimizer + 0x20000: Dump after optimizer + 0x40000: Dump before CFG optimizations + 0x80000: Dump after CFG optimizations + 0x200000: Dump before SSA optimizations + 0x400000: Dump after SSA optimizations + + + Setting opcache.opt_debug_level=-1 produces a full trace + through all optimization stages.