summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <unknown>2003-11-13 16:02:25 +0000
committeraarne <unknown>2003-11-13 16:02:25 +0000
commitc5146d06143c9b93e40bb2b1265ab58134be36d7 (patch)
treea3c9fff896b110e7c84bbc8fe298f278e374eccb /src
parent25c86905867537f75e9fe2f19759d8747d465590 (diff)
Improved interface and instance compilation.
Improved interface and instance compilation. Restored an optimization of the optimizer: up to 4x faster now.
Diffstat (limited to 'src')
-rw-r--r--src/GF/Compile/Compile.hs5
-rw-r--r--src/GF/Compile/Optimize.hs4
-rw-r--r--src/GF/Compile/Rebuild.hs11
-rw-r--r--src/GF/Grammar/Compute.hs4
-rw-r--r--src/GF/Grammar/Refresh.hs2
-rw-r--r--src/Today.hs2
6 files changed, 20 insertions, 8 deletions
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs
index cc327be37..4364b7b2c 100644
--- a/src/GF/Compile/Compile.hs
+++ b/src/GF/Compile/Compile.hs
@@ -168,10 +168,11 @@ compileSourceModule opts env@(k,gr,can) mo@(i,mi) = do
mo1 <- ioeErr $ rebuildModule mos mo
mo1b <- ioeErr $ extendModule mos mo1
- ---- prDebug mo1b
+ ---- prDebug mo1b
case mo1b of
- (_,ModMod n) | not (isCompleteModule n) -> return (k,mo1b)
+ (_,ModMod n) | not (isCompleteModule n) -> do
+ return (k,mo1b) -- refresh would fail, since not renamed
_ -> do
mo2:_ <- putp " renaming " $ ioeErr $ renameModule mos mo1b
diff --git a/src/GF/Compile/Optimize.hs b/src/GF/Compile/Optimize.hs
index fe9b6b1af..77cbcdbdf 100644
--- a/src/GF/Compile/Optimize.hs
+++ b/src/GF/Compile/Optimize.hs
@@ -29,8 +29,8 @@ evalModule :: [(Ident,SourceModInfo)] -> (Ident,SourceModInfo) ->
Err [(Ident,SourceModInfo)]
evalModule ms mo@(name,mod) = case mod of
- ModMod (Module mt st fs me ops js) | st == MSComplete -> case mt of
- MTResource -> do
+ ModMod m0@(Module mt st fs me ops js) | st == MSComplete -> case mt of
+ _ | isModRes m0 -> do
let deps = allOperDependencies name js
ids <- topoSortOpers deps
MGrammar (mod' : _) <- foldM evalOp gr ids
diff --git a/src/GF/Compile/Rebuild.hs b/src/GF/Compile/Rebuild.hs
index d0e750e09..048af3c7c 100644
--- a/src/GF/Compile/Rebuild.hs
+++ b/src/GF/Compile/Rebuild.hs
@@ -32,7 +32,14 @@ rebuildModule ms mo@(i,mi) = do
testErr (isModRes m1) ("interface expected instead of" +++ prt i0)
m' <- do
js' <- extendMod False i0 (jments m1) (jments m)
- return $ replaceJudgements m js'
+ --- to avoid double inclusions, in instance I of I0 = J0 ** ...
+ case extends m of
+ Nothing -> return $ replaceJudgements m js'
+ Just j0 -> do
+ m0 <- lookupModMod gr j0
+ let notInM0 c = not $ isInBinTree (fst c) $ mapTree fst $ jments m0
+ let js2 = sorted2tree $ filter notInM0 $ tree2list js'
+ return $ replaceJudgements m js2
return $ ModMod m'
_ -> return mi
@@ -40,7 +47,7 @@ rebuildModule ms mo@(i,mi) = do
ModWith mt stat ext ops -> do
let insts = [(inf,inst) | OQualif _ inf inst <- ops]
let infs = map fst insts
- let stat' = ifNull MSComplete (const MSIncomplete)
+ let stat' = ifNull MSComplete (const MSIncomplete)
[i | i <- is, notElem i infs]
testErr (stat' == MSComplete || stat == MSIncomplete)
("module" +++ prt i +++ "remains incomplete")
diff --git a/src/GF/Grammar/Compute.hs b/src/GF/Grammar/Compute.hs
index 705b81ded..e400bce4e 100644
--- a/src/GF/Grammar/Compute.hs
+++ b/src/GF/Grammar/Compute.hs
@@ -172,6 +172,10 @@ computeTerm gr = comp where
_ -> return $ ExtR r' s'
-- case-expand tables
+ T i@(TComp _) cs -> do
+ cs' <- mapPairsM (comp g) cs
+ return $ T i cs'
+
T i cs -> do
pty0 <- getTableType i
ptyp <- comp g pty0
diff --git a/src/GF/Grammar/Refresh.hs b/src/GF/Grammar/Refresh.hs
index ff4c9b8af..b89897dfb 100644
--- a/src/GF/Grammar/Refresh.hs
+++ b/src/GF/Grammar/Refresh.hs
@@ -86,7 +86,7 @@ refreshGrammar = liftM (MGrammar . snd) . foldM refreshModule (0,[]) . modules
refreshModule :: (Int,[SourceModule]) -> SourceModule -> Err (Int,[SourceModule])
refreshModule (k,ms) mi@(i,m) = case m of
- ModMod mo@(Module mt fs st me ops js) | (isModCnc mo || mt == MTResource) -> do
+ ModMod mo@(Module mt fs st me ops js) | (isModCnc mo || isModRes mo) -> do
(k',js') <- foldM refreshRes (k,[]) $ tree2list js
return (k', (i, ModMod(Module mt fs st me ops (buildTree js'))) : ms)
_ -> return (k, mi:ms)
diff --git a/src/Today.hs b/src/Today.hs
index 698dedb2c..fbe3b0cd1 100644
--- a/src/Today.hs
+++ b/src/Today.hs
@@ -1 +1 @@
-module Today where today = "Wed Nov 12 13:30:08 CET 2003"
+module Today where today = "Thu Nov 13 17:50:30 CET 2003"