You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Michal Makarewicz <mi...@gmail.com> on 2019/01/29 23:32:44 UTC

Exception encountered when using expressions module with very large expressions.

Hi,

We have a scenario where we use Javascript expression compiler to
dynamically load ranking model passed as query parameter. This approach
works well enough for small models, but when we tried loading large models
using expressions module we hit JVM limit on maximum method size (64kb) and
failed with exception as follows:



hit exception: java.lang.RuntimeException: Method code too large!

at org.objectweb.asm.MethodWriter.a(Unknown Source)

at org.objectweb.asm.ClassWriter.toByteArray(Unknown Source)

at
org.apache.lucene.expressions.js.JavascriptCompiler.compileExpression(JavascriptCompiler.java:196)

at
org.apache.lucene.expressions.js.JavascriptCompiler.compile(JavascriptCompiler.java:148)



I was wondering if anyone encountered this limitation and how to work
around it. Currently my best guess would be to either split the expression
into multiple compilation unit, or create less performant version of
expression compiler that would build an AST to be executed later, instead
of directly creating JVM bytecode.

Any input on how to go about doing it would be highly appreciated.



Thank you,

Michal Makarewicz