Changes between Version 19 and Version 20 of DataParallel/ClosureConversion/ClassLess


Ignore:
Timestamp:
Apr 24, 2007 8:13:37 AM (8 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/ClosureConversion/ClassLess

    v19 v20  
    1010data StatusCC a  
    1111  = NoCC      -- Declaration has not been converted 
    12   | AsIsCC    -- Conversion not necessary, use original 
    1312  | ConvCC a  -- Here is the converted version 
    1413}}} 
    15 For example, `Id` gets a field of type `StatusCC Id`.  Declarations can be in one of three categories: 
     14For example, `Id` gets a field of type `StatusCC Id`.  A declaration `thisDecl` can be in one of three categories: 
    1615 * `NoCC`: We did not convert that declaration, either because it was declared in an unconverted module or because it uses some feature that prevents conversion. 
    17  * `AsIsCC`: The original declaration can be directly used in converted code.  It's converted form is identical to the original (e.g., type declarations not involving arrows directly or indirectly). 
    18  * `ConvCC decl`: The variant `decl` is the closure converted form of the original declaration. 
     16 * `ConvCC thisDecl`: Original and converted declaration coincide (e.g., type declarations not involving arrows directly or indirectly). 
     17 * `ConvCC convDecl`: The variant `convDecl` is the closure-converted form of `thisDecl`. 
     18 
     19=== Conversion pairs === 
     20 
     21Conversion functions come in pairs, which we wrap with the following data type for convenience: 
     22{{{ 
     23data TF a b = TF {to :: a -> b; fr :: b -> a} 
     24}}} 
    1925 
    2026=== Converting type declarations === 
     
    2228==== Preliminaries ==== 
    2329 
    24 The alternatives of `TyCon.TyCon` get a new field `tyConCC :: StatusCC (TyCon, Id, Id)`.  This field is `NoCC` for data constructors for which we have no conversion, `AsIsCC` if the original and the converted form coincide, and `ConvCC (T_CC, to_T, fr_T)` if we have a converted form.  In the last case, `T_CC` is the converted constructor and `to_T`/`fr_T` are conversion functions between values inhabitating types formed from the original and converted constructor.  The type of these functions is as follows: 
     30The alternatives of `TyCon.TyCon` get a new field `tyConCC :: StatusCC (TyCon, Id)`.  This field is `NoCC` for data constructors for which we have no conversion and `ConvCC (T_CC, tf_T)` if we have a conversion, where the converted declaration `T_CC` may coincide with `T`.  The value `tf_T` is a ''conversion constructor'' for values inhabitating types formed from the original and converted constructor.  The type of these functions is as follows: 
    2531{{{ 
    26 toTy (C::k1->..->kn->*) = forall _1 .. _n _1_CC .. _n_CC. 
    27   toTy (_1::k1) -> .. -> toTy (_n::kn) ->  
    28   (C _1 .. _n -> C_CC _1_CC .. _n_CC) 
     32tfTy (T::k1->..->kn->*) = forall _1 .. _n _1_CC .. _n_CC. 
     33  tfTy (_1::k1) -> .. -> tfTy (_n::kn) ->  
     34  (TF (C _1 .. _n) (C_CC _1_CC .. _n_CC)) 
    2935}}} 
     36(The type variables beginning with underscores are bound here and we add one underscore for each level of kinding.) 
    3037 
    3138Moreover, we have a type constructor `(-->)` that represents closures and we assume that the field `tyConCC` of `(->)` has the value `ConvCC ((-->), fr_fun, to_fun)`, where `fr_fun` and `to_fun` are appropriate conversion functions.