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

method with large number of locals causes StackOverflowError

XMLWordPrintable

    • x86
    • windows_95



      Name: dkC59003 Date: 07/23/99



      JDK 1.3L fails the following JCK(114a, 116a, 12a) test:

      vm/instr/astore_w/astore_w004/astore_w00401/astore_w00401.html

      which contains method with 65535 locals.

      "The greatest number of local variables in the local variables array of a frame
      created upon invocation of a method is limited to 65535 by the size of the max_locals
      item of the Code attribute ($4.7.3) giving the code of the method."
      (JVMS, second edition, CHAPTER 4 The class File Format,
      section 4.10 Limitations of the Java Virtual Machine)

      The failure is reproduced only when hotspot VM is used.
      The test is passed under -classic mode.

      See reduced test case and logs below.

      ****************************** test.jasm source **************************

      public class test {

      public static Method run:"()I"
      stack 2 locals 65535
      {

              iconst_0;
      ireturn;
      }

      public static Method main:"([Ljava/lang/String;)V"
      stack 2 locals 2
      {
      aload_0;
      invokestatic Method run:"()I";
      return;
      }

      }

      ****************************** do.bat source **************************
      rem do.bat
      @echo off

      H:\ld25\java\dest\jdk1.3L\win32\bin\java %1 -version
      H:\ld25\java\dest\jdk1.3L\win32\bin\java %1 -verify test

      if not errorlevel=1 goto L1
      echo ----Bad----
      goto end

      :L1
      if errorlevel=0 echo ----OK----

      :end


      ****************************** logs ******************************
      >do.bat -classic
      java version "1.3"
      Classic VM (build JDK-1.3-L, native threads, nojit)
      ----OK----
      >
      >
      >do.bat
      java version "1.3"
      HotSpot Client VM (1.3beta, mixed mode, build l)
      Exception in thread "main" java.lang.StackOverflowError
      at test.main(test.jasm)
      ----Bad----
      >
      ****************************************************************

      ======================================================================

            sgrarupsunw Steffen Grarup (Inactive)
            dkhukhrosunw Dmitry Khukhro (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: