Changes between Version 9 and Version 10 of DataParallel/ClosureConversion/ClassLess
- Timestamp:
- 04/23/07 02:52:55 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DataParallel/ClosureConversion/ClassLess
v9 v10 4 4 The 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. 5 5 6 === Type declarations === 6 === Conversion status === 7 8 We add to all declaration that are affected by closure conversion a value of type 9 {{{ 10 data 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 }}} 15 For example, `Id` gets a field of type `StatusCC Id`. 16 17 === Converting type declarations === 7 18 8 19 If a type declaration for constructor `T` occurs in a converted module, we … … 15 26 Note that basic types, such as `Int` and friends, would have `tyConCC` set to `Nothing`, which is exactly what we want. 16 27 17 === C lass declarations ===28 === Converting class declarations === 18 29 19 30 If 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`. 20 31 21 === Instance declarations ===32 === Converting instance declarations === 22 33 23 34 If we encounter an instance declaration for `C tau` during conversion, there are two alternatives: we have a conversion for `C` or not: … … 26 37 In 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. 27 38 28 === Type terms ===39 === Converting type terms === 29 40 30 41 We determine the converted type `t^` of `t` as follows: … … 40 51 }}} 41 52 42 === Value bindings ===53 === Converting value bindings === 43 54 44 55 When 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. 45 56 46 === Co re terms ===57 === Converting core terms === 47 58 48 59 Apart from the standard rules, we need to handle the following special cases:
