View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0000451 | mercury | Feature Request | public | 2018-02-20 16:41 | 2018-06-08 22:19 | ||||||||
Reporter | zs | ||||||||||||
Assigned To | zs | ||||||||||||
Priority | normal | Severity | minor | Reproducibility | N/A | ||||||||
Status | assigned | Resolution | open | ||||||||||
Product Version | |||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0000451: unpack packed args only as necessary in field updates | ||||||||||||
Description | Given a type such as :- type thing ---> thing(bool, bool, int, bool, bool, t6 :: bool), and two variables A and B of this type, the field update unification B = A ^ t6 := ... now gets compiled to code that picks up the value of every argument of A, except possibly the one being replaced, and puts them one-by-one into the newly allocated memory cell. Since the adjacent bools are packed into one word, the first of those steps requires using shifts and masks to unpack all of arguments 1, 2, 4 and 5, operations that the second step then reverses. In the common situation where the code following the field update does not look at the fields that were not updated, we should be able to generate code that picks up the first word of A as a complete entity and assigns it to the first word of B. For the third word, part of which is being replaced, it should still be possible to pick up the value of the 4th and 5th argument as a unit, and shift and OR it together with the new value of the 6th field *without* separating the 4th and 5th from each other. | ||||||||||||
Additional Information | This probably needs to be done during code generation, because a post-code-generation optimization pass would have no way of knowing that the values of the padding bits don't matter. | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files |
|
Notes | |
zs (developer) 2018-06-08 22:19 |
Implemented for hlc grades in a diff committed on 2018 June 2. Not yet implemented for LLDS grades. |