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

RISCV: C2 Empty pipeline cause nops

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 25
    • hotspot
    • None
    • riscv
    • linux

      Using UseZtso I see this (with additional block comments):

        0x00007df6a3da2142: addw t4,t5,s2
        0x00007df6a3da2146: c.addi zero,0
        0x00007df6a3da2148: c.addi zero,0
        0x00007df6a3da214a: c.addi zero,0
        0x00007df6a3da214c: c.addi zero,0
        0x00007df6a3da214e: c.addi zero,0
       ;; B8: # out( B8 B9 ) <- in( B7 B8 ) Loop( B8-B8 inner main of N168 strip mined multiversion_fast) Freq: 1.00022e+06
       ;; membar_acquire
       ;; membar_acquire
       ;; membar_acquire
       ;; membar_release
        0x00007df6a3da2150: c.sw a5,124(a2)


      It seem like the membars spits out a nop, but only in some cases.

      This was my test program, I only see it the doit C2 compiled method AFIACT:
      {code:title=C2java|borderStyle=solid}
      public class C2 {
        static volatile int a = 1;
        static volatile int b = 1;

        public static void main(String argz[]) {
            for (int i = 0; i < 40000; i++) {
              dothat();
          }
        }
        
        public static void dothat() {
          for (int i = 0; i < 40000; i++) {
           doit();
              b = i%2;
              a = i%2;
          }
        }

        public static void doit() {
            int va = a;
            int vb = b;
            if (va == 1) b = 2;
            if (vb == 1) a = 2;
        }
      }
      {code}

            fyang Fei Yang
            rehn Robbin Ehn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: