From 7184b9c19ca049b7bfab83b5a9998fdf64beab63 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Tue, 13 Dec 2011 13:37:32 +0000 Subject: * interp/g-opt.boot (replaceableTemporary?): Remove. (optSeq,getRidOfTemps): Likewise. (optSeq): Rewrite. * interp/slam.boot (compileRecurrenceRelation): Tidy. --- src/ChangeLog | 7 +++++++ src/interp/g-opt.boot | 24 +++--------------------- src/interp/slam.boot | 4 ++-- 3 files changed, 12 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bbab7ecb..1decdafa 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-12-13 Gabriel Dos Reis + + * interp/g-opt.boot (replaceableTemporary?): Remove. + (optSeq,getRidOfTemps): Likewise. + (optSeq): Rewrite. + * interp/slam.boot (compileRecurrenceRelation): Tidy. + 2011-12-13 Gabriel Dos Reis * interp/g-opt.boot (removeJunk!): Rename from removeSeq! diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 851e7eb6..6c68c642 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -573,27 +573,9 @@ EqualBarGensym(x,y) == x isnt [.,:.] or y isnt [.,:.] => false fn(first x,first y) and fn(rest x,rest y) -++ Determine whether the symbol `g' is the name of a temporary that -++ can be replaced in the form `x', if it is of linear usage and not -++ the name of a program point. The latter occurs when %leave forms -++ are changed to %LET form followed by a GO form -- see optScope. -replaceableTemporary?(g,x) == - gensym? g and numOfOccurencesOf(g,x) < 2 and not jumpTarget?(g,x) where - jumpTarget?(g,x) == - atomic? x => false - x is ['GO,=g] => true - or/[jumpTarget?(g,x') for x' in x] - -optSeq ['%seq,:l] == - tryToRemoveSeq ['%seq,:getRidOfTemps l] where - getRidOfTemps l == - null l => nil - l is [["%LET",g,x],:r] and replaceableTemporary?(g,r) => - getRidOfTemps substitute(x,g,r) - [first l,:getRidOfTemps rest l] - tryToRemoveSeq l == - l is ['%seq,[op,a]] and op in '(%exit RETURN %leave %return) => a - l +optSeq x == + x is ['%seq,[op,a]] and op in '(%exit RETURN %leave %return) => a + x optSuchthat [.,:u] == ["SUCHTHAT",:u] diff --git a/src/interp/slam.boot b/src/interp/slam.boot index 64e5159a..10695b03 100644 --- a/src/interp/slam.boot +++ b/src/interp/slam.boot @@ -303,8 +303,8 @@ compileRecurrenceRelation(op,nam,argl,junk,[body,sharpArg,n,:initCode]) == fromScratchInit:= [["%LET",gIndex,n],:[["%LET",g,x] for g in gsList for x in initCode]] continueInit:= - [["%LET",gIndex,["%ELT",stateVar,0]], - :[["%LET",g,["%ELT",stateVar,i]] for g in gsList for i in 1..]] + [["%LET",gIndex,["ELT",stateVar,0]], + :[["%LET",g,["ELT",stateVar,i]] for g in gsList for i in 1..]] mainFunction:= [nam,["LAM",margl,mbody]] where margl:= [:argl,'envArg] max:= gensym() -- cgit v1.2.3