Closed
Bug 523348
Opened 16 years ago
Closed 16 years ago
Vector and Array functions wrongly assume args won't be modified by callee
Categories
(Tamarin Graveyard :: Virtual Machine, defect)
Tamarin Graveyard
Virtual Machine
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: edwsmith, Assigned: edwsmith)
Details
Attachments
(1 file)
|
8.31 KB,
patch
|
tharwood
:
review+
stejohns
:
superreview+
|
Details | Diff | Splinter Review |
In the course of implementing in-place unboxing in coerceUnboxEnter, I ran into call sites which wrongly assume that calling a function will not modify the args passed in.
Our calling protocol requires that the callee can modify the arguments in place, to avoid extra copies and stack allocation.
ArrayClass::
generic_every()
generic_filter()
generic_forEach()
generic_some()
generic_map()
VectorBaseObject::
map()
filter()
| Assignee | ||
Comment 1•16 years ago
|
||
Assignee: nobody → edwsmith
Attachment #407283 -
Flags: review?(tharwood)
Updated•16 years ago
|
Attachment #407283 -
Flags: review?(tharwood) → review+
Comment 2•16 years ago
|
||
Comment on attachment 407283 [details] [diff] [review]
never reuse args after passing them to callee
The change to VectorBaseClass::filter() that returns "element" allows the callback to change the property, but puts the previous value into the result. The docs for Vector are not explicit on this point, unsurprisingly. It'd be good to have them updated, too.
| Assignee | ||
Comment 3•16 years ago
|
||
The previous code assumed that coerceEnter() made a copy of args[] before calling the callback (which it always does, currently, but is not guaranteed to do). so, it always preserved the old value of element, and the patch preserves this behavior.
its true that callback() can mutate the array we're working on, but i haven't intended to change anything in that area.
| Assignee | ||
Updated•16 years ago
|
Attachment #407283 -
Flags: superreview?(stejohns)
Comment 4•16 years ago
|
||
Comment on attachment 407283 [details] [diff] [review]
never reuse args after passing them to callee
would be useful to add an arg reminding why the args are done that way, so someone doesn't try to "improve" it in the future
Attachment #407283 -
Flags: superreview?(stejohns) → superreview+
| Assignee | ||
Comment 5•16 years ago
|
||
will do. (s/arg/comment)
| Assignee | ||
Comment 6•16 years ago
|
||
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Flags: in-testsuite?
You need to log in
before you can comment on or make changes to this bug.
Description
•