The hello example runs after adding a call to setOptimizationLevel -1.

--- a/src/clj/cljs/compiler.clj
+++ b/src/clj/cljs/compiler.clj
@@ -916,11 +916,12 @@ goog.require = function(rule)
{Packages.clojure.lang.RT[\"var\"](\"cljs.compiler\
             (print js))
         (let [filename (.get jse javax.script.ScriptEngine/FILENAME)
               linenum (or (:line (meta form)) Integer/MIN_VALUE)
-              ctx (sun.org.mozilla.javascript.internal.Context/
enter)]
+              ctx (sun.org.mozilla.javascript.Context/enter)]
           (try
+            (.setOptimizationLevel ctx -1)
             (.evaluateString ctx (:global repl-env) js filename
linenum nil)
           (finally
-            (sun.org.mozilla.javascript.internal.Context/exit))))
+            (sun.org.mozilla.javascript.Context/exit))))
         (catch Throwable ex
           ;;we eat ns errors because we know goog.provide() will
throw when reloaded
           ;;TODO - file bug with google, this is bs error

This is a fairly simple workaround for OpenJDK 6/ ubuntu.

I haven't looked at what it would take to replace the rhino-specific
code with the javax.script API equivalent, but I did look into
upgrading rhino or adding rhino to a jvm version that doesn't ship
with a js implementation (such as openjdk 7 built from source).  So
far, this appears to be non-trivial, because rhino doesn't have its
own jsr 223 implementation.  The two approaches to address this seem
to be to implement the jsr 223 classes for rhino, or use an existing
rhino 223 impl, as described here:

https://bugzilla.mozilla.org/show_bug.cgi?id=379385

I also haven't looked at what other jvms folks are using these days,
and whether they ship with a js implementation.  One option would be
to go the other way, and replace the javax.script code with rhino, and
treat rhino as an explicit dependency.  This could be the most
flexible and consistent approach across jvms.

On Jul 22, 10:34 pm, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Fri, Jul 22, 2011 at 7:08 PM, db <donald.bl...@gmail.com> wrote:
> > I believe that the issue can be avoided with OpenJDK by disabling
> > Rhino optimization.
>
> >>>    generated bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)
>
> > This appears to be identical to what the fantom guys have encountered:
>
> >http://fantom.org/sidewalk/topic/1181
>
> > Although instead of switching jvms, I'm going to try to make it work
> > with OpenJDK.
>
> Thanx Donald!
>
> I may just switch to the Sun, er, Oracle JVM since I've a feeling one
> of my other projects (not yet migrated to my netbook) will require
> that JVM anyway...
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View --http://corfield.org/
> World Singles, LLC. --http://worldsingles.com/
> Railo Technologies, Inc. --http://www.getrailo.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to