mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 02:57:38 +00:00
e5473d8fda
Re: [Rhino in Java] compiling .js to class file gives "bad local" error Date: Wed, 31 Jan 2001 09:41:45 +0100 From: "Sylvia E. Schleutermann" <ses@h-m-s.com> Organization: .hms Health Management Systems Newsgroups: netscape.public.mozilla.jseng References: 1 , 2 I have found out some more. Looking really quickly over the JVM specs, I found that indeed the astore-command requires that the variables index be below 128. However, the book also said that if more index space is needed, a "wide" command can be used to be able to address up to 65xxx variables. Question: is there a possibility to integrate this "wide"-command into the class compiler? Some option, that can be set? Or am I on the wrong tracks? Please help, since I want to avoid spreading the script over many classes to avoid the size limitation. Cheers, Sylvia Sylvia E. Schleutermann <ses@h-m-s.com> wrote in message news:956sv9$9g53@secnews.netscape.com... > I have found out that it is definitely the number of variables. > I removed all variables and then the script compiled into class files > with one base class and inner classes for each function in the script. > > What is the limitation exactly, i.e. does anyone know how many (global) > variables > I can use? Or is there some other kind of work around? > > Cheers, Sylvia > > > Sylvia E. Schleutermann <ses@h-m-s.com> wrote in message > news:956qtv$6kh3@secnews.netscape.com... > > Hello, > > when compiling a *.js file to class file, I get a "bad local" runtime > > exception. > > Stepping through the source, the following happens in reverse order: > > > > Codegen.xstore (75, 58, 209) > > -> in the switch - default case, there is a comparison > > for local (=209), which is compared to Byte.MAX_VALUE (=127). > > When greater, the above exception is thrown. > > > > Codegen.astore (209) > > -> calls Codegen.xstore (ByteCode.ASTORE_0, ByteCode.ASTORE, 209) > > > > Codegen.generatePrologue (<context>, <tree>, true, -1) // -1 is > > directParameterCount > > -> sets itsZeroArgArray = getNewWordLocal(); // here, the 209 is > > produced > > -> calls astore (itsZeroArgArray) > > > > From what I can read from the source code, the 209 seems to be a counter > for > > "locals", perhaps > > local variables?? The function that is being compiled does initialize many > > variables - would it help > > to move the initialize code out of the function into separate code blocks? > > > > The function looks like this > > > > function rule_Disclaimer() > > { > > try { VAR1 = <init code 1>;} catch (exception) { VAR1 = <default init > > code 1>; } > > try { VAR2 = <init code 2>;} catch (exception) { VAR2 = <default init > > code 2>;} > > ... (about 58 such variables) > > > > var cond = true; > > > > < rest of code> > > } > > > > When I compile the script for interpreted mode, all works well. The > > variables VAR1 to VAR58 are to be global > > variables (global to the whole script). > > > > I appreciate any help! Thanks, Sylvia > > > > > > |
||
---|---|---|
.. | ||
benchmarks | ||
js2 | ||
jsd | ||
jsdj | ||
jsj | ||
macbuild | ||
ref | ||
rhino | ||
semantics | ||
src | ||
tests | ||
.cvsignore | ||
landbranch.pl | ||
Makefile.in | ||
makefile.win |