| 16 | | - the GC to set the LSB bit of constructor closure pointers, |
| 17 | | - the GC and the RTS code to mask out the LSB pointer when dereferencing it, |
| 18 | | - the code generation to test the LSB bit and case expressions and avoid the indirect jump. |
| | 16 | * the GC to set the LSB bit of constructor closure pointers, |
| | 17 | * the GC and the RTS code to mask out the LSB pointer when dereferencing it, |
| | 18 | * the code generation to test the LSB bit and case expressions and avoid the indirect jump. |
| 24 | | The nice thing about the current approach is that code size is small; implementing the test and jump will certainly add extra code to compiled case expressions. But the gains might be worth it. Complexity-wise this means masking out these bits when following any pointer to a heap object, which means carefully checking most of the runtime. |
| | 24 | The nice thing about the current approach is that code size is small; implementing the test and jump will certainly add extra code to compiled case expressions. But the gains might be worth it. Complexity-wise this means masking out these bits when following any pointer to a heap object, which means carefully checking most of the runtime. |
| | 25 | |
| | 26 | This would require modifying all of the above plus modifying |
| | 27 | * the code generator so that it checks whether the number of constructors is smaller or equal than 3/15. |
| | 28 | |
| | 29 | == Using a tag directly in the pointer == |
| | 30 | |
| | 31 | Constructors without children (such as {{{False}}} and {{{True}}}) only need their tag to be represented. Hence we can drop the pointer altogether as follows: |
| | 32 | |
| | 33 | || || bits 31..2 || bits 1 0 || |
| | 34 | || cons. w/no children || tag || 01 || |
| | 35 | || cons. w/children no. 1 || ptr || 10 || |
| | 36 | || cons. w/children no. 2 || ptr || 11 || |
| | 37 | |