Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Envjs html parser silently fails to load without -opt -1

134 views
Skip to first unread message

Thatcher

unread,
Feb 6, 2010, 11:17:52 AM2/6/10
to
We had this problem before but because the entire project was nearly
63KB in a single closure I felt like it was related to the 64KB limit
for single functions. We recently did a big refactor so the dom,
events, html, parser, timer, xhr, and window are each seperated and
have clearer dependencies on each other. Unfortunately, loading the
parser at any point (which is about 32KB) still causes a silent
failure that goes away with -opt -1.

I realize I can set the optimization level internally to hide this
requirement from the end user but I'm still a little perplexed why it
wont compile... The parser is an html 5 from the nu.parser project
that is generated, mininfied javascript.

Any ideas?

Here is the general project link:
http://github.com/thatcher/env-js/

Here is the parser (actual )
http://github.com/thatcher/env-js/raw/master/dist/parser.js

And here is the first test file that will fail without -opt -1
http://github.com/thatcher/env-js/raw/master/test/specs/parser/spec.js

Is there some additional information I can provide to help you
understand to issue in general?

Thanks,
Thatcher

Thatcher

unread,
Feb 15, 2010, 9:27:33 AM2/15/10
to
On Feb 6, 11:17 am, Thatcher <thatcher.christop...@gmail.com> wrote:
> We had this problem before but because the entire project was nearly
> 63KB in a single closure I felt like it was related to the 64KB limit
> for single functions.  We recently did a big refactor so the dom,
> events, html, parser, timer, xhr, and window are each seperated and
> have clearer dependencies on each other.  Unfortunately, loading the
> parser at any point (which is about 32KB) still causes a silent
> failure that goes away with -opt -1.
>
> I realize I can set the optimization level internally to hide this
> requirement from the end user but I'm still a little perplexed why it
> wont compile...  The parser is an html 5 from the nu.parser project
> that is generated, mininfied javascript.
>
> Any ideas?
>
> Here is the general project link:http://github.com/thatcher/env-js/
>
> Here is the parser (actual )http://github.com/thatcher/env-js/raw/master/dist/parser.js
>
> And here is the first test file that will fail without -opt -1http://github.com/thatcher/env-js/raw/master/test/specs/parser/spec.js

>
> Is there some additional information I can provide to help you
> understand to issue in general?
>
> Thanks,
> Thatcher

I haven't heard anything back on this. I was wondering if I could
clarify or could get pointed in a direction for tracking down the
issue myself. The file is about 23KB in a single closure and fails
silently without -opt -1 but loads and runs fine with -opt -1.

What could be causing the silent failure that is otherwise avoided by
disabling optimization? I've searched but haven't found much other
than posts related to the 64KB known limit for a single function. eg
http://ajax.sys-con.com/node/676073 But we are now way under that
limit and still experiencing issues running in an optimized mode.

Thanks for any clues.
Thatcher

Thatcher

unread,
Feb 15, 2010, 9:59:09 AM2/15/10
to
> than posts related to the 64KB known limit for a single function.  eghttp://ajax.sys-con.com/node/676073But we are now way under that

> limit and still experiencing issues running in an optimized mode.
>
> Thanks for any clues.
> Thatcher

This may help, if I try to compile the parser.js I get:

christopher-thatchers-macbook-air:env-js thatcher$ java -cp rhino/
js.jar org.mozilla.javascript.tools.jsc.Main -d dist dist/parser.js
Exception in thread "main" org.mozilla.javascript.EvaluatorException:
Encountered code generation error while compiling function "null":
generated bytecode for method exceeds 64K limit. (dist/parser.js#45)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:
950)
at
org.mozilla.javascript.optimizer.Codegen.reportClassFileFormatException(Codegen.java:
209)
at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:
342)
at
org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:
195)
at
org.mozilla.javascript.optimizer.ClassCompiler.compileToClassFiles(ClassCompiler.java:
187)
at org.mozilla.javascript.tools.jsc.Main.processSource(Main.java:276)
at org.mozilla.javascript.tools.jsc.Main.main(Main.java:73)

but looking at the file:

christopher-thatchers-macbook-air:env-js thatcher$ ls -lsa dist/
parser.js
592 -rw-r--r-- 1 thatcher admin 302530 Feb 14 17:38 dist/parser.js
christopher-thatchers-macbook-air:env-js thatcher$

So how can it be possible that a 31KB file exceeds a 64KB function
limit? Am I missing something here?

Thanks for any insight.
Thatcher

Thatcher

unread,
Feb 15, 2010, 10:05:12 AM2/15/10
to
> > than posts related to the 64KB known limit for a single function.  eghttp://ajax.sys-con.com/node/676073Butwe are now way under that

Oh @#! I finally get it... It's the size of the GENERATED bytecode
that is the issue. So i guess I'm stuck with -opt -1 until sun
decides to up the non-native bytecode limit... ouch.

So can anyone point to an actual performance comparision between
optimized and non-optimized modes... I've been search but can't find
an actual comparision to understand the hit I'm taking.

Thatcher

Thatcher

unread,
Feb 15, 2010, 2:54:07 PM2/15/10
to
> > > than posts related to the 64KB known limit for a single function.  eghttp://ajax.sys-con.com/node/676073Butweare now way under that

I'm going to embarassingly admit this issue was way more my fault than
anything else. The file Im looking at is 320KB not 32 KB. oops sorry
rhino list :(
On the bright side I think I'm going to be able to break this up with
a perl script and some elbow grease.

0 new messages