Closed Bug 375695 Opened 18 years ago Closed 18 years ago

"Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain" with |catch| that binds nothing and has a catchguard

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9alpha5

People

(Reporter: jruderman, Assigned: brendan)

References

Details

(Keywords: crash, testcase)

Attachments

(1 file, 3 obsolete files)

js> try { try { throw 1 } catch([] if false) { } } catch(ex) {} Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain, at jsinterp.c:5837 Seems harmless in opt. Bug 361566 triggers the same assertion, so it's possible that this is a dup of it. Split from bug 351102 per bug 351102 comment 30.
Summary: "Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain" with |try| that binds nothing and guard → "Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain" with |try| that binds nothing and catchguard
Summary: "Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain" with |try| that binds nothing and catchguard → "Assertion failure: !fp->blockChain || OBJ_GET_PARENT(cx, obj) == fp->blockChain" with |catch| that binds nothing and has a catchguard
The catch guard code is not leaving the block (zero-count block, at that) entered for the catch ([] if false) head: js> function f(){try { try { throw 1 } catch([] if false) { } } catch(ex) {}} js> dis(f) main: 00000: try 00001: try 00002: one 00003: throw 00004: goto 31 (27) 00007: setsp 0 00010: enterblock depth 0 {} 00013: exception 00014: dup 00015: dup 00016: pop 00017: pop 00018: false 00019: ifeq 29 (10) 00022: pop 00023: leaveblock 0 00026: goto 31 (5) 00029: throw 00030: nop 00031: goto 51 (20) 00034: setsp 0 00037: enterblock depth 0 {ex: 0} 00040: exception 00041: setlocalpop 0 00044: leaveblock 1 00047: goto 51 (4) 00050: nop 00051: stop Source notes: 0: 4 [ 4] hidden 1: 10 [ 6] catch guard delta 9 3: 15 [ 5] decl offset 2 5: 22 [ 7] hidden 6: 23 [ 1] catch 8: 26 [ 3] hidden 9: 29 [ 3] hidden 10: 30 [ 1] endbrace 11: 31 [ 1] hidden 12: 37 [ 6] catch 14: 44 [ 7] catch stack depth 1 16: 47 [ 3] hidden 17: 50 [ 3] endbrace Exception table: start end catch 2 7 7 1 34 34 js> /be
OS: Mac OS X → All
Hardware: PC → All
Er, no, the setsp 0 at bytecode 34 should pop fp->blockChain. I'll have to debug... /be
Assignee: general → brendan
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → mozilla1.9alpha5
The patch for bug 355832 created this problem; the two bugs do not agree on what JSOP_SETSP should do with a zero-count block on fp->blockChain. /be
"the two bugs"?
This bug and bug 355832. Brendan, see also: bug 361566, comment 1.
I'm going to patch here, so making bug 361566 block this bug doesn't make sense. It came first, and I could dup this bug against it. But I've taken this one, and it doesn't really hurt to block the other way. /be
Blocks: 361566
No longer depends on: 361566
Attached patch proposed fix (obsolete) — Splinter Review
This includes the patch for bug 379483. Let me know if you spot other uses for JSOP_POPN. /be
Attachment #263554 - Flags: review?(igor)
Comment on attachment 263554 [details] [diff] [review] proposed fix >-#define JSXDR_BYTECODE_VERSION (0xb973c0de - 9) >+#define JSXDR_BYTECODE_VERSION (0xb973c0de - 10) Quick nore before doing any review: -10 is already taken on 1.8.1 branch.
Attached patch proposed fix, v2 (obsolete) — Splinter Review
Fixed JSXDR_BYTECODE_VERSION; restore lost SRC_HIDDEN test for JSOP_POPN decomp. /be
Attachment #263554 - Attachment is obsolete: true
Attachment #263563 - Flags: review?(igor)
Attachment #263554 - Flags: review?(igor)
The patch for bug 379483 landed, so this doesn't contain that hunk. /be
Attachment #263563 - Attachment is obsolete: true
Attachment #263564 - Flags: review?(igor)
Attachment #263563 - Flags: review?(igor)
After looking for some time into the patch I still can not get why setsp alone can not be used to unwind the stack and the scope chain. If it can do it for the exception handler, why it can not do it after non-local jump?
(In reply to comment #11) > After looking for some time into the patch I still can not get why setsp alone > can not be used to unwind the stack and the scope chain. If it can do it for > the exception handler, why it can not do it after non-local jump? > To be precise: EmitNonLocalJumpFixup issues missing leavewith, leaveblock, popn etc. to restore the stack and scope chain. But setsp is doing exactly the same job on its own. So the idea is to replace leavewith, leaveblock, popn via single setsp.
This all grew like topsy. We could use JSOP_SETSP, but you point out something I hadn't noticed: JSOP_SETSP does not emulate JSOP_ENDITER at all. This is not quite a bug, since closing generator-iterators eagerly is an optimization. So I would like to ignore the asymmetry. But I would also like to shrink EmitNonLocalJumpFixup and the code it generates in a separate bug. Igor: I'll file that and note it in a FIXME comment, and hit you up for re-review shortly, if the rest of the patch looks ok. /be
Although I need to review what we agreed on for ES4, about automating generator close calls only when the generator-iterator is started by the for-in loop that's exiting. We did agree to automate only that case, but the question is: do we automate all exits from the loop, or only the normal one that runs through the unhidden JSOP_ENDITER. Seems to me we'll want to automate all, so we will still JSOP_SETSP to emulate any hidden JSOP_ENDITERs. Comments? /be
Attachment #263564 - Flags: review?(igor) → review+
Attachment #263564 - Attachment is obsolete: true
Attachment #263979 - Flags: review+
Fixed on trunk: js/src/jsemit.c 3.248 js/src/jsinterp.c 3.346 js/src/jsopcode.c 3.233 js/src/jsopcode.tbl 3.92 js/src/jsxdrapi.h 1.29 /be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Blocks: 373827
Depends on: 379925
/cvsroot/mozilla/js/tests/js1_7/regress/regress-375695.js,v <-- regress-375695.js initial revision: 1.1
Flags: in-testsuite+
verified fixed 1.9.0 linux/mac*/windows.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: