Closed
Bug 298786
Opened 20 years ago
Closed 19 years ago
Infinite loop when compiling with optimization
Categories
(Rhino Graveyard :: Core, defect)
Rhino Graveyard
Core
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mcbp223, Assigned: igor)
Details
Attachments
(1 file)
|
886 bytes,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; YComp 5.0.0.0; .NET CLR 1.1.4322; .NET CLR 2.0.50215)
Build Identifier:
Rhino compiler gets in a infinite loop when
compiled with -opt greather than zero, for this file:
------------------------------------------
// file infloop.js
function infLoop(inStr) {
var i = -1;
while ((i = inStr.indexOf("%")) != -1) {
inStr = inStr.replace("%", "");
}
return inStr;
}
var str = infLoop("abc%def");
------------------------------------------
Reproducible: Always
Steps to Reproduce:
1. save the above code in a file (infloop.js)
2. java -cp js.jar org.mozilla.javascript.tools.jsc.Main -opt 1 infloop.js
Actual Results:
Compiler hangs, with processor at 100%.
If compiled with -opt 0 the compilation succeeds and a class file is generated.
Tested and reproduced with 1_5R5 and 1_6R1.
In 1_5R5 the loop is in the class
org.mozilla.javascript.optimizer.Optimizer
in
private static void
typeFlow(OptFunctionNode fn, Block theBlocks[])
I did not debug with 1_6R1 sources but I assume it is in the same place.| Assignee | ||
Comment 1•20 years ago
|
||
AFAICS this one-line fix is enough to fix the optimizer issue that caused the bug. But since the bug was in Rhino since the first public release and survived all the changes during last 5 years I am very reluctant to commit the fix without really good testing.
| Assignee | ||
Comment 2•19 years ago
|
||
I committed the patch.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
(In reply to comment #2) I still have some infinite loops when I set Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME true and I use the feature, both in the compiler and at runtime. Should this go in a separate bug report?
| Assignee | ||
Comment 4•19 years ago
|
||
(In reply to comment #3) > (In reply to comment #2) > > I still have some infinite loops when I set > Context.FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME true and I use the feature, both > in the compiler and at runtime. Should this go in a separate bug report? Do you see this with latest CVS tip as well? It contains a few fixes in this area. If yes, then file a bug indeed.
You need to log in
before you can comment on or make changes to this bug.
Description
•