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

test when executed gives segv 11 when running jit'ed code.

    XMLWordPrintable

Details

    • jit
    • sparc
    • solaris_2.4

    Description

      Following test passes without jit but fails with jit.


      Sadhana

      $ javac X.java
      $ jitc *.class
      $ java X
      java X
      Test c0340601 Passed
      sujay:c03_4$ java -Djava.compiler=JIT X
      SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_ACCERR [addr: 0x4]
       
              stackbase=EFFFEF6C, stackpointer=EFFFEC50
       
      Full thread dump:
          "Finalizer thread" (TID:0xee3003b0, sys_thread_t:0xef460de0) prio=1
          "Async Garbage Collector" (TID:0xee300368, sys_thread_t:0xef490de0) prio=1
          "Idle thread" (TID:0xee300320, sys_thread_t:0xef4c0de0) prio=0
          "clock handler" (TID:0xee3001f8, sys_thread_t:0xef4f0de0) prio=11
          "main" (TID:0xee3000a0, sys_thread_t:0x79cf0) prio=5 *current thread*
              X.check_runtime_validity(Compiled Code)
              X.main(Compiled Code)
      Monitor Cache Dump:
      Registered Monitor Dump:
          Compiled code lock: unowned
          Finalize me queue lock: unowned
          Thread queue lock: unowned
          Class lock: unowned
          Java stack lock: unowned
          Code rewrite lock: unowned
          Heap lock: unowned
          Has finalization queue lock: unowned
          Monitor IO lock: unowned
          Child death monitor: unowned
          Event monitor: unowned
          I/O monitor: unowned
          Alarm monitor: unowned
              Waiting to be notified:
                  "clock handler"
          Sbrk lock: unowned
          Monitor cache lock: unowned
          Monitor registry: monitor owner: "main"
      Thread Alarm Q:
      Abort(coredump)

      $ cat X.java
      /**
       ** JAVATEST : The Modena JAVA Test Suite, Version 1.0, June 1996
       ** Copyright (c) 1996 Modena Software (I) Pvt. Ltd., All Rights Reserved
       **/

      /*
       * Section: 3.4
       *
       * Filename: c0340601.java
       *
       * Purpose: Positive test for section 3.4, para 6:
       *
       * "casting of a value of reference type to a variable of
       * reference type may require a run-time validity check.
       * The basic principle is that if the compiler is able to
       * prove from the compile-time type of the value that it
       * can always be converted to the type of the variable
       * ( that is, that assignment conversion applies), then
       * no run-time check is required; otherwise, execution of
       * cast operator must verify at run-time that the run-time
       * type is compatible with the type of the variable ( and
       * if it is not compatible, an exception is thrown)."
       *
       * Language Specification: October 30, 1995
       */

      import Chk;
       
      class S extends T
      {
        void f() {}
      }

      class T
      {
      }

      class X{

        private static boolean status = false;
        
        private static void check_runtime_validity ()
          {
            {
              // S is a class that is not final and extends class T
              // T is a class that is not final

              S os = null;
              
              try {
              os = (S) new T();
              }
              
              catch (ClassCastException arg)
              {
                status = true;
              }
              
              Chk.chkBooleanVal ("err_1", "status", status, true);
              
              status = false;
              
              try{
              os.f ();
              }
              catch (NullPointerException arg)
              {
                status = true;
              }
              
              Chk.chkBooleanVal ("err_2", "status", status, true);
            }
            {
              T[] ot = new T[10];
              S[] os = null;

              try{
              os = (S[]) ot;
              }

              catch (ClassCastException arg)
              {
                status = true;
              }

              Chk.chkBooleanVal ("err_3", "status", status, true);
              status = false;

              try{
              os[0].f();
              }

              catch (NullPointerException arg)
              {
                status = true;
              }
              Chk.chkBooleanVal ("err_4", "status", status, true);
            }
          }
        
        public static void main(String argv[])
          {
            
            check_runtime_validity ();
            
            Chk.endTest("c0340601");
          }
      }

      $ cat Chk.java
      public class Chk {

        Chk(){}

        public static boolean ErrorFlag = false;

        public static void chkByteVal(String errStr, String varName, byte val, byte expectedVal)
          {
             if(val!=expectedVal) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkShortVal(String errStr, String varName, short val, short expectedVal)
          {
             if(val!=expectedVal) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkCharVal(String errStr, String varName, char val, char expectedVal)
          {
             if(val!=expectedVal) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkIntVal(String errStr, String varName, int val, int expectedVal)
          {
             if(val!=expectedVal) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkLongVal(String errStr, String varName, long val, long expectedVal)
          {
             if(val!=expectedVal) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkFloatVal(String errStr, String varName, float val, float expectedVal)
          {
             if(((val-expectedVal) > 0.000001) | (expectedVal-val) > 0.000001) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkDoubleVal(String errStr, String varName, double val, double expectedVal)
          {
             if(((val-expectedVal) > 0.000001) | (expectedVal-val) > 0.000001) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkStringVal(String errStr, String varName, String val, String expectedVal)
          {
             if(!val.equals(expectedVal)) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkBooleanVal(String errStr, String varName, boolean val, boolean expectedVal)
          {
             if(val!=expectedVal) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: " + varName + " = " + val +" :: expected value " + expectedVal);
             }
          }

        public static void chkCond(String errStr, boolean cond)
          {
             if(!cond) {
               ErrorFlag=true;
               System.out.println("Error at " + errStr + " :: Boolean Expr FALSE : expected TRUE");
             }
          }

        public static void endTest(String fname)
          {
             if (ErrorFlag) {
               System.out.println("Test "+fname+" Failed");
               System.exit(1);
             }
             else {
               System.out.println("Test "+fname+" Passed");
               System.exit(0);
             }
          }
      }



      Attachments

        Activity

          People

            duke J. Duke
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: