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

Symantec JIT 3.00.039 computes VM stack depth wrongly

    XMLWordPrintable

Details

    • 1.1.6
    • x86
    • windows_95, windows_nt
    • Not verified

    Backports

      Description



        Name: tb29552 Date: 04/30/98


        This applies to the JIT that comes with JDK-1.1.6
        running under Windows 95/NT-4.0.

        When the JIT is used to run hand-assembled bytecode,
        it will occassionally complain about inconsistent stack
        depth, such as:

        A nonfatal internal JIT (3.00.039(x)) error 'Stack levels inconsistent' has occured in:
          'Foo.main ([Ljava/lang/String;)V': Interpreting method.

        In this case, Foo.class has actually been verified correct by both javap and kimera.
        A manual trace of the stack also proves the stack to be consistent.

        This typically happens when the method has an exception handler that branches backward.

        Here's the test code for Foo.j (written in jasmin syntax):
        The JIT will not complain if you put the block of code labelled with "continue" after
        the "sleepException" handler.

        ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        .source Foo.j
        .class public Foo
        .super java/lang/Object


        .method public static main([Ljava/lang/String;)V
            .limit stack 5
            .limit locals 2

        sleepStart:
            ldc2_w 100
            invokestatic java/lang/Thread/sleep(J)V
        sleepEnd:
            aconst_null
            getstatic java/lang/System/out Ljava/io/PrintStream;
            ldc "sleep succeeded"

        continue: ; expect stack=[String, System.out, dummy]
            invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
            return

        sleepException:
            ; stack now contains Exception
            getstatic java/lang/System/out Ljava/io/PrintStream;
            ldc "sleep succeeded"
            goto continue
            
            
            .catch java/lang/InterruptedException from sleepStart to sleepEnd using sleepException
        .end method


        ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


        .method public <init>()V
        .limit stack 1
        .limit locals 1
        aload_0
        invokespecial java/lang/Object/<init>()V
        return
        .end method


        ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        (Review ID: 29066)
        ======================================================================

        Attachments

          Issue Links

            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: