Project

Profile

Help

Bug #2182

java.lang.RuntimeException: Method code too large thrown in query

Added by O'Neil Delpratt almost 5 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Category:
Byte code generation
Sprint/Milestone:
Start date:
2014-10-15
Due date:
% Done:

100%

Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:

Description

Reported by Gunther Rademacher:

The following exception is thrown by the attached xquery file when bytecode generation is switched on:

 java.lang.RuntimeException: Method code too large!
       at com.saxonica.objectweb.asm.MethodWriter.a(Unknown Source)
       at com.saxonica.objectweb.asm.ClassWriter.toByteArray(Unknown Source)
       at com.saxonica.ee.bytecode.util.CompilerService.makeClass(CompilerService.java:959)
       at com.saxonica.ee.bytecode.util.CompilerService.compileToByteCode(CompilerService.java:673)
       at com.saxonica.ee.bytecode.LetExpressionCompiler.makeClosure(LetExpressionCompiler.java:636)
       at com.saxonica.ee.bytecode.LetExpressionCompiler.compileCommonExpr(LetExpressionCompiler.java:177)
       at com.saxonica.ee.bytecode.LetExpressionCompiler.compileToIterator(LetExpressionCompiler.java:133)
       at com.saxonica.ee.bytecode.util.CompilerService.compileToIterator(CompilerService.java:739)
       at com.saxonica.ee.bytecode.LetExpressionCompiler.compileToIterator(LetExpressionCompiler.java:142)
       at com.saxonica.ee.bytecode.util.CompilerService.compileToIterator(CompilerService.java:739)
       at com.saxonica.ee.bytecode.LetExpressionCompiler.compileToIterator(LetExpressionCompiler.java:142)
       at com.saxonica.ee.bytecode.util.CompilerService.compileToIterator(CompilerService.java:739)
       at com.saxonica.ee.bytecode.util.CompilerService.compileToByteCode(CompilerService.java:505)
       at com.saxonica.ee.optim.OptimizerEE.compileToByteCode(OptimizerEE.java:1334)
       at net.sf.saxon.query.XQueryFunction.optimize(XQueryFunction.java:527)
       at net.sf.saxon.query.XQueryFunctionLibrary.optimizeGlobalFunctions(XQueryFunctionLibrary.java:326)
       at net.sf.saxon.query.QueryModule.optimizeGlobalFunctions(QueryModule.java:1200)
       at net.sf.saxon.expr.instruct.Executable.fixupQueryModules(Executable.java:597)
       at net.sf.saxon.query.XQueryParser.makeXQueryExpression(XQueryParser.java:159)
       at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:570)
       at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:633)
       at net.sf.saxon.s9api.XQueryCompiler.compile(XQueryCompiler.java:592)
       at net.sf.saxon.Query.compileQuery(Query.java:787)
       at net.sf.saxon.Query.doQuery(Query.java:340)
       at net.sf.saxon.Query.main(Query.java:111)
  Fatal error during query: java.lang.RuntimeException: Method code too large!
xquery-update-30.xquery (1.05 MB) O'Neil Delpratt, 2014-10-15 11:43 xquery-update-30.xquery

History

#2 Updated by O'Neil Delpratt almost 5 years ago

The ASM library at version 5.0.3 now throws a RuntimeException in the method toByteArray of the ClassWriter class if the method length is greater than 65535. See below:

 public byte[] toByteArray() {
      if (index > 0xFFFF) 
            throw new RuntimeException("Class file too large!");
      }
      ...

ASM 3.3.1 did not have this condition, therefore it would fail later with a ClassFormatError when we call the loadCLass method from the ClassLoader class.

#3 Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from New to Resolved

Added the RuntimeException catch clause in the compiletoByteCode of the CompilerService class.

#4 Updated by O'Neil Delpratt almost 5 years ago

Committed to subversion on the SAxon 9.6 branch.

#5 Updated by O'Neil Delpratt almost 5 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.6.0.2

Bug fix applied to the maintenance release Saxon 9.6.0.2

#6 Updated by O'Neil Delpratt almost 4 years ago

  • Sprint/Milestone set to 9.6.0.2
  • Applies to branch 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release 9.6.0.2 added

Please register to edit this issue

Also available in: Atom PDF