Changes between Version 3 and Version 4 of NestedCPR/wave4main


Ignore:
Timestamp:
Jan 14, 2014 5:54:52 PM (3 months ago)
Author:
nomeata
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NestedCPR/wave4main

    v3 v4  
    3434My attempt below to detect join points does not help: The CPR information for `go1` is the same as for `let go1 = rhs in body`, as `body` is just `go1 ww ipv`. 
    3535 
    36 The problem is that this is being passed as an argument to a function. In this case `runSTRep` (which is the function its being passed to) might help, but what is the general solution? 
    37  
    38 In this case, inlining `runSTRep` helps a bit, as it decreases allocation to `+6.6%`. (Whether that is correct is quite dubious). But in order to propagate the CPR’ing to tabulate, it seems one needs to pass nested CPR information from a case scrunitee to its components.  
    39  
    40 So I implement this, and now `tabulate` itself gets a CPR property, which comes from the second component of the `ST` action, as extracted by `runSTRep`. But we still do not retain the join-point-property, as the code that throws away the `ST` token is still there: 
    41 {{{ 
    42 case $wgo ww ipv of _ [Occ=Dead] { (# ww3, ww4, ww5, ww6, ww7 #) -> 
    43 (# ww4, ww5, ww6, ww7 #) 
    44 }}} 
    45  
    46 At that point I am running out of ideas. 
    47  
     36The problem is that this is being passed as an argument to a function (in this case `runSTRep`), and there is not much that can be done about this at this point. 
    4837== Summary with simple expressions == 
    4938 
     
    5140{{{ 
    5241f a x = case a of 
    53   True -> case foo of b -> snd $ 
     42  True -> case foo of b -> foo $ 
    5443    let go 0 = (1,(2,3)) 
    5544        go n = go (n-1) 
     
    5746  False -> undefined 
    5847}}} 
    59 Initial CPR transformation yields, where `$go` is no longer a join-point for the argument to `snd`. 
     48which after CPR transformation yields, where `$go` is no longer a join-point for the argument to `snd`. 
    6049{{{ 
    6150f a x = case a of 
    62   True -> case foo of b -> snd $ 
     51  True -> case foo of b -> foo $ 
    6352    let $wgo 0 = (# 1, 2, 3 #) 
    6453        $wgo n = go (n-1) 
     
    6655  False -> undefined 
    6756}}} 
    68 Inlining `snd` does not help a lot: 
    69 {{{ 
    70 f a x = case a of 
    71   True -> case foo of b -> 
    72     let go 0 = (1,(2,3)) 
    73         go n = go (n-1) 
    74     in case (go b) of (x,y) -> y 
    75   False -> undefined 
    76 }}} 
    77 still turns into  
    78 {{{ 
    79 f a x = case a of 
    80   True -> case foo of b -> snd $ 
    81     let $wgo 0 = (# 1, 2, 3 #) 
    82         $wgo n = go (n-1) 
    83     in case $wgo b of (# a, b, c #) -> (b,c) 
    84   False -> undefined 
    85 }}} 
    86 Furthermore allowing CPR information to flow from scrunitee to bound variables gives `f` a CPR property (which is good), but does not solve the problem. 
    87 {{{ 
    88 $wf a x = case a of 
    89   True -> case foo of b -> snd $ 
    90     let $go 0 = (# 1, 2, 3 #) 
    91         $go n = go (n-1) 
    92     in case $go b of (# a, b, c #) -> (# b, c #) 
    93   False -> undefined 
    94 }}} 
    95