Hi Norris,

I encountered the following exception with the below script in compiled
mode with RhinoLatest.zip:

java.lang.NullPointerException
 at
org.mozilla.javascript.optimizer.Codegen.visitCall(Codegen.java:1790)
 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:567)

 at
org.mozilla.javascript.optimizer.Codegen.visitReturn(Codegen.java:2283)
 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:592)

 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:546)

 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:546)

 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:546)

 at
org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:497)
 at
org.mozilla.javascript.optimizer.Codegen.generateFunctionInits(Codegen.java:1292)

 at
org.mozilla.javascript.optimizer.Codegen.generateInit(Codegen.java:1186)

 at
org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:481)
 at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:88)
 at org.mozilla.javascript.Context.compile(Context.java:1965)
 at org.mozilla.javascript.Context.compile(Context.java:1874)
 at org.mozilla.javascript.Context.compileReader(Context.java:895)
 at org.mozilla.javascript.Context.evaluateReader(Context.java:813)
 at
org.mozilla.javascript.tools.shell.Main.evaluateReader(Main.java:318)
 at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:309)
 at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:248)

 at org.mozilla.javascript.tools.shell.Main.exec(Main.java:95)
 at org.mozilla.javascript.tools.shell.Main.main(Main.java:68)
Exception in thread "main"

function tak(x, y, z, k) {
    if (!(y < x)) {
        return k(z);
    } else {
        return tak(x - 1,
                   y,
                   z,
                   function(v1) {
            return tak(y - 1,
                       z,
                       x,
                       function(v2) {
                return tak(z - 1,
                           x,
                           y,
                           function(v3) {
                    return tak(v1, v2, v3, k);
                });
            });
        });
    }
}

function cpstak(x, y, z) {
    return tak(x, y, z, function(a) {return a;});
}

//;;; call: (cpstak 18 12 6)

//(run-benchmark "CPSTAK" (lambda () (cpstak 18 12 6)))

var start = new Date();
var res = cpstak(18, 12, 6);
var end = new Date();
print(res +": elapsed: " + (end - start));
This commit is contained in:
nboyd%atg.com 2002-04-03 01:20:27 +00:00
Родитель a2f9effc6e
Коммит 8fc68d6900
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -1787,7 +1787,7 @@ public class Codegen extends Interpreter {
&& inDirectCallFunction) { && inDirectCallFunction) {
OptLocalVariable lVar OptLocalVariable lVar
= (OptLocalVariable)(child.getProp(Node.VARIABLE_PROP)); = (OptLocalVariable)(child.getProp(Node.VARIABLE_PROP));
if (lVar.isParameter()) { if (lVar != null && lVar.isParameter()) {
handled = true; handled = true;
aload(lVar.getJRegister()); aload(lVar.getJRegister());
dload((short)(lVar.getJRegister() + 1)); dload((short)(lVar.getJRegister() + 1));
@ -1992,7 +1992,7 @@ public class Codegen extends Interpreter {
&& inDirectCallFunction) { && inDirectCallFunction) {
OptLocalVariable lVar OptLocalVariable lVar
= (OptLocalVariable)(child.getProp(Node.VARIABLE_PROP)); = (OptLocalVariable)(child.getProp(Node.VARIABLE_PROP));
if (lVar.isParameter()) { if (lVar != null && lVar.isParameter()) {
child.removeProp(Node.ISNUMBER_PROP); child.removeProp(Node.ISNUMBER_PROP);
generateCodeFromNode(child, node, -1, -1); generateCodeFromNode(child, node, -1, -1);
handled = true; handled = true;