Closed
Bug 697745
Opened 14 years ago
Closed 14 years ago
ArrayObject: denseStart needs to be zeroed when denseArray emptied.
Categories
(Tamarin Graveyard :: Library, defect)
Tamarin Graveyard
Library
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: pnkfelix, Assigned: pnkfelix)
Details
Attachments
(2 files)
|
2.70 KB,
patch
|
lhansen
:
review+
|
Details | Diff | Splinter Review |
|
174 bytes,
text/plain
|
Details |
Code:
var a = new Array();
a[1] = 2;
print(a);
a.splice(1,1);
print(a);
If you turn on the current internal Array checking code via this define in ArrayObject.h:
#define DEBUG_ARRAY_VERIFY
then you get this in debug build of the shell:
,2
Assertion failed: "((m_denseStart == 0))" ("../core/ArrayObject.cpp":189)
Trace/BPT trap
At first I thought this meant that we had gotten our reasoning wrong in Bug 692534, but that's not the real issue.
The real issue is that the internal verify check is asserting that if we have an empty m_denseArray, then m_denseStart must be 0. That means that at each point in the code where m_denseArray can become empty (e.g. splice), we must check for that and set m_denseStart accordingly. Well, that, or loosen up the verify check, assuming we double-check that the code is not relying on that strong an invariant. Both options involve some amont of effort; the first is probably easier to get right.
| Assignee | ||
Updated•14 years ago
|
Summary: Either ArrayObject internal verify is a bit too strict or denseStart needs more massaging → ArrayObject: denseStart needs to be zeroed when denseArray emptied.
| Assignee | ||
Comment 1•14 years ago
|
||
(Its a tiny patch, but I know you (Lars) are swamped. feel free to suggest reassignment.)
| Assignee | ||
Comment 2•14 years ago
|
||
This code illustrates the two corner cases patch A is fixing.
(They both independently assert fail without the two respective fixes in patch A, assuming one has turned on the internal debug checks as described in comment 0.)
Comment 3•14 years ago
|
||
Comment on attachment 570025 [details] [diff] [review]
patch A v1: fix
OK. I looked for other cases where this was missing but found that they correctly set denseStart to zero, so my gut feeling is that you've fixed a few stragglers, not an endemic problem.
Attachment #570025 -
Flags: review?(lhansen) → review+
| Assignee | ||
Comment 4•14 years ago
|
||
changeset: 6689:db5b02e60575
user: Felix S Klock II <fklockii@adobe.com>
date: Mon Oct 31 12:19:20 2011 +0100
summary: Bug 697745: zero denseStart when denseArray emptied (r=lhansen).
http://hg.mozilla.org/tamarin-redux/rev/db5b02e60575
| Assignee | ||
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•