diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2013-11-29 14:25:23 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2013-11-29 14:25:23 +0000 |
| commit | 1067d5960964995e92209354aecb4c4ed82e9b86 (patch) | |
| tree | bfcbafc3cb706735df75c90fb7cb40e02acf3181 /src/runtime | |
| parent | 870b0738914e08a5fb05572291e2872d78e07d8f (diff) | |
-optimize-pgf should also apply to the linrefs
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/haskell/PGF/Optimize.hs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/runtime/haskell/PGF/Optimize.hs b/src/runtime/haskell/PGF/Optimize.hs index ab831704f..447370362 100644 --- a/src/runtime/haskell/PGF/Optimize.hs +++ b/src/runtime/haskell/PGF/Optimize.hs @@ -35,16 +35,20 @@ topDownFilter startCat cnc = (env1,defs) = IntMap.mapAccumWithKey (\env fid funids -> mapAccumL (optimizeFun fid [PArg [] fidVar]) env funids) env0 (lindefs cnc) - (env2,prods) = IntMap.mapAccumWithKey (\env fid set -> mapAccumLSet (optimizeProd fid) env set) + (env2,refs) = IntMap.mapAccumWithKey (\env fid funids -> mapAccumL (optimizeFun fidVar [PArg [] fid]) env funids) env1 + (linrefs cnc) + (env3,prods) = IntMap.mapAccumWithKey (\env fid set -> mapAccumLSet (optimizeProd fid) env set) + env2 (productions cnc) cats = Map.mapWithKey filterCatLabels (cnccats cnc) - (seqs,funs) = env2 + (seqs,funs) = env3 in cnc{ sequences = mkSetArray seqs , cncfuns = mkSetArray funs , productions = prods , cnccats = cats , lindefs = defs + , linrefs = refs } where fid2cat fid = @@ -143,10 +147,12 @@ topDownFilter startCat cnc = where CncFun fun lin = cncfuns cnc ! funid - indicesOf fid = - case Map.lookup (fid2cat fid) closure of - Just indices -> indices - Nothing -> error "unknown category" + indicesOf fid + | fid < 0 = listArray (0,0) [0] + | otherwise = + case Map.lookup (fid2cat fid) closure of + Just indices -> indices + Nothing -> error "unknown category" addUnique seqs seq = case Map.lookup seq seqs of |
