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)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: user, Assigned: norrisboyd)

Details

(Whiteboard: [QA note: verify interactively, as in Comment #3])

Attachments

(2 files)

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.
Attached file Test case
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.
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]
I commited the patch
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Verified FIXED. The above testcase now passes in the Rhino shell. I tested optimization levels -1, 0, 1, and 9.
Status: RESOLVED → VERIFIED
Targeting as resolved against 1.5R5
Target Milestone: --- → 1.5R5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: