Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8201447

C1 does backedge profiling incorrectly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 10
    • hotspot
    • b14

        While looking into an issue with a Graal bailout because the OSR entry point appeared to be unreachable I noticed that when C1 profiles if bytecodes it increments the backedge counter on every execution of the if instead of just on the backedge. For a simple loop like this:

        public class dowhile {
            public static void main(String[] args) {
                for (int i = 0; i < 10000000; i++) {
                    testDoWhile();
                }
            }
            public static volatile boolean repeatLoop;
            static volatile int sideEffect;

            public static void testDoWhile() {
                do {
                    sideEffect++;
                } while (repeatLoop);
            }
        }

        HotSpot ends up requesting an OSR compile:

        <task_queued compile_id='16' compile_kind='osr' method='dowhile testDoWhile ()V' bytes='15' count='224300' backedge_count='163840' iicount='224300' osr_bci='0' level='4' stamp='0.576' comment='tiered' hot_count='163840'/>

              iveresov Igor Veresov
              never Tom Rodriguez
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: