java.lang.ClassFormatError, jruby's bug or JVM's

Hi all
Couple of days ago, I post a message of “java.lang.ClassFormatError
under IBM java”. With the new release of the Jruby 1.60, the same
thing happens again. Is this a bug of Jruby or it is something related
to IBM java?

Thanks!

Some details of the problem
to trigger the problem, just run a rake session, even without a
rakefile
jruby -S rake -T
ClassLoader.java:265:in defineClass': java.lang.ClassFormatError: JVMCFRE068 class name is invalid; class=rubyjit $initialize_9FFD7936C93B2FA4E78CC51FF56BE551BF6DD8A6#block_0$RUBY $__file__, offset=0 from JRubyClassLoader.java:76:indefineClass’
from InvocationMethodFactory.java:1351:in endClassWithBytes' from InvocationMethodFactory.java:1335:inendCallWithBytes’
from InvocationMethodFactory.java:832:in getBlockCallback' from RuntimeHelpers.java:165:increateBlockCallback’
from RuntimeHelpers.java:262:in createCompiledBlockBody' from RuntimeHelpers.java:252:increateCompiledBlockBody’
from RuntimeCache.java:421:in createBlockBody' from RuntimeCache.java:66:ingetBlockBody’
from AbstractScript.java:93:in getBlockBody0' from D:/jruby/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:97:infile
from D:/jruby/lib/ruby/site_ruby/1.8/rubygems/requirement.rb:-1:in
__file__' from AbstractScript.java:41:infile
from JittedMethod.java:187:in call' from DefaultMethod.java:187:incall’
from CachingCallSite.java:146:in callBlock' from CachingCallSite.java:152:incall’
from RubyClass.java:799:in newInstance' from RubyClass$i$newInstance.gen:65535:incall’
from JavaMethod.java:266:in call' from CachingCallSite.java:282:incacheAndCall’
from CachingCallSite.java:139:in call' from FCallOneArgNode.java:36:ininterpret’
from NewlineNode.java:103:in interpret' from WhenOneArgNode.java:36:inwhenSlowTest’
from WhenOneArgNode.java:46:in when' from CaseNode.java:133:ininterpret’
from NewlineNode.java:103:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:190:in call' from DefaultMethod.java:179:incall’
from CachingCallSite.java:282:in cacheAndCall' from CachingCallSite.java:139:incall’
from CallOneArgNode.java:57:in interpret' from InstAsgnNode.java:95:ininterpret’
from NewlineNode.java:103:in interpret' from BlockNode.java:71:ininterpret’
from ASTInterpreter.java:74:in INTERPRET_METHOD' from InterpretedMethod.java:298:incall’
from DefaultMethod.java:219:in call' from CachingCallSite.java:214:incallBlock’
from CachingCallSite.java:220:in call' from RubyClass.java:813:innewInstance’
from RubyClass$i$newInstance.gen:65535:in call' from JavaMethod.java:300:incall’
from CachingCallSite.java:205:in call' from CallThreeArgNode.java:61:ininterpret’
from LocalAsgnNode.java:123:in interpret' from NewlineNode.java:103:ininterpret’
from IfNode.java:119:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:276:in call' from DefaultMethod.java:211:incall’
from CachingCallSite.java:205:in call' from FCallSpecialArgNode.java:43:ininterpret’
from NewlineNode.java:103:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:233:in call' from DefaultMethod.java:195:incall’
from CachingCallSite.java:302:in cacheAndCall' from CachingCallSite.java:173:incall’
from CallTwoArgNode.java:59:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from IfNode.java:117:ininterpret’
from NewlineNode.java:103:in interpret' from BlockNode.java:71:ininterpret’
from IfNode.java:117:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:111:inINTERPRET_BLOCK’
from InterpretedBlock.java:374:in evalBlockBody' from InterpretedBlock.java:347:inyield’
from InterpretedBlock.java:304:in yield' from Block.java:130:inyield’
from YieldNode.java:112:in interpret' from IfNode.java:117:ininterpret’
from NewlineNode.java:103:in interpret' from BlockNode.java:71:ininterpret’
from ASTInterpreter.java:74:in INTERPRET_METHOD' from InterpretedMethod.java:169:incall’
from DefaultMethod.java:171:in call' from CachingCallSite.java:112:incallBlock’
from CachingCallSite.java:118:in call' from RubyClass.java:792:innewInstance’
from RubyClass$i$newInstance.gen:65535:in call' from CachingCallSite.java:272:incacheAndCall’
from CachingCallSite.java:114:in callBlock' from CachingCallSite.java:123:incallIter’
from CallNoArgBlockNode.java:64:in interpret' from NewlineNode.java:103:ininterpret’
from RootNode.java:129:in interpret' from ASTInterpreter.java:95:inINTERPRET_EVAL’
from ASTInterpreter.java:160:in evalWithBinding' from RubyKernel.java:1134:inevalCommon’
from RubyKernel.java:1087:in eval' from RubyKernel$s$0$3$eval.gen:65535:incall’
from DynamicMethod.java:225:in call' from DynamicMethod.java:221:incall’
from CachingCallSite.java:205:in call' from FCallThreeArgNode.java:40:ininterpret’
from LocalAsgnNode.java:123:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from RescueNode.java:216:inexecuteBody’
from RescueNode.java:120:in interpretWithJavaExceptions' from RescueNode.java:110:ininterpret’
from BeginNode.java:83:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:190:in call' from DefaultMethod.java:179:incall’
from CachingCallSite.java:137:in call' from CallOneArgNode.java:57:ininterpret’
from DAsgnNode.java:110:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:111:inINTERPRET_BLOCK’
from InterpretedBlock.java:374:in evalBlockBody' from InterpretedBlock.java:347:inyield’
from InterpretedBlock.java:304:in yield' from Block.java:130:inyield’
from RubyArray.java:1565:in eachCommon' from RubyArray.java:1572:ineach’
from RubyArray$i$0$0$each.gen:65535:in call' from CachingCallSite.java:272:incacheAndCall’
from CachingCallSite.java:114:in callBlock' from CachingCallSite.java:123:incallIter’
from CallNoArgBlockNode.java:64:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:111:inINTERPRET_BLOCK’
from InterpretedBlock.java:374:in evalBlockBody' from InterpretedBlock.java:347:inyield’
from InterpretedBlock.java:304:in yield' from Block.java:130:inyield’
from RubyArray.java:1643:in reverseEach' from RubyArray.java:1652:inreverse_each’
from RubyArray$i$0$0$reverse_each.gen:65535:in call' from CachingCallSite.java:272:incacheAndCall’
from CachingCallSite.java:114:in callBlock' from CachingCallSite.java:123:incallIter’
from CallNoArgBlockNode.java:64:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:190:in call' from DefaultMethod.java:179:incall’
from CachingCallSite.java:282:in cacheAndCall' from CachingCallSite.java:139:incall’
from FCallSpecialArgNode.java:39:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:147:in call' from DefaultMethod.java:163:incall’
from CachingCallSite.java:262:in cacheAndCall' from CachingCallSite.java:105:incall’
from CallNoArgNode.java:62:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:190:in call' from DefaultMethod.java:179:incall’
from CachingCallSite.java:282:in cacheAndCall' from CachingCallSite.java:139:incall’
from FCallSpecialArgNode.java:39:in interpret' from NewlineNode.java:103:ininterpret’
from IfNode.java:117:in interpret' from NewlineNode.java:103:ininterpret’
from ASTInterpreter.java:74:in INTERPRET_METHOD' from InterpretedMethod.java:147:incall’
from DefaultMethod.java:163:in call' from CachingCallSite.java:262:incacheAndCall’
from CachingCallSite.java:105:in call' from CallNoArgNode.java:62:ininterpret’
from ClassVarAsgnNode.java:92:in interpret' from OpAsgnOrNode.java:99:ininterpret’
from NewlineNode.java:103:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:147:in call' from DefaultMethod.java:163:incall’
from CachingCallSite.java:262:in cacheAndCall' from CachingCallSite.java:105:incall’
from CallNoArgNode.java:62:in interpret' from CallTwoArgNode.java:59:ininterpret’
from LocalAsgnNode.java:123:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:233:in call' from DefaultMethod.java:195:incall’
from CachingCallSite.java:302:in cacheAndCall' from CachingCallSite.java:173:incall’
from CallSpecialArgNode.java:69:in interpret' from NewlineNode.java:103:ininterpret’
from BlockNode.java:71:in interpret' from ASTInterpreter.java:74:inINTERPRET_METHOD’
from InterpretedMethod.java:233:in call' from DefaultMethod.java:195:incall’
from CachingCallSite.java:302:in cacheAndCall' from CachingCallSite.java:173:incall’
from D:/jruby/bin/rake:18:in __file__' from D:/jruby/bin/rake:-1:inload’
from Ruby.java:670:in runScript' from Ruby.java:574:inrunNormally’
from Ruby.java:423:in runFromMain' from Main.java:278:indoRunFromMain’
from Main.java:198:in internalRun' from Main.java:164:inrun’
from Main.java:148:in run' from Main.java:128:inmain’

Jruby version
jruby -v
jruby 1.6.0 (ruby 1.8.7 patchlevel 330) (2011-03-15 f3b6154) (IBM J9
VM 1.6.0) [Windows XP-x86-java]

java version

%JAVA_HOME%\bin\java -version
java version “1.6.0”
Java™ SE Runtime Environment (build pwi3260sr1-20080416_01(SR1))
IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Windows XP x86-32
jvmwi3260-20080415_18762 (JIT enabled, AOT enabled)
J9VM - 20080415_018762_lHdSMr
JIT - r9_20080415_1520
GC - 20080415_AA)
JCL - 20080412_01

appreciate your kind help.

I suspect that IBM’s JVM doesn’t like the class name ‘rubyjit’. I don’t
think capitalization of the class names is a language specification
(Java SE Specifications),
but rather a convention. As such, one may argue that J9 is taking the
convention too far in rejecting the name.

If my guess is right, it would be a simple one character edit to silence
J9.

---- 8< ---- 8< -----
[system] jruby [git:master] $ git diff --no-ext-diff
diff --git a/src/org/jruby/compiler/JITCompiler.java
b/src/org/jruby/compiler/JITCompiler.java
index 19d678f…4c732f2 100644
— a/src/org/jruby/compiler/JITCompiler.java
+++ b/src/org/jruby/compiler/JITCompiler.java
@@ -61,7 +61,7 @@ import org.objectweb.asm.util.TraceClassVisitor;

public class JITCompiler implements JITCompilerMBean {
public static final boolean USE_CACHE = true;

  • public static final String RUBY_JIT_PREFIX = “rubyjit”;
  • public static final String RUBY_JIT_PREFIX = “Rubyjit”;

    public static class JITCounts {
    private final AtomicLong compiledCount = new AtomicLong(0);

---- >8 ---- >8 -----

Anyhow, please file a bug at http://bugs.jruby.org.

Thanks for the quick update.
Just did a quick test, The Capital “Rubyjit” doesn’t work. It looks
like the culprit is the “#” in the class name…

I am having problem of filing a bug. Can anybody else help me do this?
Thanks.

You’ll need to register with Codehaus to open a ticket.