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

assertion failure when GetMethodDeclaringClass is passed with an array class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.4.0
    • vm-legacy
    • None
    • hopper
    • sparc
    • solaris_8
    • Verified

      I created a test case by modifying NSK JVMDI test declcls001 to
      pass an array class to GetMethodDeclaringClass and a valid jmethodID
      and ran into VM assertion failure:
        assert(k->klass_part()->oop_is_instance(), "cast to instanceKlass")

      Stack trace is:
        [10] instanceKlass::cast(k = 0xf590c4f8), line 362 in "instanceKlass.hpp"
        [11] JvmdiInternal::get_methodOop(method = 0x1622e8, k = 0xf590c4f8), line 37 in "jvmdi_info2.cpp"
        [12] GetMethodDeclaringClass(clazz = 0xcbb7c, method = 0x1622e8, declaringClassPtr = 0xffbeda1c), line 108 in "jvmdi_info2.cpp"
        [13] check_array(env = 0x3d18c, cl_name = 0xfe5910e0 "[[J", name = 0xfe5910e4 "clone", sig = 0xfe5910ec "(V)Ljava/lang/Object", stat = 0, decl_cl_name = 0xfe591104 "[[J;"), line 43 in "mytest.c"
        [14] Java_mytest_check(env = 0x3d18c, cls = 0xffbedaf8), line 68 in "mytest.c"
        [15] 0xf9c0f5c8(0x3d0f0, 0xb8, 0xffbedbe8, 0xffffffff, 0x0, 0xffbedb10), at 0xf9c0f5c7
        [16] 0xf9c06680(0x3d0f0, 0xb8, 0x7, 0x162250, 0x162760, 0xffbedb88), at 0xf9c0667f
        [17] 0xf9c06570(0xf183d4a0, 0x3d0f0, 0x8, 0xf9c28dc0, 0xffbeded0, 0xffbedc08), at 0xf9c0656f
        [18] 0xf9c00528(0xffbedcf4, 0xffbedfa0, 0xa, 0xf590bd70, 0xf9c0d7ac, 0xffbedec4), at 0xf9c00527
        [19] JavaCalls::call_helper(result = 0xffbedf98, m = 0xffbedea0, args = 0xffbedeb8, __the_thread__ = 0x3d0f0), line 368 in "javaCalls.cpp"
        [20] os::os_exception_wrapper(f = 0xfdb4abf0 = &JavaCalls::call_helper(JavaValue*,methodHandle*,JavaCallArguments*,Thread*), value = 0xffbedf98, method = 0xffbedea0, args = 0xffbedeb8, thread = 0x3d0f0), line 1970 in "os_solaris.cpp"
        [21] JavaCalls::call(result = 0xffbedf98, method = CLASS, args = 0xffbedeb8, __the_thread__ = 0x3d0f0), line 305 in "javaCalls.cpp"
        [22] jni_invoke(env = 0x3d18c, result = 0xffbedf98, receiver = (nil), call_type = JNI_STATIC, methodID = 0x162088, args = 0xffbedf7c, __the_thread__ = 0x3d0f0), line 604 in "jni.cpp"
        [23] jni_CallStaticVoidMethod(env = 0x3d18c, cls = 0x3dd28, methodID = 0x162088, ...), line 941 in "jni.cpp"
        [24] main(0x5, 0xffbee8fc, 0xffbee914, 0x28000, 0x0, 0x0), at 0x11da4

      One possible fix could be to have JvmdiInternal::get_methodOop()
      to check if k->klass_part()->oop_is_instance() before casting
      the klassOop.

      However, what if klassOop is an array class (i.e.
      k->klass_part()->oop_is_objArray() or oop_is_typeArray() is true)?

      An array type has a public clone() member. (see the Java Language Spec,
      http://java.sun.com/docs/books/jls/second_edition/html/arrays.doc.html#64347)

      In theory, GetMethodDeclaringClass() and other functions should work
      if class is an array class and mid is the jmethodID for clone().
      We shall take this into consideration when working on a fix for
      this bug.

      To reproduce (the test case is attached as mytest.tar.Z):
      doit.sh $JAVA_HOME

      ###@###.### 2002-03-12

      Converted Mandy's test to NSK regression test style and copied the updated
      test to /net/sqesvr/export/vsn/GammaBase/Bugs/4529900.

      Name: elR10090 Date: 03/26/2002


      Eugene I. Latkin <###@###.###>

      Daniel Daugherty has provided a testcase targeted against
      regressions of this bug. I have put that testcase into
      testbase_nsk -- as requested. The testcase sources are
      just the same as provided by Dan. The only impact of
      putting the testcase into testbase_nsk is that it will
      be run regularly.

      The testcase name is:
          nsk/regression/b4529900

      It will appear with "r13" release of testbase_nsk, which
      we are going to build it this Friday, 29 Mar 2002. If that
      build will pass internal verification, "r13" release will
      be shipped to Santa Clara the next week.

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

      Name: pvR10198 Date: 03/28/2002


      This bug also affects the following test from testbase_nsk:

          nsk/jvmdi/GetMethodDeclaringClass/declcls003

      The test will be available in the next release v141r13.

      Pavel Vysotski <###@###.###>

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

            dcubed Daniel Daugherty
            mchung Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: