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.

I'm planning to try a few things:

- Use a newer version of Rhino (trunk from Mozilla).
- Try the change recommended by the Fantom team.
- Look for a JSR 223-compatible replacement for the Rhino impl-
specific Context usage.

I'll post the results shortly.




On Jul 22, 2:58 am, Sean Corfield <seancorfi...@gmail.com> wrote:
> And then you can't run the resulting JS on node - anything I can try
> to get you guys more info?
>
> sean@sean-netbook:~/node$ node nodehello.js
>
> /home/sean/node/nodehello.js:1
> (defn test-stuff
>       ^^^^
>
> node.js:134
>         throw e; // process.nextTick error, or 'error' event on first tick
>         ^
> SyntaxError: Unexpected identifier
>     at Module._compile (module.js:397:25)
>     at Object..js (module.js:408:10)
>     at Module.load (module.js:334:31)
>     at Function._load (module.js:293:12)
>     at Array.<anonymous> (module.js:421:10)
>     at EventEmitter._tickCallback (node.js:126:26)
>
>
>
>
>
>
>
> On Thu, Jul 21, 2011 at 11:44 PM, Sean Corfield <seancorfi...@gmail.com> 
> wrote:
> > FWIW, I get this same error trying to compile the basic examples for
> > Node.js as well:
>
> > cljsc nodehello.cljs {:optimizations :advanced :target :nodejs} > 
> > nodehello.js
>
> > sun.org.mozilla.javascript.EvaluatorException: Encountered code
> > generation error while compiling function "test_stuff": generated
> > bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)
> >        at 
> > sun.org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
> >        at 
> > sun.org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
> >        at 
> > sun.org.mozilla.javascript.optimizer.Codegen.reportClassFileFormatException(Codegen.java:196)
> >        at 
> > sun.org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:329)
> >        at 
> > sun.org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:182)
> >        at 
> > sun.org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:91)
> >        at sun.org.mozilla.javascript.Context.compileImpl(Context.java:2391)
> >        at 
> > sun.org.mozilla.javascript.Context.compileString(Context.java:1359)
> >        at 
> > sun.org.mozilla.javascript.Context.compileString(Context.java:1348)
> >        at 
> > sun.org.mozilla.javascript.Context.evaluateString(Context.java:1101)
> >        at cljs.compiler$eval1.invoke(compiler.clj:921)
> >        at cljs.compiler$load_stream.invoke(compiler.clj:944)
> >        at cljs.compiler$load_file.invoke(compiler.clj:954)
> >        at cljs.closure$compile_form_seq.invoke(closure.clj:206)
> >        at cljs.closure$compile_file.invoke(closure.clj:228)
> >        at cljs.closure$eval1120$fn__1121.invoke(closure.clj:266)
> >        at 
> > cljs.closure$eval1056$fn__1057$G__1047__1064.invoke(closure.clj:187)
> >        at cljs.closure$eval1107$fn__1108.invoke(closure.clj:280)
> >        at 
> > cljs.closure$eval1056$fn__1057$G__1047__1064.invoke(closure.clj:187)
> >        at cljs.closure$build.invoke(closure.clj:695)
> >        at user$eval1246.invoke(cljsc.clj:21)
> >        at clojure.lang.Compiler.eval(Compiler.java:6406)
> >        at clojure.lang.Compiler.load(Compiler.java:6843)
> >        at clojure.lang.Compiler.loadFile(Compiler.java:6804)
> >        at clojure.main$load_script.invoke(main.clj:282)
> >        at clojure.main$script_opt.invoke(main.clj:342)
> >        at clojure.main$main.doInvoke(main.clj:426)
> >        at clojure.lang.RestFn.invoke(RestFn.java:512)
> >        at clojure.lang.Var.invoke(Var.java:421)
> >        at clojure.lang.AFn.applyToHelper(AFn.java:185)
> >        at clojure.lang.Var.applyTo(Var.java:518)
> >        at clojure.main.main(main.java:37)
>
> > On Thu, Jul 21, 2011 at 11:15 PM, Sean Corfield <seancorfi...@gmail.com> 
> > wrote:
> >> I made these changes but still got exceptions trying to start the cljs
> >> repl (although code seemed to work just fine in the repl after this
> >> exception). I'm about to move onto node.js installation on ubuntu 11
> >> at this point...
>
> >> sun.org.mozilla.javascript.EvaluatorException: Encountered code
> >> generation error while compiling function "test_stuff": generated
> >> bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)
> >>        at 
> >> sun.org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
> >>        at 
> >> sun.org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
> >>        at 
> >> sun.org.mozilla.javascript.optimizer.Codegen.reportClassFileFormatException(Codegen.java:196)
> >>        at 
> >> sun.org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:329)
> >>        at 
> >> sun.org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:182)
> >>        at 
> >> sun.org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:91)
> >>        at sun.org.mozilla.javascript.Context.compileImpl(Context.java:2391)
> >>        at 
> >> sun.org.mozilla.javascript.Context.compileString(Context.java:1359)
> >>        at 
> >> sun.org.mozilla.javascript.Context.compileString(Context.java:1348)
> >>        at 
> >> sun.org.mozilla.javascript.Context.evaluateString(Context.java:1101)
> >>        at cljs.compiler$eval1.invoke(compiler.clj:921)
> >>        at cljs.compiler$load_stream.invoke(compiler.clj:944)
> >>        at cljs.compiler$goog_require$fn__804.invoke(compiler.clj:966)
> >>        at cljs.compiler$goog_require.invoke(compiler.clj:965)
> >>        at clojure.lang.Var.invoke(Var.java:405)
> >>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>        at 
> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>        at 
> >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>        at java.lang.reflect.Method.invoke(Method.java:616)
> >>        at sun.org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
> >>        at 
> >> sun.org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
> >>        at 
> >> sun.org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
> >>        at sun.org.mozilla.javascript.gen.c7._c1(goog/base.js:11)
> >>        at sun.org.mozilla.javascript.gen.c7.call(goog/base.js)
> >>        at 
> >> sun.org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
> >>        at sun.org.mozilla.javascript.gen.c1710._c0(cljs/core.cljs:1003)
> >>        at sun.org.mozilla.javascript.gen.c1710.call(cljs/core.cljs)
> >>        at 
> >> sun.org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
> >>        at 
> >> sun.org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
> >>        at sun.org.mozilla.javascript.gen.c1710.call(cljs/core.cljs)
> >>        at sun.org.mozilla.javascript.gen.c1710.exec(cljs/core.cljs)
> >>        at 
> >> sun.org.mozilla.javascript.Context.evaluateString(Context.java:1104)
> >>        at cljs.compiler$eval1.invoke(compiler.clj:921)
> >>        at cljs.compiler$repl.doInvoke(compiler.clj:1001)
> >>        at clojure.lang.RestFn.invoke(RestFn.java:410)
> >>        at user$eval842.invoke(NO_SOURCE_FILE:10)
> >>        at clojure.lang.Compiler.eval(Compiler.java:6406)
> >>        at clojure.lang.Compiler.eval(Compiler.java:6372)
> >>        at clojure.core$eval.invoke(core.clj:2745)
> >>        at clojure.main$repl$read_eval_print__6016.invoke(main.clj:244)
> >>        at clojure.main$repl$fn__6021.invoke(main.clj:265)
> >>        at clojure.main$repl.doInvoke(main.clj:265)
> >>        at clojure.lang.RestFn.invoke(RestFn.java:421)
> >>        at clojure.main$repl_opt.invoke(main.clj:331)
> >>        at clojure.main$main.doInvoke(main.clj:427)
> >>        at clojure.lang.RestFn.invoke(RestFn.java:397)
> >>        at clojure.lang.Var.invoke(Var.java:397)
> >>        at clojure.lang.AFn.applyToHelper(AFn.java:159)
> >>        at clojure.lang.Var.applyTo(Var.java:518)
> >>        at clojure.main.main(main.java:37)
>
> >> On Wed, Jul 20, 2011 at 7:45 PM, db <donald.bl...@gmail.com> wrote:
> >>> I had the same problem with open jdk on ubuntu.  It looks like open
> >>> jdk has the class, but drops the 'internal' from the package name.
> >>> You can remove the 'internal' in two places in compiler.clj and it
> >>> seems to work.  Longer term, the implementation-specific internal
> >>> package should be removed or some checks for different implementations
> >>> added.
>
> >>> diff --git a/src/clj/cljs/compiler.clj b/src/clj/cljs/compiler.clj
> >>> index b1f2213..2f1a7ab 100644
> >>> --- a/src/clj/cljs/compiler.clj
> >>> +++ b/src/clj/cljs/compiler.clj
> >>> @@ -916,11 +916,11 @@ goog.require = function(rule)
> >>> {Packages.clojure.lang.RT[\"v
> >>>             (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
> >>>             (.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 rel
> >>>           ;;TODO - file bug with google, this is bs error
>
> >>> On Jul 20, 10:08 pm, David Soria <experimentalwo...@googlemail.com>
> >>> wrote:
> >>>> Okay, it's a GNU classpath problem, as they don't include sun.*
> >>>> namespaces. Sadly javax.script.ScriptEngineManager is available and
> >>>> returns an impl of javax.script.Scriptable, which refers to some rhino
> >>>> engine that is in the classpath, but the concrete needed
> >>>> sun.org.mozilla.internals.Context is not in GNU classpath.
>
> >>>> Switching fromOpenJDKto Oracle JDK solved the problem
>
> >>>> On Jul 21, 2:37 am, David Soria <experimentalwo...@googlemail.com>
> >>>> wrote:
>
> >>>> > Hi, I try to run ClojureScript rev
> >>>> > e4ad8ed60ca05645e0ac96362d4c6ef1e1a2bd6f
>
> >>>> > my environment is:
> >>>> > Fedora Linux 15
> >>>> > java version
>
> ...
>
> read more »

-- 
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