i-- returns void when OptimizationLevel=1

RESOLVED FIXED in 1.6R6

Status

RESOLVED FIXED
12 years ago
11 years ago

People

(Reporter: christophe.marton, Assigned: norrisboyd)

Tracking

other
1.6R6
x86
Windows XP

Details

Attachments

(2 attachments)

(Reporter)

Description

12 years ago
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

Comment 1

12 years ago
Created attachment 248902 [details]
Testcase for reproducing the problem

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.
(Assignee)

Updated

12 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 2

12 years ago
Created attachment 259425 [details] [diff] [review]
Proposed patch

Proposed patch for this bug and bug 359358.
(Assignee)

Updated

12 years ago
Assignee: nobody → norrisboyd
Status: ASSIGNED → NEW
(Assignee)

Comment 3

12 years ago
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
Last Resolved: 12 years ago
Resolution: --- → FIXED
(Assignee)

Comment 4

11 years ago
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.