Closed Bug 359359 Opened 18 years ago Closed 17 years ago

i-- returns void when OptimizationLevel=1

Categories

(Rhino Graveyard :: Compiler, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: christophe.marton, Assigned: norrisboyd)

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

when using OptimizationLevel=1, i-- returns void instead of the expected number in the following script:

function zeros(i) {
  var a=[];
  while((i--)>0) {
      a[i]=0; 
  }
  return a;
}

function g() {
	return zeros(10);
}

g();

The error message is:

RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object void of class java.lang.Class where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.


Note:
- calling g() is required to reproduce the problem, calling zeros(10) at top level works well.
- Works well with optimizationLevel=0, returns "0,0,0,0,0,0,0,0,0,0".


Reproducible: Always
I can confirm this is a bug. I've attached a testcase to reproduce the problem. I unfortunately don't know any of the optimizer internals -- I notified Norris Boyd in e-mail; hopefully he'll have time to take a look at it.
Status: NEW → ASSIGNED
Attached patch Proposed patchSplinter Review
Proposed patch for this bug and bug 359358.
Assignee: nobody → norrisboyd
Status: ASSIGNED → NEW
Fixed:

Checking in Codegen.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java,v  <--  Codegen.java
new revision: 1.243; previous revision: 1.242
done
Checking in OptRuntime.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/OptRuntime.java,v  <--  OptRuntime.java
new revision: 1.35; previous revision: 1.34
done
Checking in Optimizer.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/optimizer/Optimizer.java,v  <--  Optimizer.java
new revision: 1.50; previous revision: 1.49
done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Adding target milestone of 1.6R6 based on the date this bug was resolved FIXED.
Target Milestone: --- → 1.6R6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: