<< Back to previous view

[MATCH-13] Invalid method Code length when generating red black tree matcher Created: 05/Sep/11  Updated: 28/Jul/13  Resolved: 28/Sep/11

Status: Closed
Project: core.match
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Thomas Greve Kristensen Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None
Environment:

lein --version
Leiningen 1.4.2 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM
The project.clj file is as follows:
(defproject redblack "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[org.clojure/core.match "0.2.0-SNAPSHOT"]]
:dev-dependencies [[swank-clojure "1.3.0-SNAPSHOT"]])
core.match is compiled and installed using the above environment by issuing mvn install



 Description   

The issue is the same as stated on
https://github.com/swannodette/match/issues/54
but moved here as a part of moving match to Clojure contrib.

Here is a copy of the text from the issue above:

After having forked the latest version on branch and compiling I attempted to execute the infamous red-black tree rebalancing code.

(let [node nil]
(match/match
[node]
[([:black [:red [:red a x b] y c] z d] |
[:black [:red a x [:red b y c]] z d] |
[:black a x [:red [:red b y c] z d]] |
[:black a x [:red b y [:red c z d]]])]
[:red [:black a x b] y [:black c z d]]))
The good news is that issue issue 47 is indeed resolved. The bad news is that a new issue has cropped up, namely that the ClassFormatError with the message

error: java.lang.ClassFormatError: Invalid method Code length 78596 in class file redblack/core$eval3306 (core.clj:10)
is raised.



 Comments   
Comment by David Nolen [ 05/Sep/11 3:43 PM ]

Do you encounter this error at the REPL?

Comment by Thomas Greve Kristensen [ 05/Sep/11 11:26 PM ]

Sort of - it is encountered when connecting to the REPL using swank form emacs.

Comment by David Nolen [ 05/Sep/11 11:43 PM ]

Can you elaborate the exact steps? What OS?

I'm interested in knowing the details since I haven't run into it myself - solving http://dev.clojure.org/jira/browse/MATCH-1 should address this problem.

Comment by Thomas Greve Kristensen [ 06/Sep/11 2:21 AM ]

I have executed all my tests on a mac os x lion 10.7.1. I've just added my (failing) code to github, it can be found here:
https://github.com/tgk/RedBlackTreesUsingMatch

The steps are as follows:
lein deps
lein swank
From aquaemacs, connect to swank using slime-connect
Open the file src/redblack/core.clj
Execute the entire file (C-c C-k if memory serves)

Sorry for the very brief description, but I'm at work...

Comment by Thomas Greve Kristensen [ 06/Sep/11 12:33 PM ]

Here's a bit longer description:

First, I cloned clojure.core.match.core and installed it using
mvn install

I have added a :main description to the project above. To make it fail I can simply use
lein run

Comment by Thomas Greve Kristensen [ 07/Sep/11 1:23 PM ]

I have also tried using 1.3.0-master-SNAPSHOT of clojure but with no luck. Which version of java are you using?

Comment by Thomas Greve Kristensen [ 07/Sep/11 1:23 PM ]

I have also tried using 1.3.0-master-SNAPSHOT of clojure but with no luck. Which version of java are you using?

Comment by David Nolen [ 07/Sep/11 1:52 PM ]

Sorry been a bit swamped so I haven't had a chance to go through your exact steps (I'm sure I'll get the same error). Again I'm pretty confident I know why the red black tree pattern generates so much code. Adding backtracking will be a significant code size optimization.

Comment by David Nolen [ 26/Sep/11 6:59 AM ]

See MATCH-1

Comment by David Nolen [ 28/Sep/11 10:47 PM ]

Fixed now in master.

Generated at Sat Dec 20 04:29:21 CST 2014 using JIRA 4.4#649-r158309.