Changes between Version 9 and Version 10 of DataParallel/ClosureConversion/ClassLess


Ignore:
Timestamp:
Apr 23, 2007 9:52:55 AM (7 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/ClosureConversion/ClassLess

    v9 v10  
    44The following scheme - if Roman doesn't find any problems with it (he is notorious for that) - should be simpler (as in relying on fewer other mechanisms) than what we had in mind so far for mixing converted and unconverted code.  In particular, the scheme gracefully handles any declarations that themselves cannot be converted, but occur in a converted module. 
    55 
    6 === Type declarations === 
     6=== Conversion status === 
     7 
     8We add to all declaration that are affected by closure conversion a value of type 
     9{{{ 
     10data StatusCC a  
     11  = NoCC      -- Declaration has not been converted 
     12  | AsIsCC    -- Conversion not necessary, use original 
     13  | ConvCC a  -- Here is the converted version 
     14}}} 
     15For example, `Id` gets a field of type `StatusCC Id`. 
     16 
     17=== Converting type declarations === 
    718 
    819If a type declaration for constructor `T` occurs in a converted module, we 
     
    1526Note that basic types, such as `Int` and friends, would have `tyConCC` set to `Nothing`, which is exactly what we want. 
    1627 
    17 === Class declarations === 
     28=== Converting class declarations === 
    1829 
    1930If we come across a class declaration for a class `C` during conversion, we convert it generating `C_CC`.  Like with type constructors, `Class.Class` gets a `classCC :: Maybe Class` field that is `Just C_CC` for classes that have a conversion.  We also ensure that the `classTyCon` of `C`, let's call it `T_C`, refers to `T_C_CC` and `fr_T_C` and `to_T_C` in its `tyConCC` field, and that the `classTyCon` of `C_CC` is `T_C_CC`. 
    2031 
    21 === Instance declarations === 
     32=== Converting instance declarations === 
    2233 
    2334If we encounter an instance declaration for `C tau` during conversion, there are two alternatives: we have a conversion for `C` or not: 
     
    2637In any case, we add a field `is_CC :: Just Instance` to `InstEnv.Instance` that contains the additionally generated instance.  And in both cases, we should be able to derive the required code for the dfun from the definition of `C tau`.  We also make sure that the `dfun`'s `idCC` field (see below) is set to that of the converted dfun. 
    2738 
    28 === Type terms === 
     39=== Converting type terms === 
    2940 
    3041We determine the converted type `t^` of `t` as follows: 
     
    4051}}} 
    4152 
    42 === Value bindings === 
     53=== Converting value bindings === 
    4354 
    4455When converting a toplevel binding for `f :: t`, we generate `f_CC :: t^`.  The alternatives `GlobalId` and `LocalId` of `Var.Var` get a new field `idCC :: Maybe Id` and the `Id` for `f` contains `Just f_CC` in that field. 
    4556 
    46 === Core terms === 
     57=== Converting core terms === 
    4758 
    4859Apart from the standard rules, we need to handle the following special cases: