Closed
Bug 192226
Opened 22 years ago
Closed 22 years ago
Wrong code generation for function calls inside with or catch
Categories
(Rhino Graveyard :: Compiler, defect)
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R5
People
(Reporter: user, Assigned: norrisboyd)
Details
(Whiteboard: [QA note: verify interactively, as in Comment #3])
Attachments
(2 files)
272 bytes,
application/x-javascript
|
Details | |
1.93 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003
Build Identifier: Rhino CVS from 2003-02-07
With optimization set to at least one, optimizer fails when generating code for
a script function containing calls to to other functions inside the with or
catch statement. This bug is present at least since Rhino 1.5R3.
Reproducible: Always
Steps to Reproduce:
To test, run the following attached script with optimization set to 1.
Actual Results:
Test fails with NullPointerException in omj.optimizer.Codegen. If calls to
test0() in the test script are commented out, then it would fail with
java.lang.VerifierError when loading the script.
Expected Results:
Should print OK.
Reporter | ||
Comment 1•22 years ago
|
||
Reporter | ||
Comment 2•22 years ago
|
||
Codegen.visitRegularCall should not try to apply the simple call optimization
when firstArgDone is true indicating directly called function. The patch also
replaces generation of code to call new Object[0] by loading the
ScripRuntime.emptyArgs field.
To be applied after 1.5R4.
Comment 3•22 years ago
|
||
Testcase added to JS testsuite:
mozilla/js/tests/js1_5/Scope/regress-192226.js
This passes in SpiderMonkey and in Rhino when optimization < 1.
But, as Igor reported, it fails if Rhino optimization is set >=1:
java org.mozilla.javascript.tools.shell.Main -opt 1
-f js1_5/shell.js
-f js1_5/Scope/regress-192226.js
Exception in thread "main" java.lang.NullPointerException
at org.mozilla.javascript.optimizer.Codegen.visitRegularCall(Codegen.java:1927)
at org.mozilla.javascript.optimizer.Codegen.visitCall(Codegen.java:1794)
etc.
etc.
Whiteboard: [QA note: verify interactively, as in Comment #3]
Reporter | ||
Comment 4•22 years ago
|
||
I commited the patch
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Comment 5•22 years ago
|
||
Verified FIXED.
The above testcase now passes in the Rhino shell. I tested
optimization levels -1, 0, 1, and 9.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•