Nice. Have a patch? :) geir
Vladimir Ivanov wrote: > Seems, that drlvm rejects valid code when 'end_pc' value for exception > handler is equal to code array length. > At least, when I update value for 'end_pc' in my simple class it was > rejected by drlvm and accepted by RI. > > Thanks, Vladimir > > More details: > 2 class attached: test.class.ref - generated by javac, > test.class - updated (line 108 for file belove was updated: 8 -> 10) > ------------------------- test.code------------------------ > > /** > * Generated ccode file > * @author VMTT (Virtual Machine Testing Tools) > * @version 1.0 > * @lastmod: Fri Aug 11 11:20:30 NOVST 2006 > */ > > magic = xCAFEBABE > > minor_version = 0 > > major_version = 48 > > constant_pool_count = 18 > > constant_pool { > /* #1 */ Method = #5 #14 > /* #2 */ Class = #15 > /* #3 */ Method = #2 #14 > /* #4 */ Class = #16 > /* #5 */ Class = #17 > /* #6 */ UTF8 = "<init>" > /* #7 */ UTF8 = "()V" > /* #8 */ UTF8 = "Code" > /* #9 */ UTF8 = "LineNumberTable" > /* #10 */ UTF8 = "main" > /* #11 */ UTF8 = "([Ljava/lang/String;)V" > /* #12 */ UTF8 = "SourceFile" > /* #13 */ UTF8 = "test.java" > /* #14 */ NameAndType = #6 #7 > /* #15 */ UTF8 = "java/lang/Exception" > /* #16 */ UTF8 = "test" > /* #17 */ UTF8 = "java/lang/Object" > } > > access_flags = PUBLIC SUPER // x21 > > this_class = #4 // "test" > > super_class = #5 // "java/lang/Object" > > interfaces_count = 0 > > interfaces { > } > > fields_count = 0 > > methods_count = 2 > > methods { > method { > access_flag = PUBLIC // x01 > name_index = #6 // "<init>" > descriptor_index = #7 // "()V" > attributes_count = 1 > attributes { > attribute Code { > attribute_name_index = #8 // "Code" > attribute_length = 29 > max_stack = 1 > max_locals = 1 > code_length = 5 > code asm { > 0: aload_0 > 1: invokespecial #1 // "java/lang/Object" "<init>" "()V" > 4: return > } > exception_table_length = 0 > attributes_count = 1 > attributes { > attribute LineNumberTable { > attribute_name_index = #9 // "LineNumberTable" > attribute_length = 6 > line_number_table_length = 1 > line_number_table { > // start_pc line_number > 0 1 > } > } > } > } > } > } > method { > access_flag = PUBLIC STATIC // x09 > name_index = #10 // "main" > descriptor_index = #11 // "([Ljava/lang/String;)V" > attributes_count = 1 > attributes { > attribute Code { > attribute_name_index = #8 // "Code" > attribute_length = 50 > max_stack = 2 > max_locals = 2 > code_length = 10 > code asm { > 0: new #2 // "java/lang/Exception" > 3: dup > 4: invokespecial #3 // "java/lang/Exception" "<init>" "()V" > 7: athrow > 8: astore_1 > 9: return > } > exception_table_length = 1 > exception_table { > // start_pc end_pc handler_pc catch_type > 0 10 8 2 > } > attributes_count = 1 > attributes { > attribute LineNumberTable { > attribute_name_index = #9 // "LineNumberTable" > attribute_length = 14 > line_number_table_length = 3 > line_number_table { > // start_pc line_number > 0 4 > 8 5 > 9 7 > } > } > } > } > } > } > } > > attributes_count = 1 > attributes { > attribute SourceFile { > attribute_name_index = #12 // "SourceFile" > attribute_length = 2 > sourcefile_index = #13 // "test.java" > } > } > --------------------------------------------------------------- > > Output: > > C:\tmp\vm_tool>java -showversion test > java version "1.4.2_10" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03) > Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode) > > > C:\tmp\vm_tool>C:\jdk1.5.0_06\bin\java -showversion test > java version "1.5.0_06" > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) > Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode) > > > C:\tmp\vm_tool>C:\harmony\drlvm1.5\build\win_ia32_msvc_debug\deploy\jre\bin\java > > -Dvm.assert_dialog=false -cp . -showversion test > java version "1.5.0" > pre-alpha : not complete or compatible > svn = r430643, (Aug 11 2006), Windows/ia32/msvc 1310, debug build > http://incubator.apache.org/harmony > vf_debug: VerifyError: (class: test, method: main([Ljava/lang/String;)V) > Handler pc is out of range > java.lang.VerifyError: (class: test, method: main([Ljava/lang/String;)V) > Handler pc is out of range > at java.lang.VMClassRegistry.defineClass() > at java.lang.ClassLoader.defineClass() > at java.security.SecureClassLoader.defineClass( > SecureClassLoader.java:68) > at java.net.URLClassLoader.findClassImpl(URLClassLoader.java:1130) > at java.net.URLClassLoader$4.run(URLClassLoader.java:617) > at java.net.URLClassLoader$4.run(URLClassLoader.java:616) > at java.security.AccessController.doPrivilegedImpl() > at java.security.AccessController.doPrivileged() > at java.net.URLClassLoader.findClass(URLClassLoader.java:614) > at java.lang.ClassLoader.loadClass() > at java.net.URLClassLoader$SubURLClassLoader.loadClass( > URLClassLoader.java:116) > > C:\tmp\vm_tool>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . > -showversion test > java version 1.5 (subset) > > (c) Copyright 1991, 2006 The Apache Software Foundation or its > licensors, as > applicable. > > C:\tmp\vm_tool> > > > On 8/10/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: >> >> >> >> Anton Luht wrote: >> > Hello, >> > >> > DRLVM has an (undocumented?) option to switch off verifier >> > -Dvm.use_verifier=false . With this option activemq starts without >> > crash. Verifier seem to be the blocker. >> >> Aw... I was hoping you'd tell us what the problem was. Any clue? >> >> geir >> >> > >> > On 8/8/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: >> >> >> >> >> >> Gregory Shimansky wrote: >> >> > On Tuesday 08 August 2006 00:01 Geir Magnusson Jr wrote: >> >> >> Ok - I made that fix and still seem to have a problem, even after a >> >> >> clean rebuild. I guess I should figure out how to turn on the >> >> trace... >> >> > >> >> > The problem is that class loader does not chain VerifyError to >> >> > NoClassDefFoundError so debugging such problems is diffucult without >> >> tracing. >> >> > I think this is a place for improvement in drlvm. >> >> > >> >> > I tried to fix the problem and found out that verifier just doesn't >> >> understand >> >> > exception handlers which point to the code length address (code end >> >> + 1). It >> >> > is a surprise that this problem didn't appear earlier. >> >> >> >> App-oriented testing... :) >> >> >> >> > >> >> > My patch attached to JIRA attempts to fix the problem in verifier >> >> only, the >> >> > application still fails to start. In default mode it exits silently, >> >> I didn't >> >> > find any exception logs or something. When using interpreter -Xint >> >> it fails >> >> > with ArrayStoreException still without any stack trace. I'll try to >> >> find out >> >> > what is happening. >> >> >> >> Nice work. Thanks for doing this... >> >> >> >> geir >> >> >> >> > >> >> >> Anton Luht wrote: >> >> >>> Hello, >> >> >>> >> >> >>> The problem is with verifier. >> >> >>> >> >> >>> The code in Verifier.cpp: >> >> >>> >> >> >>> if( ( start_pc >= len ) || ( end_pc >= len ) || ( >> >> handler_pc >= >> >> >>> len ) ) >> >> >>> ... >> >> >>> >> >> >>> result = VER_ErrorHandler; >> >> >>> >> >> >>> I've modified error logging a bit to log values of start_pc, >> end_pc, >> >> >>> handler_pc and len and that's the output: >> >> >>> >> >> >>> >> >> >>> Loading message broker from: xbean:activemq.xml >> >> >>> vf_debug: VerifyError: (class: >> >> >>> edu/emory/mathcs/backport/java/util/concurrent/lo >> >> >>> cks/ReentrantLock$NonfairSync, method: lockInterruptibly()V, len: >> >> 103, >> >> >>> start_pc: >> >> >>> 87, end_pc: 103, handler_pc: 21) Handler pc is out of range >> >> >>> vf_debug: verifying class >> >> >>> edu/emory/mathcs/backport/java/util/concurrent/locks/R >> >> >>> eentrantLock (method <init>()V) couldn't load class >> >> >>> "edu/emory/mathcs/backport/j >> >> >>> ava/util/concurrent/locks/ReentrantLock$NonfairSync" >> >> >>> vf_debug: VerifyError: >> >> >>> edu/emory/mathcs/backport/java/util/concurrent/locks/Reen >> >> >>> trantLock$NonfairSync >> >> >>> Failed to execute main task. Reason: >> java.lang.NoClassDefFoundError >> : >> >> >>> edu/emory/m >> >> >>> >> athcs/backport/java/util/concurrent/locks/ReentrantLock$NonfairSync >> >> >> >>> >> >> >>> I'm not an expert in verification but seems like >> >> >>> >> >> >>> end_pc >= len >> >> >>> should be replaced with >> >> >>> end_pc > len >> >> >>> >> >> >>> On 8/5/06, Geir Magnusson Jr <[EMAIL PROTECTED]> wrote: >> >> >>>> Anyone interested? :) >> >> > >> >> >> >> --------------------------------------------------------------------- >> >> Terms of use : http://incubator.apache.org/harmony/mailing.html >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> > >> >> >> --------------------------------------------------------------------- >> Terms of use : http://incubator.apache.org/harmony/mailing.html >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > ------------------------------------------------------------------------ > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]