Rhino: Problem in NativeJavaMethod
Date:
Tue, 14 Aug 2001 10:23:35 +0200
From:
felix.meschberger@day.com
To:
Norris Boyd <nboyd@atg.com>
Hi Norris,
While working with wrapped Java classes we discovered a problem in
NativeJavaMethod : If the public method to be called is part of a
non-public class, the Sun Java VM throws an IllegalAccessException. This
bug in the Sun VM has been reported as Bug 4071593 to Sun, but has not been
resolved since....
I implemented a circumvention, for which I provide you the patch. I quickly
tested it, and it seems to work.
Regards
Felix
[Fwd: Rhino 1.5.2 bug in debug support?]
Date:
Sun, 12 Aug 2001 14:13:26 -0700
From:
Christopher Oliver <coliver@mminternet.com>
Organization:
Primary Interface LLC
To:
nboyd@atg.com
Hi Norris,
Did you or are you fixing this problem? It seems to be simply a matter
of filtering out -1 before inserting line numbers into the
lineNumberTable. In this particular case the Parser generates -1 as a
line number for (? : ) in IRFactory.createTernary(). However the recent
changes to InterpreterData to use UintMap instead of Hashtable will not
tolerate negative numbers. Changing Interpreter.updateLineNumber() and
InterpreterData.getOffset() to check for negative line numbers (and
avoid generating line number code or accessing the lineNumberTable in
that case) will correct the problem.
Chris
Subject:
Rhino 1.5.2 bug in debug support?
Date:
8 Aug 2001 12:47:28 -0700
From:
d-russo@ti.com (dave russo)
Organization:
http://groups.google.com/
Newsgroups:
netscape.public.mozilla.jseng
I'm getting the following exception when running the Rhino debugger.
java.lang.RuntimeException
at org.mozilla.javascript.UintMap.check(UintMap.java:349)
at org.mozilla.javascript.UintMap.put(UintMap.java:158)
at
org.mozilla.javascript.Interpreter.updateLineNumber(Interpreter.java:234)
at
org.mozilla.javascript.Interpreter.generateICode(Interpreter.java:300)
at
org.mozilla.javascript.Interpreter.generateICode(Interpreter.java:926)
at
org.mozilla.javascript.Interpreter.generateICode(Interpreter.java:302)
at
org.mozilla.javascript.Interpreter.generateICode(Interpreter.java:302)
at
org.mozilla.javascript.Interpreter.generateICode(Interpreter.java:302)
at
org.mozilla.javascript.Interpreter.generateICodeFromTree(Interpreter.java:89)
at
org.mozilla.javascript.Interpreter.generateFunctionICode(Interpreter.java:186)
at
org.mozilla.javascript.Interpreter.generateNestedFunctions(Interpreter.java:164)
at
org.mozilla.javascript.Interpreter.generateScriptICode(Interpreter.java:124)
at org.mozilla.javascript.Interpreter.compile(Interpreter.java:78)
at org.mozilla.javascript.Context.compile(Context.java:1810)
at org.mozilla.javascript.Context.compile(Context.java:1735)
at org.mozilla.javascript.Context.compileReader(Context.java:852)
at org.mozilla.javascript.Context.evaluateReader(Context.java:770)
at org.mozilla.javascript.tools.shell.Main.evaluateReader(Main.java:300)
at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:290)
at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:244)
at org.mozilla.javascript.tools.shell.Main.exec(Main.java:104)
at org.mozilla.javascript.tools.debugger.Main.main(Main.java:3156)
I'm using Rhino 1.5.2 prerelease
(ftp://ftp.mozilla.org/pub/js/rhino15R2pre.zip) and SUN's JDK 1.3.1
runtime for Windows.
I'm running the debugger as follows:
java -cp js.jar org.mozilla.javascript.tools.debugger.Main -f tconfini.tcf
Where the file tconfini.tcf is shown below:
function getBoard (defFile) {
if (arguments.length > 0 ) {
return (defFile != null ? defFile[1] : null);
}
return (null);
}
Any help would be appreciated. Thanks!
dave
=================================
Rhino: use of Node.get/putIntProperty to store integer values
The patch replaces usage like
node.putProp(PROPERTY, new Integer(int_value))
((Integer)node.getProp(PROPERTY))
by
node.putIntProp(PROPERTY, int_value)
node.getIntProp(PROPERTY, defaultValue)
node.getExistingIntProp(PROPERTY)
to avoid creation of Integer wrapper objects while storing integer
properties in Nodes.
Patch also ads Node.removeProp to explicitly remove Node properties
=================================
The patch changes the type of the first argument of Interpreter.addByte
from byte to int so there is no need to cast int arguments, adds
addShort(int value, int iCodeTop), getShort(byte[] iCode, int pc) to
pack/unpack short values from pc array, replaces calls to
getString(stringTable, byte[] iCode, int pc) by
stringTable[getShort(iCode, pc)] and similar for getNumber
It makes Interpreter.java easy to follow and slightly shrink its class file.