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

JIT Version 3.00.045(x) for JDK 1.1.x causes java.lang.StackOverflowError

XMLWordPrintable



      Name: tb29552 Date: 05/27/98


      When run with not JIT (JAVA_COMPILER=xxx), program
      runs successfully. With 'java' or 'java -nojit',
      I get a Stack Overflow exception.

      Symantec Java! JustInTime Compiler Version 3.00.045(x) for JDK 1.1.x
      Copyright (C) 1996-98 Symantec Corporation

      Exception adding Menu--must be running with JIT
      java.lang.StackOverflowError
      at OrderedHashtable.put(Compiled Code)
                            [ ---> 91 identical lines deleted <--- ]
      at OrderedHashtable.put(Compiled Code)
      at java.util.Hashtable.put(Compiled Code)
      at OrderedHashtable.put(Compiled Code)
      at JITTest.crash(JITTest.java:41)
      at JITTest.main(JITTest.java:30)


      I'm unsure as to the exact cause, so here is a test program.
      (NT 4.0, JDK 1.1.6)

      import java.util.Hashtable;
      import java.util.Vector;

      /**
       * demostrates a bug in the JIT
       *
       * To get a StackOverflow error, run as
       * java JITTest
       * or
       * java JITTest -nojit
       * (the -nojit option appears to have no effect).
       *
       * The expected result can be seen with:
       * set JAVA_COMPILER=xxx
       * java JITTest
       */
      public class JITTest {
        protected static Hashtable attribTable = new Hashtable();

        public static void main(String args[]) {
          JITTest test = new JITTest( );
          test.crash();
          System.exit( 1 );
        }

        public JITTest( ) {
          attribTable.put(JITTest.class, new Hashtable(1) );
        }

        public void crash( ) {
          try {
            OrderedHashtable temp1 = new OrderedHashtable(1);
            temp1.put("Menu", new java.util.Hashtable(1));

          } catch (Throwable exception) {
            System.err.println("Exception adding Menu--must be running with JIT");
            exception.printStackTrace( );
            System.exit( 1 );
          }
          System.out.println("successful addition--must be running without JIT");
          System.exit( 1 );
        }
      }

      class OrderedHashtable extends Hashtable {
        private Vector keys;
        public OrderedHashtable(int initialCapacity) {
          super(initialCapacity);
          keys = new Vector(initialCapacity);
        }
        public synchronized Object put(Object key, Object value) {
          Object oldValue = super.put(key,value);
          if (!keys.contains(key)) {
            keys.addElement(key);
          }
          return oldValue;
        }
      }
      (Review ID: 32413)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: