Merge pull request #1676 from edwinb/inc-fix

Need --script for incrementally compiled apps
This commit is contained in:
Edwin Brady 2021-07-11 18:22:20 +01:00 committed by GitHub
commit b05ec6eff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 37 additions and 3 deletions

View File

@ -19,6 +19,7 @@
half as good. The `--whole-program` flag overrides incremental compilation,
and reverts to whole program compilation. Incremental compilation is currently
supported only by the Chez Scheme back end.
This is currently supported only on Unix-like platforms (not yet Windows)
### Library Changes

View File

@ -85,7 +85,9 @@ findLibs ds
schHeader : String -> List String -> Bool -> String
schHeader chez libs whole
= (if os /= "windows" then "#!" ++ chez ++ " --program\n\n" else "") ++
= (if os /= "windows"
then "#!" ++ chez ++ (if whole then " --program\n\n" else " --script\n\n")
else "") ++
"; " ++ (generatedString "Chez") ++ "\n" ++
"(import (chezscheme))\n" ++
"(case (machine-type)\n" ++
@ -581,6 +583,8 @@ compileExpr : Bool -> Ref Ctxt Defs -> (tmpDir : String) -> (outputDir : String)
compileExpr makeitso c tmpDir outputDir tm outfile
= do s <- getSession
if not (wholeProgram s) && (Chez `elem` incrementalCGs !getSession)
-- Disable on Windows, for now, since it doesn't work!
&& os /= "windows"
then compileExprInc makeitso c tmpDir outputDir tm outfile
else compileExprWhole makeitso c tmpDir outputDir tm outfile
@ -596,7 +600,12 @@ executeExpr c tmpDir tm
incCompile : Ref Ctxt Defs ->
(sourceFile : String) -> Core (Maybe (String, List String))
incCompile c sourceFile
= do ssFile <- getTTCFileName sourceFile "ss"
= do -- Disable on Windows, for now, since it doesn't work!
-- When re-enabling it, please also turn it back on in test chez033
let True = os /= "windows"
| False => pure Nothing
ssFile <- getTTCFileName sourceFile "ss"
soFile <- getTTCFileName sourceFile "so"
soFilename <- getObjFileName sourceFile "so"
cdata <- getIncCompileData False Cases

View File

@ -213,7 +213,7 @@ chezTests = MkTestPool "Chez backend" [] (Just Chez)
, "chez013", "chez014", "chez015", "chez016", "chez017", "chez018"
, "chez019", "chez020", "chez021", "chez022", "chez023", "chez024"
, "chez025", "chez026", "chez027", "chez028", "chez029", "chez030"
, "chez031", "chez032"
, "chez031", "chez032", "chez033"
, "futures001"
, "bitops"
, "casts"

View File

@ -0,0 +1,4 @@
import Mod
main : IO ()
main = printLn (fn (100 * 100))

View File

@ -0,0 +1,5 @@
module Mod
export
fn : Nat -> Nat
fn x = S x

View File

@ -0,0 +1,4 @@
1/2: Building Mod (Mod.idr)
2/2: Building Main (Main.idr)
Main> 10001
Main> Bye for now!

2
tests/chez/chez033/input Normal file
View File

@ -0,0 +1,2 @@
:exec main
:q

9
tests/chez/chez033/run Normal file
View File

@ -0,0 +1,9 @@
if [ "$OS" = "windows" ]; then
# incremental builds don't work on windows so we get lots of warnings,
# but we still need the test output to be correct
$1 --no-banner --no-color --console-width 0 Main.idr < input
else
$1 --no-banner --no-color --console-width 0 Main.idr --inc chez < input
fi
rm -rf build