Harmony
  1. Harmony
  2. HARMONY-1911

[drlvm][opt] failed assert in class_get_addr_of_constant

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: DRLVM
    • Labels:
      None
    • Environment:
      SUSE9
    • Patch Info:
      Patch Available

      Description

      To reproduce:
      ./java -Xem:opt -cp $classlib/modules/swing/bin/test:junit.jar:$classlib/deploy/build/test/support.jar junit.textui.TestRunner javax.swing.colorchooser.AbstractColorChooserPanelTest

      java: /export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/init/vm.cpp:151: const void* class_get_addr_of_constant(Class*, unsigned int): Assertion `(cp[0].tags[cp_index] & 0x0F) != CONSTANT_String' failed.
      SIGABRT in VM code.
      Stack trace:
      1: ?? (??:-1)
      2: abort (??:-1)
      3: __assert_fail (??:-1)
      4: class_get_addr_of_constant(Class*, unsigned int) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/init/vm.cpp:153)
      5: class_get_const_addr (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/class_support/C_Interface.cpp:869)
      6: Jitrino::DrlVMCompilationInterface::getConstantValue(Jitrino::MethodDesc*, unsigned int) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/vm/drl/DrlVMInterface.cpp:894)
      7: .L1127 (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp:3430)
      8: Jitrino::JavaByteCodeTranslator::checkForArrayInitializer(Jitrino::Opnd*, unsigned char const*, unsigned int, unsigned int) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp:3279)
      9: .L786 (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/java/JavaByteCodeTranslator.cpp:2142)
      10: .L234 (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/java/JavaByteCodeParser.cpp:619)
      11: Jitrino::ByteCodeParser::parse(Jitrino::ByteCodeParserCallback*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/ByteCodeParser.h:70)
      12: Jitrino::JavaTranslator::translateMethod(Jitrino::CompilationInterface&, Jitrino::MethodDesc&, Jitrino::IRBuilder&) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/java/JavaTranslator.cpp:58)
      13: Jitrino::TranslatorSession::translate() (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/TranslatorIntfc.cpp:62)
      14: Jitrino::TranslatorSession::run() (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/translator/TranslatorIntfc.cpp:44)
      15: Jitrino::runPipeline(Jitrino::CompilationContext*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/main/Jitrino.cpp:226)
      16: Jitrino::compileMethod(Jitrino::CompilationContext*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/main/Jitrino.cpp:261)
      17: Jitrino::Jitrino::CompileMethod(Jitrino::CompilationContext*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/main/Jitrino.cpp:286)
      18: JIT_compile_method_with_params (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/vm/drl/DrlJITInterface.cpp:282)
      19: Dll_JIT::compile_method_with_params(void*, Method*, OpenMethodExecutionParams) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/include/dll_jit_intf.h:86)
      20: compile_do_compilation_jit(Method*, JIT*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/jit/compile.cpp:700)
      21: vm_compile_method (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/class_support/C_Interface.cpp:2538)
      22: DrlEMImpl::compileMethod(Method*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/em/src/DrlEMImpl.cpp:520)
      23: CompileMethod (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/em/src/em_intf.cpp:49)
      24: compile_do_compilation (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/jit/compile.cpp:780)
      25: compile_jit_a_method(Method*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/jit/compile.cpp:828)
      26: IP is 0x410D0172 <native code>
      27: javax/swing/colorchooser/AbstractColorChooserPanel.installChooserPanel(Ljavax/swing/JColorChooser;)V (AbstractColorChooserPanel.java:-1)
      28: javax/swing/plaf/basic/BasicColorChooserUI$PropertyHandler.propertyChange(Ljava/beans/PropertyChangeEvent;)V (BasicColorChooserUI.java:-1)
      29: java/beans/PropertyChangeSupport.doFirePropertyChange(Ljava/beans/PropertyChangeEvent;)V (PropertyChangeSupport.java:-1)
      30: java/beans/PropertyChangeSupport.firePropertyChange(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V (PropertyChangeSupport.java:59)
      31: java/awt/Component.firePropertyChangeImpl(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V (Component.java:-1)
      32: java/awt/Component.firePropertyChange(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V (Component.java:-1)
      33: javax/swing/JColorChooser.setChooserPanels([Ljavax/swing/colorchooser/AbstractColorChooserPanel;)V (JColorChooser.java:-1)
      34: javax/swing/plaf/basic/BasicColorChooserUI.installUI(Ljavax/swing/JComponent;)V (BasicColorChooserUI.java:-1)
      35: javax/swing/JComponent.setUI(Ljavax/swing/plaf/ComponentUI;)V (JComponent.java:-1)
      SIGSEGV in VM code.
      Stack trace:
      36: Jitrino::Ia32::StackInfo::readByteSize(unsigned char const*) const (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp:107)
      37: Jitrino::Ia32::RuntimeInterface::getBcLocationForNative(Jitrino::MethodDesc*, unsigned long long, unsigned short*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/codegenerator/ia32/Ia32RuntimeInterface.cpp:78)
      38: Jitrino::Jitrino::GetBcLocationForNative(Jitrino::MethodDesc*, unsigned long long, unsigned short*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/main/Jitrino.cpp:358)
      39: get_bc_location_for_native (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/jitrino/src/vm/drl/DrlJITInterface.cpp:590)
      40: Dll_JIT::get_bc_location_for_native(Method*, void*, unsigned short*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/include/dll_jit_intf.h:240)
      41: get_file_and_line (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/stack/stack_trace.cpp:60)
      42: st_get_java_method_info (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/stack/stack_dump.cpp:196)
      43: st_print_stack(Registers*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/stack/stack_dump.cpp:242)
      44: abort_handler(int, siginfo*, void*) (/export/users2/avarlamo/linux.ia32/svn-repo/drlvm/vm/vmcore/src/util/linux/signals_ia32.cpp:614)
      <end of stack trace>

        Activity

        Hide
        Egor Pasko added a comment -

        I am taking a look!

        Show
        Egor Pasko added a comment - I am taking a look!
        Hide
        Egor Pasko added a comment -

        bug in translator when recognizing array initialization pattern (allows to preload an array to initialize via arraycopy), breaks when encounters array of strings. A short reproducer attached (Harmony1911.java)

        Show
        Egor Pasko added a comment - bug in translator when recognizing array initialization pattern (allows to preload an array to initialize via arraycopy), breaks when encounters array of strings. A short reproducer attached (Harmony1911.java)
        Hide
        Egor Pasko added a comment -

        fix attached.
        Pavel Ozhdikhin, please, review
        Alexey, please, verify that the patch solves the problem as expected

        'build test' passed on SUSE9 (even with OPT in debug mode)

        Show
        Egor Pasko added a comment - fix attached. Pavel Ozhdikhin, please, review Alexey, please, verify that the patch solves the problem as expected 'build test' passed on SUSE9 (even with OPT in debug mode)
        Hide
        Pavel Ozhdikhin added a comment -

        The patch is good and fixes the issue - the fixed method was not intended to work with string values.

        However, I don't think we should rename getNumericValue() to getArrayInitValue() because:

        1. The method is general for reading any numeric value from the bytecode
        2. It has nothing special for the arrays
        3. Some time we might want to add getStringValue() method to optimize loading string arrays

        I think we should revert the method's name in the patch.

        Show
        Pavel Ozhdikhin added a comment - The patch is good and fixes the issue - the fixed method was not intended to work with string values. However, I don't think we should rename getNumericValue() to getArrayInitValue() because: 1. The method is general for reading any numeric value from the bytecode 2. It has nothing special for the arrays 3. Some time we might want to add getStringValue() method to optimize loading string arrays I think we should revert the method's name in the patch.
        Hide
        Egor Pasko added a comment -

        Pavel, you convinced me. I updated the patch accordingly (ver2)

        Show
        Egor Pasko added a comment - Pavel, you convinced me. I updated the patch accordingly (ver2)
        Hide
        Geir Magnusson Jr added a comment -

        r471488

        Ubuntu 6 - smoke, c-unit, ~kernel

        Show
        Geir Magnusson Jr added a comment - r471488 Ubuntu 6 - smoke, c-unit, ~kernel
        Hide
        Geir Magnusson Jr added a comment -

        There now is a new problem, but that will be entered as a new issue :

        geir@t42-laptop:~/dev/apache/harmony/enhanced/trunk/working_vm/build/deploy/jre/bin$ ./java -version
        Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
        java version "1.5.0"
        pre-alpha : not complete or compatible
        svn = r471468, (Nov 5 2006), Linux/ia32/gcc 3.4.6, debug build
        http://incubator.apache.org/harmony
        geir@t42-laptop:~/dev/apache/harmony/enhanced/trunk/working_vm/build/deploy/jre/bin$ ./java -Xem:opt -cp $classlib/modules/swing/bin/test:junit.jar:$classlib/deploy/build/test/support.jar junit.textui.TestRunner javax.swing.colorchooser.AbstractColorChooserPanelTest
        ..E
        Time: 12.017
        There was 1 error:
        1) testInstallUninstallChooserPanel(javax.swing.colorchooser.AbstractColorChooserPanelTest)java.lang.IllegalAccessError:javax/swing/colorchooser/AbstractColorChooserPanel.getColorFromModel()Ljava/awt/Color; while resolving constant pool entry at index 73 in class javax/swing/colorchooser/AbstractColorChooserPanelTest
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)
        at javax.swing.BasicSwingTestCase.runBareSuper(BasicSwingTestCase.java:117)
        at javax.swing.BasicSwingTestCase.runBareImpl(BasicSwingTestCase.java)
        at javax.swing.BasicSwingTestCase$1.run(BasicSwingTestCase.java)
        at java.lang.Thread.run(Unknown Source)

        FAILURES!!!
        Tests run: 2, Failures: 0, Errors: 1

        geir@t42-laptop:~/dev/apache/harmony/enhanced/trunk/working_vm/build/deploy/jre/bin$

        Show
        Geir Magnusson Jr added a comment - There now is a new problem, but that will be entered as a new issue : geir@t42-laptop:~/dev/apache/harmony/enhanced/trunk/working_vm/build/deploy/jre/bin$ ./java -version Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable. java version "1.5.0" pre-alpha : not complete or compatible svn = r471468, (Nov 5 2006), Linux/ia32/gcc 3.4.6, debug build http://incubator.apache.org/harmony geir@t42-laptop:~/dev/apache/harmony/enhanced/trunk/working_vm/build/deploy/jre/bin$ ./java -Xem:opt -cp $classlib/modules/swing/bin/test:junit.jar:$classlib/deploy/build/test/support.jar junit.textui.TestRunner javax.swing.colorchooser.AbstractColorChooserPanelTest ..E Time: 12.017 There was 1 error: 1) testInstallUninstallChooserPanel(javax.swing.colorchooser.AbstractColorChooserPanelTest)java.lang.IllegalAccessError:javax/swing/colorchooser/AbstractColorChooserPanel.getColorFromModel()Ljava/awt/Color; while resolving constant pool entry at index 73 in class javax/swing/colorchooser/AbstractColorChooserPanelTest at java.lang.reflect.VMReflection.invokeMethod(Native Method) at javax.swing.BasicSwingTestCase.runBareSuper(BasicSwingTestCase.java:117) at javax.swing.BasicSwingTestCase.runBareImpl(BasicSwingTestCase.java) at javax.swing.BasicSwingTestCase$1.run(BasicSwingTestCase.java) at java.lang.Thread.run(Unknown Source) FAILURES!!! Tests run: 2, Failures: 0, Errors: 1 geir@t42-laptop:~/dev/apache/harmony/enhanced/trunk/working_vm/build/deploy/jre/bin$

          People

          • Assignee:
            Geir Magnusson Jr
            Reporter:
            Alexey Varlamov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development