compilation cache: better dependency checking

This commit is contained in:
Araq 2011-10-23 22:45:52 +02:00
commit a702524ae4
5 changed files with 34 additions and 14 deletions

View file

@ -171,6 +171,7 @@ proc CommandScan(filename: string) =
proc CommandSuggest(filename: string) = proc CommandSuggest(filename: string) =
msgs.gErrorMax = high(int) # do not stop after first error msgs.gErrorMax = high(int) # do not stop after first error
semanticPasses() semanticPasses()
registerPass(rodwrite.rodwritePass())
compileProject(filename) compileProject(filename)
proc WantFile(filename: string) = proc WantFile(filename: string) =

View file

@ -27,7 +27,7 @@ type # please make sure we have under 32 options
# (for interfacing with C) # (for interfacing with C)
optProfiler # profiler turned on optProfiler # profiler turned on
TOptions* = set[TOption] TOptions* = set[TOption]
TGlobalOption* = enum TGlobalOption* = enum # **keep binary compatible**
gloptNone, optForceFullMake, optBoehmGC, optRefcGC, optDeadCodeElim, gloptNone, optForceFullMake, optBoehmGC, optRefcGC, optDeadCodeElim,
optListCmd, optCompileOnly, optNoLinking, optListCmd, optCompileOnly, optNoLinking,
optSafeCode, # only allow safe code optSafeCode, # only allow safe code
@ -51,6 +51,7 @@ type # please make sure we have under 32 options
TGlobalOptions* = set[TGlobalOption] TGlobalOptions* = set[TGlobalOption]
TCommands* = enum # Nimrod's commands TCommands* = enum # Nimrod's commands
# **keep binary compatible**
cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC,
cmdCompileToEcmaScript, cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc, cmdCompileToEcmaScript, cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc,
cmdGenDepend, cmdDump, cmdGenDepend, cmdDump,
@ -93,10 +94,10 @@ const
DocTexConfig* = "nimdoc.tex.cfg" DocTexConfig* = "nimdoc.tex.cfg"
# additional configuration variables: # additional configuration variables:
var var
gConfigVars*: PStringTable gConfigVars* = newStringTable(modeStyleInsensitive)
libpath*: string = "" libpath* = ""
projectPath*: string = "" projectPath* = ""
projectName* = "" projectName* = ""
nimcacheDir* = "" nimcacheDir* = ""
gKeepComments*: bool = true # whether the parser needs to keep comments gKeepComments*: bool = true # whether the parser needs to keep comments
@ -200,4 +201,3 @@ proc binaryStrSearch*(x: openarray[string], y: string): int =
return mid return mid
result = - 1 result = - 1
gConfigVars = newStringTable(modeStyleInsensitive)

View file

@ -24,6 +24,8 @@
# - a section containing the compiler options and defines this # - a section containing the compiler options and defines this
# module has been compiled with: # module has been compiled with:
# OPTIONS:options\n # OPTIONS:options\n
# GOPTIONS:options\n # global options
# CMD:command\n
# DEFINES:defines\n # DEFINES:defines\n
# - FILES( # - FILES(
# myfile.inc # myfile.inc
@ -106,7 +108,8 @@ const
"symbol file for $1 has the wrong version", "symbol file for $1 has the wrong version",
"file edited since last compilation: $1", "file edited since last compilation: $1",
"list of conditional symbols changed for: $1", "list of conditional symbols changed for: $1",
"list of options changed for: $1", "an include file edited: $1", "list of options changed for: $1",
"an include file edited: $1",
"a module $1 depends on has changed"] "a module $1 depends on has changed"]
type type
@ -139,7 +142,7 @@ type
PRodReader* = ref TRodReader PRodReader* = ref TRodReader
const const
FileVersion* = "1023" # modify this if the rod-format changes! FileVersion* = "1024" # modify this if the rod-format changes!
var rodCompilerprocs*: TStrTable var rodCompilerprocs*: TStrTable
@ -501,7 +504,15 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
inc(r.pos) # skip ':' inc(r.pos) # skip ':'
r.options = cast[TOptions](int32(decodeVInt(r.s, r.pos))) r.options = cast[TOptions](int32(decodeVInt(r.s, r.pos)))
if options.gOptions != r.options: r.reason = rrOptions if options.gOptions != r.options: r.reason = rrOptions
of "DEFINES": of "GOPTIONS":
inc(r.pos) # skip ':'
var dep = cast[TGlobalOptions](int32(decodeVInt(r.s, r.pos)))
if gGlobalOptions != dep: r.reason = rrOptions
of "CMD":
inc(r.pos) # skip ':'
var dep = cast[TCommands](int32(decodeVInt(r.s, r.pos)))
if gCmd != dep: r.reason = rrOptions
of "DEFINES":
inc(r.pos) # skip ':' inc(r.pos) # skip ':'
d = 0 d = 0
while r.s[r.pos] > '\x0A': while r.s[r.pos] > '\x0A':

View file

@ -421,6 +421,16 @@ proc writeRod(w: PRodWriter) =
encodeVInt(cast[int32](w.options), options) encodeVInt(cast[int32](w.options), options)
f.write(options) f.write(options)
f.write(rodNL) f.write(rodNL)
var goptions = "GOPTIONS:"
encodeVInt(cast[int32](gGlobalOptions), goptions)
f.write(goptions)
f.write(rodNL)
var cmd = "CMD:"
encodeVInt(cast[int32](gCmd), cmd)
f.write(cmd)
f.write(rodNL)
f.write("DEFINES:") f.write("DEFINES:")
f.write(w.defines) f.write(w.defines)

View file

@ -29,8 +29,6 @@ incremental compilation
- test G, A, B example from the documentation - test G, A, B example from the documentation
- test init sections - test init sections
- fix remaining bugs
version 0.9.0 version 0.9.0
============= =============
@ -66,9 +64,9 @@ Bugs
result = forward(x) result = forward(x)
- bug: DLL generation is broken - bug: DLL generation is broken
- bug: stress testing basic method example (eval) without ``-d:relase`` leaks - bug: stress testing basic method example (eval example)
memory; good way to figure out how a fixed amount of stack can hold without ``-d:relase`` leaks memory; good way to figure out how a
an arbitrary number of GC roots! fixed amount of stack can hold an arbitrary number of GC roots!
version 0.9.XX version 0.9.XX