mikera / clisk

The Clojure Image Synthesis Kit
281 stars 13 forks source link

Method code too large ! #17

Open CharlesHD opened 7 years ago

CharlesHD commented 7 years ago

Hi, I was trying to generate some random images using CLISK. I think it's really cool it's entirely composable. Here is my method : I generate a tree structure where nodes are labelled according to the fact they are 2-arity, 1-arity or 0-arity functions or constants. Then I interpret that tree using some of functions defined in the library. When the tree start to be a little large, the following error rises during interpretation :

clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Method code too large!, compiling:(*cider-repl imagen*:280:13)
             java.lang.RuntimeException: Method code too large!

I guess the function resulting from interpretation rises this during its compilation. That means its code size grows way too fast compared to the tree size. Here is a gist of the code I use, maybe I mess somewhere.

mikera commented 7 years ago

Hmmmm this is a problem with the Clojure compiler.... when functions get too large this is going to happen.

It is possible we could update the code generation in clisk to reduce the function size, have some ideas about this but it is quite a bit of work so probably won't be fixed in the near future.

In the meantime you may need to be careful about how large your trees become.