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

nonfatal internal JIT (3.00.045(x)) error 'regvar' has occurred

    XMLWordPrintable

Details

    • 1.2fcs
    • x86
    • windows_95, windows_nt
    • Not verified

    Description

      Name: tb29552 Date: 05/27/98

      1.
      I compile with JDK 1.1.6 with JIT enabled
      javac -O *.java -deprecated

      then run
      appletviewer whet.htm

      it prints the following message:
      D:\Devl\Java\SunJIT\whet>appletviewer whet.htm
      A nonfatal internal JIT (3.00.039(x)) error 'regvar' has occurred in :
        'DWhet.benchmark ()LWhet$WhetResult;': Interpreting method.
        Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cg
      i

      I work on Win NT 4.0 SP3.

      Source Codes-----------------------
      /**********************************************************************
      * Benchmark #2 -- Whetstone (A001)
      *
      *
      **********************************************************************/

      /**
      * Whetstone Benchmark
      * Adopted for Java by Argyn Kuketayev
      * July 3, 1997.
      */
      abstract class Whet {

      /** Double Whetstone Benchmark Results class. */
      public class WhetResult {
      /** Mega Instr per second. */
      double Mips;
      /** Total execution Time in ms. */
      long ExecTimeMillis;
      int Iterations, Loops;
      }

        protected int J, K, L;
        protected long ptime, time0;

        /** With loopcount LOOP=10, one million Whetstone instructions
        * will be executed in EACH MAJOR LOOP..A MAJOR LOOP IS EXECUTED
        * 'II' TIMES TO INCREASE WALL-CLOCK TIMING ACCURACY. */
        protected int II = 1, LOOP = 1000;

        Whet(int II, int LOOP) {
          this.II = II;
          this.LOOP = LOOP;
        }

        Whet() {
        }

        abstract public WhetResult benchmark();

        public static String getSysInfo() {

          String r = "\n";

          r = "Java Vendor : " + System.getProperty( "java.vendor" ) + "\n";
          r += "Java Version : " + System.getProperty( "java.version" ) + "\n";
          r += "Java Class Version : " + System.getProperty( "java.class.version" ) + "\n";
          r += "OS : " + System.getProperty("os.arch")+ " / " + System.getProperty("os.name") + "\n";
      // "user.name" is not accessible from applets
      // r += "User Name : " + System.getProperty("user.name" ) + "\n";

          return r;

        }

        abstract public String getResults(int ii, int loop);

        public static String getAuthorInfo(){
          return "Ported to Java by Argyn KUKETAYEV (C) July 31, 1997.";

        }
      }

      /**********************************************************************
      * Benchmark #2 -- Double Precision Whetstone (A001)
      *
      *
      **********************************************************************/

      /**
      * Double Whetstone Benchmark
      * Adopted for Java by Argyn Kuketayev
      * July 3, 1997.
      */
      class DWhet extends Whet{

        protected double T, T1, T2;
        protected double[] E1 = new double[4];

        DWhet(int II, int LOOP) {
          super(II, LOOP);
        }

        DWhet() {
          super();
        }

        public WhetResult benchmark() {
          long time1;
          int I;

          // Start benchmark timing at this point.
          time0 = System.currentTimeMillis();
          ptime = time0;

          // The actual benchmark starts here.

          T = .499975;
          T1 = 0.50025;
          T2 = 2.0;

          for(int JJ = 1; JJ <= II; JJ++) {

            // Establish the relative loop counts of each module.
            int N1 = 0;
            int N2 = 12 * LOOP;
            int N3 = 14 * LOOP;
            int N4 = 345 * LOOP;
            int N5 = 0;
            int N6 = 210 * LOOP;
            int N7 = 32 * LOOP ;
            int N8 = 899 * LOOP;
            int N9 = 616 * LOOP;
            int N10 = 0;
            int N11 = 93 * LOOP;

            //Module 1: Simple identifiers
            double X1 = 1.0;
            double X2 = -1.0;
            double X3 = -1.0;
            double X4 = -1.0;

            for(I = 1; I <= N1; I++) {
              X1 = (X1 + X2 + X3 - X4)*T;
              X2 = (X1 + X2 - X3 + X4)*T;
              X3 = (X1 - X2 + X3 + X4)*T;
              X4 = (-X1 + X2 + X3 + X4)*T;
            }

            //if(JJ == II) POUT(N1,N1,N1,X1,X2,X3,X4);

            //Module 2: Array elements
            E1[0] = 1.0;
            E1[1] = -1.0;
            E1[2] = -1.0;
            E1[3] = -1.0;

            for(I = 1; I <= N2; I++) {
              E1[0] = (E1[0] + E1[1] + E1[2] - E1[3])*T;
              E1[1] = (E1[0] + E1[1] - E1[2] + E1[3])*T;
              E1[2] = (E1[0] - E1[1] + E1[2] + E1[3])*T;
              E1[3] = (-E1[0] + E1[1] + E1[2] + E1[3])*T;
            }

            //if(JJ == II) POUT(N2,N3,N2,E1[0],E1[1],E1[2],E1[3]);

            // Module 3: Array as parameter
            for(I = 1; I <= N3; I++) PA(E1);

            //if(JJ == II) POUT(N3,N2,N2,E1[0],E1[1],E1[2],E1[3]);

            // Module 4: Conditional jumps
            J = 1;
            for(I = 1; I <= N4; I++) {
              if(J == 1) J = 2;
              else J = 3;
              if(J > 2) J = 0;
              else J = 1;
              if(J < 1) J = 1;
              else J = 0;
            }

            //if(JJ == II) POUT(N4,J,J,X1,X2,X3,X4);

            // Module 5: Omitted
            // Module 6: Integer arithmetic
            J = 1;
            K = 2;
            L = 3;

            for(I = 1; I <= N6; I++) {
              J = J * (K-J) * (L-K);
              K = L * K - (L-J) * K;
              L = (L - K) * (K + J);
              E1[L-1] = J + K + L;
              E1[K-1] = J * K * L;
            }

            //if(JJ == II) POUT(N6,J,K,E1[0],E1[1],E1[2],E1[3]);

            // Module 7: Trigonometric functions
            double X = 0.5;
            double Y = 0.5;

            for(I = 1; I <= N7; I++) {
              X=T*Math.atan(T2*Math.sin(X)*Math.cos(X)/(Math.cos(X+Y)+Math.cos(X-Y)-1.0));
              Y=T*Math.atan(T2*Math.sin(Y)*Math.cos(Y)/(Math.cos(X+Y)+Math.cos(X-Y)-1.0));
            }

            //if(JJ == II) POUT(N7,J,K,X,X,Y,Y);

            // Module 8: Procedure calls
            X = 1.0;
            Y = 1.0;
            double Z = 1.0;

            for(I = 1; I <= N8; I++) P3(X,Y,Z);

            //if(JJ == II) POUT(N8,J,K,X,Y,Z,Z);

            // Module 9: Array references
            J = 1;
            K = 2;
            L = 3;
            E1[0] = 1.0;
            E1[1] = 2.0;
            E1[2] = 3.0;

            for(I = 1; I <= N9; I++) P0();

            //if(JJ == II) POUT(N9,J,K,E1[0],E1[1],E1[2],E1[3]);

            // Module 10: Integer arithmetic
            J = 2;
            K = 3;

            for(I = 1; I <= N10; I++) {
              J = J + K;
              K = J + K;
              J = K - J;
              K = K - J - J;
            }

            //if(JJ == II) POUT(N10,J,K,X1,X2,X3,X4);

            // Module 11: Standard functions
            X = 0.75;
          
            for(I = 1; I <= N11; I++) X = Math.sqrt(Math.exp(Math.log(X)/T1));

            //if(JJ == II) POUT(N11,J,K,X,X,X,X);

            // THIS IS THE END OF THE MAJOR LOOP.
          }

          // Stop benchmark timing at this point.
          time1 = System.currentTimeMillis();

          /**----------------------------------------------------------------
          * Performance in Whetstone KIP's per second is given by
          *
          * 100*LOOP*II / TIME
          *
          * where TIME is in seconds.
          *-------------------------------------------------------------------*/

          WhetResult res = new WhetResult();
          res.ExecTimeMillis = time1-time0;
          res.Mips = (100. * LOOP * II) / (time1-time0);
          res.Iterations = II;
          res.Loops = LOOP;
          return res;
        }

        private void PA(double[] E) {
          int J1 = 0;
          do {
            E[0] = (E[0] + E[1] + E[2] - E[3]) * T;
            E[1] = (E[0] + E[1] - E[2] + E[3]) * T;
            E[2] = (E[0] - E[1] + E[2] + E[3]) * T;
            E[3] = (-E[0] + E[1] + E[2] + E[3]) / T2;
            J1 = J1 + 1;
          } while (J1 < 6);
        }

        private void P0() {
          E1[J] = E1[K];
          E1[K] = E1[L];
          E1[L] = E1[J];
        }
        
        private void P3(double X, double Y, double Z) {
          double X1 = X, Y1 = Y;
          X1 = T * (X1 + Y1);
          Y1 = T * (X1 + Y1);
          Z = (X1 + Y1) / T2;
        }

      /*
        private void POUT(int N, int J, int K, double X1, double X2, double X3,
                                  double X4) {
          long time1;
          time1 = System.currentTimeMillis();
          System.out.println("Elapsed ms since start " + (time1-time0) +
            ", elapsed ms since a module started " + (time1-ptime) +
            ", " + N + ", " + J + ", " + K + ", " + X1 + ", " + X2 + ", " +
            X3 + ", " + X4);
          ptime = time1;
        }
      */

        public String getResults(int ii, int loop) {
          II = ii;
          LOOP = loop;
          
          WhetResult res = benchmark();

          java.util.Date today = new java.util.Date();
          String r = "\n";

          r += " Benchmark #2 -- Double Precision Whetstone (A001)\n";
          r += " ================================================== \n";
          r += " Date/Time is " + today + "\n\n";
          r += " Double Mega Whetstones : " + res.Mips + "\n";
          r += " Total Execution Time, ms : " + res.ExecTimeMillis + "\n";
          r += " Iterations =" + res.Iterations + "; Loops = " + res.Loops + "\n";

          return r;
        }

        public static void main(String[] args) {

          int ii = 10;
          int loop = 100;

          String usageTips = "Application usage: DWhet <iterations> <loops>\n" +
            "\titerations default value is 10\n" +
            "\tloops default value is 100\n";

          try {
            ii = Integer.parseInt(args[0]);
            loop = Integer.parseInt(args[1]);
          } catch (IllegalArgumentException e) {
              System.out.println("Warning: arguments must be integers.\n" + usageTips);
          } catch ( IndexOutOfBoundsException e) {
              System.out.println("Warning: missing arguments are set to defaults.\n" + usageTips);
          } catch (Exception e) {
              System.out.println("exception: " + e.getMessage());
              e.printStackTrace();
          }

          DWhet dwhet = new DWhet();

          System.out.println(DWhet.getSysInfo() + dwhet.getResults(ii, loop) + "\n" + DWhet.getAuthorInfo());

        }

      }

      import java.applet.*;
      import java.awt.*;

      abstract public class WhetApplet extends Applet {


       Label topLine = new Label(getBenchmarkName(), Label.CENTER);

       Button startButton = new Button("Start");
       Button resetButton = new Button("Reset");

       Label iiLabel = new Label("Enter II - number of iterations: ",Label.RIGHT);
       TextField iiField = new TextField();
       Label loopLabel = new Label("Enter LOOP - number of loops: ",Label.RIGHT);
       TextField loopField = new TextField();
       TextArea resultsText = new TextArea(15,50);

       GridBagLayout gridbag = new GridBagLayout();;
       GridBagConstraints constraints = new GridBagConstraints();

       abstract public String getBenchmarkName();

       public void init() {

        setLayout(gridbag);
        constraints.fill = GridBagConstraints.BOTH;
        addComponent(topLine,10,0);
        addComponent(iiLabel,20,0);
        addComponent(iiField,30,0);
        iiField.setText("10");
        addComponent(loopLabel,40,0);
        addComponent(loopField,50,0);
        loopField.setText("100");
        addComponent(startButton,60,0);
        addComponent(resetButton,70,0);
        addComponent(resultsText,90,0);

       }

       protected void addComponent(Component c,int y,int x) {
        constraints.gridx = x;
        constraints.gridy = y;
        gridbag.setConstraints(c, constraints);
        add(c);
       }

       public boolean handleEvent(Event event) {
        if(event.target instanceof Button && event.id == Event.ACTION_EVENT) {
          if("Start".equals(event.arg)) {
            int ii = Integer.parseInt(iiField.getText());
            int loop = Integer.parseInt(loopField.getText());
            String r = resultString(ii, loop);
            resultsText.setText(r);
          }
          else if("Reset".equals(event.arg)) {
            iiField.setText("10");
            loopField.setText("100");
            resultsText.setText("");
          }
        }
        return false;
       }

       abstract public String resultString(int ii, int loop);
      }


      import java.applet.*;
      import java.awt.*;

      public class DWhetApplet extends WhetApplet {

       DWhet whet = new DWhet();

       public String getBenchmarkName(){ return "Double Whetstone Benchmark";}

       public String resultString(int ii, int loop){
         return DWhet.getSysInfo() + whet.getResults(ii, loop) + "\n" + DWhet.getAuthorInfo();

       }

      }


      ----------html file
      <HTML>
      <HEAD>
      <TITLE>Whetstone Benchmarks</TITLE>
      </HEAD>
      <BODY>
      <APPLET CODE="DWhetApplet.class" WIDTH=400 HEIGHT=600>
      [Double Whetstone Applet]
      </APPLET>
      <APPLET CODE="SWhetApplet.class" WIDTH=400 HEIGHT=600>
      [Single Whetstone Applet]
      </APPLET>
      </BODY>
      </HTML>
      (Review ID: 32455)
      ======================================================================

      Attachments

        Activity

          People

            dviswanasunw Deepa Viswanathan (Inactive)
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: