Skip to content
  • Gabor Greif's avatar
    Implement pointer tagging for big families (#14373) · 14cb6472
    Gabor Greif authored
    Formerly we punted on these and evaluated constructors always got a tag
    of 1.
    
    We now cascade switches because we have to check the tag first and when
    it is MAX_PTR_TAG then get the precise tag from the info table and
    switch on that. The only technically tricky part is that the default
    case needs (logical) duplication. To do this we emit an extra label for
    it and branch to that from the second switch. This avoids duplicated
    codegen.
    
    Here's a simple example of the new code gen:
    
        data D = D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8
    
    On a 64-bit system previously all constructors would be tagged 1. With
    the new code gen D7 and D8 are tagged 7:
    
        [Lib.D7_con_entry() {
             ...
             {offset
               c1eu: // global
                   R1 = R1 + 7;
                   call (P64[Sp])(R1) args: 8, res: 0, upd: 8;
             }
         }]
    
        [Lib.D8_con_entry() {
             ...
             {offset
               c1ez: // global
                   R1 = R1 + 7;
                   cal...
    14cb6472