call based vs continuation based contification
Stephen Weeks
MLton@sourcelight.com
Wed, 22 Nov 2000 13:33:00 -0800 (PST)
> Was the count-graphs case one where lifting the common calls was possible?
No. This was the case with two tail calls from outside preventing a function
(x_1188) from being contified. Here is the cps code.
fun x_1188(x_2277, x_2278) =
let
val x_1191 = Int_add(x_2277, global_7)
in
loop_59(x_1191, x_2278)
end
fun loop_59(x_1192, env_129) =
let
val pState_0 = #1 env_129
val connected_10 = #2 env_129
val x_1194 = #3 env_129
val first_0 = #4 env_129
val x_1195 = #5 env_129
val x_1196 = #6 env_129
val x_1193 = MLton_eq(x_1192, pState_0)
fun L_356() =
let
fun L_769(x_2273, x_2274) =
let
val x_1971 = Array_length(connected_10)
fun L_770() =
let
val x_1973 = Array_sub(connected_10, x_2274)
val x_1974 = Array_length(x_1973)
fun L_772() =
let
val x_1975 = Array_sub(x_1973, x_2273)
val x_1200 = Array_length(x_1194)
fun L_360() =
let
val x_1201 = Array_sub(x_1194, x_1192)
fun L_776(x_2275, x_2276) =
let
val x_1979 = Array_length(connected_10)
fun L_777() =
let
val x_1981 = Array_sub(connected_10,
x_2276)
val x_1982 = Array_length(x_1981)
fun L_779() =
let
val x_1983 = Array_sub(x_1981,
x_2275)
fun L_364() =
let
fun L_367() =
x_1188(x_1192,
env_129)
fun L_366() =
raise [x_1195]
in
case x_1983 of
true => L_366
| _ => L_367
end
fun L_365() =
let
fun L_369() =
x_1188(x_1192,
env_129)
fun L_368() =
let
val x_1205 = accross_0(x_1196)
in
raise [x_1205]
end
in
case x_1983 of
false => L_368
| _ => L_369
end
in
case x_1975 of
false => L_364
| true => L_365
end
fun L_780() =
raise [global_80]
val x_1980 = Int_geu(x_2275,
x_1982)
in
case x_1980 of
true => L_780 | false => L_779
end
fun L_778() =
raise [global_80]
val x_1978 = Int_geu(x_2276, x_1979)
in
case x_1978 of
true => L_778 | false => L_777
end
fun L_774() =
L_776(first_0, x_1201)
fun L_775() =
L_776(x_1201, first_0)
val x_1976 = Int_gt(first_0, x_1201)
in
case x_1976 of
true => L_775 | false => L_774
end
fun L_361() =
raise [global_80]
val x_1199 = Int_geu(x_1192, x_1200)
in
case x_1199 of
false => L_360 | true => L_361
end
fun L_773() =
raise [global_80]
val x_1972 = Int_geu(x_2273, x_1974)
in
case x_1972 of
true => L_773 | false => L_772
end
fun L_771() =
raise [global_80]
val x_1970 = Int_geu(x_2274, x_1971)
in
case x_1970 of
true => L_771 | false => L_770
end
fun L_767() =
L_769(pState_0, x_1192)
fun L_768() =
L_769(x_1192, pState_0)
val x_1968 = Int_gt(pState_0, x_1192)
in
case x_1968 of
true => L_768 | false => L_767
end
fun L_357() =
let
val x_1989 = Array_length(x_1194)
fun L_781() =
let
val x_1990 = Array_update(x_1194, pState_0, first_0)
val x_1210 = Int_add(pState_0, global_7)
in
x_1210
end
fun L_782() =
raise [global_80]
val x_1988 = Int_geu(pState_0, x_1989)
in
case x_1988 of
true => L_782 | false => L_781
end
in
case x_1193 of
false => L_356 | true => L_357
end