15 |
type ed = { ii: IInfo.info, ctxt: statenv } |
type ed = { ii: IInfo.info, ctxt: statenv } |
16 |
in |
in |
17 |
signature COMPILE = sig |
signature COMPILE = sig |
18 |
|
type bfc |
19 |
|
|
20 |
(* reset internal persistent state *) |
(* reset internal persistent state *) |
21 |
val reset : unit -> unit |
val reset : unit -> unit |
22 |
|
|
23 |
(* notify linkage module about recompilation *) |
(* notify linkage module about recompilation *) |
24 |
type notifier = SmlInfo.info -> unit |
type notifier = GP.info -> SmlInfo.info -> unit |
25 |
|
|
26 |
val sizeBFC : SmlInfo.info -> int |
val sizeBFC : SmlInfo.info -> int |
27 |
val writeBFC : BinIO.outstream -> SmlInfo.info -> unit |
val writeBFC : BinIO.outstream -> SmlInfo.info -> unit |
28 |
val getII : SmlInfo.info -> IInfo.info |
val getII : SmlInfo.info -> IInfo.info |
29 |
|
val getBFC : SmlInfo.info -> bfc |
30 |
|
|
31 |
|
val evict : SmlInfo.info -> unit |
32 |
|
|
33 |
val newSbnodeTraversal : notifier -> GP.info -> DG.sbnode -> ed option |
val newSbnodeTraversal : unit -> GP.info -> DG.sbnode -> ed option |
34 |
|
|
35 |
val newTraversal : notifier * GG.group -> |
val newTraversal : notifier * GG.group -> |
36 |
{ group: GP.info -> result option, |
{ group: GP.info -> result option, |
37 |
exports: (GP.info -> result option) SymbolMap.map } |
exports: (GP.info -> result option) SymbolMap.map } |
38 |
end |
end |
39 |
|
|
40 |
functor CompileFn (structure MachDepVC : MACHDEP_VC) :> COMPILE = struct |
functor CompileFn (structure MachDepVC : MACHDEP_VC) :> |
41 |
|
COMPILE where type bfc = MachDepVC.Binfile.bfContent = |
42 |
|
struct |
43 |
|
|
44 |
type notifier = SmlInfo.info -> unit |
type notifier = GP.info -> SmlInfo.info -> unit |
45 |
|
|
46 |
structure BF = MachDepVC.Binfile |
structure BF = MachDepVC.Binfile |
47 |
|
|
216 |
fun cleanup () = |
fun cleanup () = |
217 |
OS.FileSys.remove binname handle _ => () |
OS.FileSys.remove binname handle _ => () |
218 |
in |
in |
219 |
notify i; |
notify gp i; |
220 |
SafeIO.perform { openIt = |
SafeIO.perform { openIt = |
221 |
fn () => AutoDir.openBinOut binname, |
fn () => AutoDir.openBinOut binname, |
222 |
closeIt = BinIO.closeOut, |
closeIt = BinIO.closeOut, |
362 |
exports = SymbolMap.map mkExport exports } |
exports = SymbolMap.map mkExport exports } |
363 |
end |
end |
364 |
|
|
365 |
fun newSbnodeTraversal notify = let |
fun newSbnodeTraversal () = let |
366 |
val { sbnode, ... } = mkTraversal notify |
val { sbnode, ... } = mkTraversal (fn _ => fn _ => ()) |
367 |
fun envdelta2ed { ii, bfc, ctxt } = { ii = ii, ctxt = ctxt () } |
fun envdelta2ed { ii, bfc, ctxt } = { ii = ii, ctxt = ctxt () } |
368 |
in |
in |
369 |
fn gp => fn n => Option.map envdelta2ed (sbnode gp n) |
fn gp => fn n => Option.map envdelta2ed (sbnode gp n) |
376 |
fun writeBFC s i = BF.write { content = #bfc (get i), |
fun writeBFC s i = BF.write { content = #bfc (get i), |
377 |
stream = s, nopickle = true } |
stream = s, nopickle = true } |
378 |
fun getII i = memo2ii (get i) |
fun getII i = memo2ii (get i) |
379 |
|
fun getBFC i = #bfc (get i) |
380 |
|
|
381 |
|
fun evict i = |
382 |
|
(globalmap := #1 (SmlInfoMap.remove (!globalmap, i))) |
383 |
|
handle LibBase.NotFound => () |
384 |
end |
end |
385 |
end |
end |
386 |
end |
end |