Project

Profile

Help

Bug #2182

closed

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

Added by O'Neil Delpratt about 10 years ago. Updated about 9 years ago.

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

100%

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

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!

Files

xquery-update-30.xquery (1.05 MB) xquery-update-30.xquery O'Neil Delpratt, 2014-10-15 11:43
Actions #2

Updated by O'Neil Delpratt about 10 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.

Actions #3

Updated by O'Neil Delpratt about 10 years ago

  • Status changed from New to Resolved

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

Actions #4

Updated by O'Neil Delpratt about 10 years ago

Committed to subversion on the SAxon 9.6 branch.

Actions #5

Updated by O'Neil Delpratt about 10 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

Actions #6

Updated by O'Neil Delpratt about 9 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