Mercurial > urweb
comparison src/compiler.sml @ 1677:3cfc79f92db7
-dumpSource flag; Especialize tweak: may specialize any argument sequence ending in a value of function-containing type
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 12 Jan 2012 20:37:39 -0500 |
parents | 8de2ea0a0701 |
children | 2b04104896a8 |
comparison
equal
deleted
inserted
replaced
1676:266814b15dd6 | 1677:3cfc79f92db7 |
---|---|
1 (* Copyright (c) 2008-2011, Adam Chlipala | 1 (* Copyright (c) 2008-2012, Adam Chlipala |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
77 print : 'dst -> Print.PD.pp_desc, | 77 print : 'dst -> Print.PD.pp_desc, |
78 time : 'src * pmap -> 'dst option * pmap | 78 time : 'src * pmap -> 'dst option * pmap |
79 } | 79 } |
80 | 80 |
81 val debug = ref false | 81 val debug = ref false |
82 val dumpSource = ref false | |
82 val doIflow = ref false | 83 val doIflow = ref false |
84 | |
85 val doDumpSource = ref (fn () => ()) | |
83 | 86 |
84 fun transform (ph : ('src, 'dst) phase) name = { | 87 fun transform (ph : ('src, 'dst) phase) name = { |
85 func = fn input => let | 88 func = fn input => let |
86 val () = if !debug then | 89 val () = if !debug then |
87 print ("Starting " ^ name ^ "....\n") | 90 print ("Starting " ^ name ^ "....\n") |
92 if !debug then | 95 if !debug then |
93 print ("Finished " ^ name ^ ".\n") | 96 print ("Finished " ^ name ^ ".\n") |
94 else | 97 else |
95 (); | 98 (); |
96 if ErrorMsg.anyErrors () then | 99 if ErrorMsg.anyErrors () then |
97 NONE | 100 (!doDumpSource (); |
101 doDumpSource := (fn () => ()); | |
102 NONE) | |
98 else | 103 else |
99 SOME v | 104 (if !dumpSource then |
105 doDumpSource := (fn () => Print.eprint (#print ph v)) | |
106 else | |
107 (); | |
108 SOME v) | |
100 end, | 109 end, |
101 print = #print ph, | 110 print = #print ph, |
102 time = fn (input, pmap) => let | 111 time = fn (input, pmap) => let |
103 val () = if !debug then | 112 val () = if !debug then |
104 print ("Starting " ^ name ^ "....\n") | 113 print ("Starting " ^ name ^ "....\n") |