To simplify the review of JDK-8305638, I've decided to split off some code into separate sub-tasks.
This sub-task focuses on the code refactoring done in Loop Unswitching which covers:
- Adding a more detailed description about the Loop Unswitching optimization itself below the file header.
- Renaming the fast loop->true-path-loop and slow loop -> false-path-loop since we don't really know which one is faster and to avoid keeping a mental map of which path goes into which unswitched loop version.
- Creating new classes:
- UnswitchedLoopSelector to created the unswitched loop selector (i.e. the If node that selects at runtime which unswitched loop version that is executed).
- OriginalLoop to do the actual unswitching (i.e. loop cloning, predicates cloning and fixing the graph to the loop selector If)./- Extracting methods in do_unswitching() to clean it up.
- Improving TraceLoopUnswitching code.
- Adding some shared utility methods.