Mercurial > urweb
annotate src/mono_inline.sml @ 2297:6d56080f495c
Fix a read-after-free bug using a timestamp check
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 19 Nov 2015 13:18:58 -0500 |
parents | edd634b889d0 |
children |
rev | line source |
---|---|
ziv@2214 | 1 structure MonoInline = struct |
ziv@2214 | 2 |
ziv@2214 | 3 fun inlineFull file = |
ziv@2214 | 4 let |
ziv@2214 | 5 val oldInline = Settings.getMonoInline () |
ziv@2214 | 6 val oldFull = !MonoReduce.fullMode |
ziv@2214 | 7 in |
ziv@2214 | 8 (Settings.setMonoInline (case Int.maxInt of |
ziv@2214 | 9 NONE => 1000000 |
ziv@2214 | 10 | SOME n => n); |
ziv@2214 | 11 MonoReduce.fullMode := true; |
ziv@2214 | 12 let |
ziv@2214 | 13 val file = MonoReduce.reduce file |
ziv@2214 | 14 val file = MonoOpt.optimize file |
ziv@2214 | 15 val file = Fuse.fuse file |
ziv@2214 | 16 val file = MonoOpt.optimize file |
ziv@2214 | 17 val file = MonoShake.shake file |
ziv@2214 | 18 in |
ziv@2214 | 19 file |
ziv@2214 | 20 end before |
ziv@2214 | 21 (MonoReduce.fullMode := oldFull; |
ziv@2214 | 22 Settings.setMonoInline oldInline)) |
ziv@2214 | 23 handle ex => (Settings.setMonoInline oldInline; |
ziv@2214 | 24 MonoReduce.fullMode := oldFull; |
ziv@2214 | 25 raise ex) |
ziv@2214 | 26 end |
ziv@2214 | 27 |
ziv@2214 | 28 end |