[mercury-users] Why isn't deforestation working here?
Ralph Becket
rbeck at microsoft.com
Sun Oct 17 00:15:27 AEST 1999
I've attached the simplified code for the LZW compression module I've been
working on. I've got several successive refinements of this thing (the
attached version isn't one of the scarier ones), but all share pretty much
the same main-loop code. I've managed to get rid of just about all memory
allocation in the program, but there is one place left that is bugging me,
and it's to do with io__result/1s being generated every time my program
reads a byte from the input file.
The basic format of the code is something like this:
io__read_byte(Result, IO_in, IO_out),
( Result = ok(Byte), ...
; Result = eof, ...
; Result = error(ErrCode), ...
)
and I was under the impression that compiling with
MCFLAGS = -O 6 --intermodule-optimization
should deforest (vb?) this code. Any help would be greatly appreciated!
Cheers,
Ralph
begin 600 compress.m
M)2`M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM("4*)2!C;VUP<F5S
M<RYM"B4*)2!697)S:6]N(#$*)0HE(%1H:7,@=F5R<VEO;B!I<R!A8F]U="!A
M<R!S:6UP;&4 at 87,@:70 at 9V5T<RP@=7-I;F<@=&AE('-T86YD87)D(&QI8G)A
M<GD*)2!M87`@*&$@,C,T('1R964@:6UP;&5M96YT871I;VXI('1O(&UA<"!P
M<F5F:7 at M8V]D92`K(&)Y=&4 at 8V]M8FEN871I;VYS"B4@=&\@8V]D97, at 86YD
M(&ME97!I;F<@86QL('1H92!B:6YA<GD@;W5T<'5T('-T=69F(&QO8VME9"!I
M;B!A('-I;F=L92T*)2!C;VYS=')U8W1O<B!T>7!E+ at HE"B4 at +2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2`E"@HZ+2!M;V1U;&4 at 8V]M<')E<W,N
M"@HZ+2!I;G1E<F9A8V4N"@HZ+2!I;7!O<G1?;6]D=6QE(&EO+ at H*.BT@<')E
M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!G=6ED92X*"0D)
M:6YT+`D))2!"=69F97(@8V]N=&5N=',N"@D)"6EN=`D))2!.=6UB97(@;V8@
M8FET<R!I;B!B=69F97(N"@D)*2X*"CHM(&9U;F,@;F5W7V)I=&)U9B`](&)I
M=&)U9BX*"FYE=U]B:71B=68@/2!B:71B=68H,"P@,"P@,"P@,"P@,"DN"@HZ
M+2!P<F5D(')E861?8GET92AI;U]?<F5S=6QT*&EN="DL(&)I=&)U9BP at 8FET
M8G5F+"!I;U]?<W1A=&4L(&EO7U]S=&%T92DN"CHM(&UO9&4@<F5A9%]B>71E
M*&]U="P@:6XL(&]U="P at 9&DL('5O*2!I<R!D970N"@IR96%D7V)Y=&4H4F5S
M=6QT+"!B:71B=68H02Q"+$,L1"Q%*2P at 8FET8G5F*$$@*R`X+$(L0RQ$+$4I
M*2`M+3X*"6EO7U]R96%D7V)Y=&4H4F5S=6QT*2X*"CHM('!R960@=W)I=&5?
M8V]D92AI;G0L(&EN="P at 8FET8G5F+"!B:71B=68L(&EO7U]S=&%T92P@:6]?
M7W-T871E*2X*.BT@;6]D92!W<FET95]C;V1E*&EN+"!I;BP@:6XL(&]U="P@
M9&DL('5O*2!I<R!D970N"@IW<FET95]C;V1E*$-O9&4L($)I='-097)#;V1E
M+"!B:71B=68H03`L0C`L7T,P+$0P+$4P*2P at 8FET8G5F*$$L0BQ#+$0L12DI
M("TM/@H)>R!!(#T at 03`@?2P*"7L at 0B`]($(P("L at 0FET<U!E<D-O9&4@?2P*
M"7L at 0R`]("A!,"`M($(P*3X^,3$@?2P*"7=R:71E7V9U;&Q?8GET97,H1#`@
M7"\@0V]D93P\13`L($0L($4P("L at 0FET<U!E<D-O9&4L($4I+ at H*.BT@<')E
M9"!W<FET95]F=6QL7V)Y=&5S*&EN="P@:6YT+"!I;G0L(&EN="P@:6]?7W-T
M871E+"!I;U]?<W1A=&4I+ at HZ+2!M;V1E('=R:71E7V9U;&Q?8GET97,H:6XL
M(&]U="P@:6XL(&]U="P at 9&DL('5O*2!I<R!D970N"@IW<FET95]F=6QL7V)Y
M=&5S*$)I='-);BP at 0FET<TQE9G0L($YU;4)I=',L($YU;4QE9G0I("TM/@H)
M*"!I9B![($YU;4)I=',@/B`X('T@=&AE;@H)"6EO7U]W<FET95]B>71E*$)I
M='-);BDL"@D)=W)I=&5?9G5L;%]B>71E<RA":71S26X^/C at L($)I='-,969T
M+"!.=6U":71S("T at ."P at 3G5M3&5F="D*"2`@96QS90H)"7L at 0FET<TQE9G0@
M/2!":71S26X@?2P*"2`@"7L at 3G5M3&5F="`]($YU;4)I=',@?0H)*2X*"CHM
M('!R960 at 8V]M<')E<W-I;VY?<F%T:6]?9F%L;&5N*&)I=&)U9BDN"CHM(&UO
M9&4 at 8V]M<')E<W-I;VY?<F%T:6]?9F%L;&5N*&EN*2!I<R!S96UI9&5T+ at H*
M8V]M<')E<W-I;VY?<F%T:6]?9F%L;&5N*&)I=&)U9BA!+$(L0RQ?+%\I*2`Z
M+0H)*$$@+2!"*3X^,3$@/"!#+ at H*.BT at 9G5N8R!R97-E=%]C;VUP<F5S<VEO
M;E]R871I;RAB:71B=68I(#T at 8FET8G5F+@H*<F5S971?8V]M<')E<W-I;VY?
M<F%T:6\H8FET8G5F*%\L7RQ?+$0L12DI(#T at 8FET8G5F*#`L,"PP+$0L12DN
M"@HZ+2!P<F5D(&9L=7-H7V)U9F9E<BAB:71B=68L(&EO7U]S=&%T92P@:6]?
M7W-T871E*2X*.BT@;6]D92!F;'5S:%]B=69F97(H:6XL(&1I+"!U;RD@:7,@
M9&5T+ at H*9FQU<VA?8G5F9F5R*&)I=&)U9BA?+%\L0RQ?+%\I*2`M+3X*"6EO
M7U]W<FET95]B>71E*$,I+ at H*)2`M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
)+2TM+2TM("4*
`
end
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list