Codegen uses wrong invoke opcode in generateFunctionConstructor

RESOLVED FIXED

Status

Rhino
Compiler
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: shu, Unassigned)

Tracking

Details

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Build Identifier: 1_7R2

In Codegen.generateFunctionConstructor, the function init method is invoked using INVOKEVIRTUAL, but I think should be invoked using INVOKESPECIAL. i.e. the following:

            cfw.addInvoke(ByteCode.INVOKESPECIAL,
                          mainClassName,
                          getFunctionInitMethodName(ofn),
                          FUNCTION_INIT_SIGNATURE);

INVOKEVIRTUAL runs fine on JVM but when converted to Dalvik for running on the Android platform, crashes.

Reproducible: Always

Steps to Reproduce:
Compile a JavaScript function a Java classfile.

Comment 1

8 years ago
Yup, that looks valid to me. The function is generated as private; private functions should be invoked with invokespecial.
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 2

8 years ago
cvs ci -m "Fix for Bug 561514 - Codegen uses wrong invoke opcode in generateFunctionConstructor" -l "/Rhino/src/org/mozilla/javascript/optimizer/Codegen.java"
    Checking in src/org/mozilla/javascript/optimizer/Codegen.java;
    /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java,v  <--  Codegen.java
    new revision: 1.273; previous revision: 1.272
    done
ok (took 0:05.022)
***

Updated

8 years ago
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.