Closed Bug 561514 Opened 14 years ago Closed 14 years ago

Codegen uses wrong invoke opcode in generateFunctionConstructor

Categories

(Rhino Graveyard :: Compiler, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: shu, Unassigned)

Details

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.
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
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)
***
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.