diff options
author | johnvg | 2003-06-23 14:17:22 +0000 |
---|---|---|
committer | johnvg | 2003-06-23 14:17:22 +0000 |
commit | 666747be3791774cddf41d6d855244b4f39b12a5 (patch) | |
tree | 0da83aa1dc22611c715135065d9153c4e0c54acf /frontend/classify.icl | |
parent | use :: T (:== .. ) syntax for abstract type synonyms (diff) |
optimize allocation of Par and Seq constructors to prevent heap overflow
(>100 m)
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1362 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/classify.icl')
-rw-r--r-- | frontend/classify.icl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/frontend/classify.icl b/frontend/classify.icl index 510cd47..6ef3cd5 100644 --- a/frontend/classify.icl +++ b/frontend/classify.icl @@ -204,11 +204,21 @@ add_dep_count (fi,ai) rc combine_counts :: !RefCounts !RefCounts -> .RefCounts combine_counts c1 c2 - = {Seq 0 [|rc1,rc2] \\ rc1 <-: c1 & rc2 <-: c2} + = {combine rc1 rc2 \\ rc1 <-: c1 & rc2 <-: c2} +where + combine (Seq 0 [|]) rc2 = rc2 + combine rc1 (Seq 0 [|]) = rc1 + combine (Seq i1 [|]) (Seq i2 l) = Seq (i1+i2) l + combine (Seq i1 l) (Seq i2 [|]) = Seq (i1+i2) l + combine rc1 rc2 = Seq 0 [|rc1,rc2] unify_counts :: !RefCounts !RefCounts -> RefCounts unify_counts c1 c2 - = {Par 0 [|rc1,rc2] \\ rc1 <-: c1 & rc2 <-: c2} + = {unify rc1 rc2 \\ rc1 <-: c1 & rc2 <-: c2} +where + unify (Seq 0 [|]) rc2 = rc2 + unify rc1 (Seq 0 [|]) = rc1 + unify rc1 rc2 = Par 0 [|rc1,rc2] show_counts group_members group_counts # (_,group_counts) = foldSt show group_members (0,group_counts) |