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

1.2.2 JIT bug casues NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.2.2
    • vm-legacy



      Name: skT88420 Date: 07/21/99


      1.
      Some code that manipulates bytes seems errors when run with the
      new 1.2.2 jit. The code in standard low-level byte shifting
      and XORing etc. This problem does not appear with any other JIT.

      2.
      /**
       * The following code throws a NullPointerException when run with the JIT enabled.
       * It does not throw an exception when JIT is disabled or when an older JIT
       * (Symantec JIT Version 3.00.078 or less) is used instead.
       */
      public class OneTwoTwo
      {
          private static final long K[] = { 0x5A827999L, 0x6ED9EBA1L, 0x8F1BBCDCL, 0xCA62C1D6L };
          private long length;
          private long H[] = new long[5];
          private long W[] = new long[80];

          private int currentPosition;
          private byte[] N = new byte[64];
          private boolean reset = true;

          protected byte[] testfunc()
      {
              byte[] local = N;
              long[] localW = W;
              long A = H[0], B = H[1], C = H[2], D = H[3], E = H[4];

              for(int t = 40;t <= 59; t++) {
                  long tmp = localW[t-3] ^ localW[t-8] ^ localW[t-14] ^ localW[t-16];
                  localW[t] = ((tmp << 1) & 0xFFFFFFFFL) + (tmp >>> 31);
                  long TEMP = ((((A << 5) & 0xFFFFFFFFL) + (A >>> 27) + ((B & C) | (B & D) | (C & D)) + E + localW[t] + K[2]) & 0xFFFFFFFFL);
                  E = D; D = C; C = ((B << 30) & 0xFFFFFFFFL) + (B >>> 2); B = A; A = TEMP;
              }

      H[0] &= 0xFFFFFFFFL; H[1] &= 0xFFFFFFFFL; H[2] &= 0xFFFFFFFFL; H[3] &= 0xFFFFFFFFL; H[4] &= 0xFFFFFFFFL;
              return null;
          }

          public static void main(String[] args)
          {
              try {
                  OneTwoTwo tester = new OneTwoTwo();
                  tester.testfunc();
              }catch(Exception e) {
                  e.printStackTrace();
              }
          }
      }

      3 & 4
      [d:\temp\tmp]\hava\jdk1.2.2\bin\java -cp OneTwoTwo

      java.lang.NullPointerException
              at test.OneTwoTwo.testfunc(OneTwoTwo.java, Compiled Code)
              at test.OneTwoTwo.main(OneTwoTwo.java:41)


      5.
      [d:\temp\tmp]\hava\jdk1.2.2\bin\java -version
      java version "1.2.2"
      Classic VM (build JDK-1.2.2-W, native threads, symcjit)

      [d:\temp\tmp]\hava\jdk1.2.2\bin\java -fullversion
      java full version "JDK-1.2.2-W"
      (Review ID: 88203)
      ======================================================================

            Unassigned Unassigned
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: