[MLton-commit] r7372
Matthew Fluet
fluet at mlton.org
Wed Dec 9 19:08:31 PST 2009
Save profile information, even if an exception is raised.
----------------------------------------------------------------------
U mlton/trunk/mlton/control/control.sml
----------------------------------------------------------------------
Modified: mlton/trunk/mlton/control/control.sml
===================================================================
--- mlton/trunk/mlton/control/control.sml 2009-12-10 03:08:27 UTC (rev 7371)
+++ mlton/trunk/mlton/control/control.sml 2009-12-10 03:08:31 UTC (rev 7372)
@@ -343,7 +343,7 @@
result
end
-(* Code for diagnosing a pass. *)
+(* Code for profiling a pass. *)
val pass =
fn z as {name, ...} =>
if MLton.Profile.isOn
@@ -353,11 +353,11 @@
else let
open MLton.Profile
val d = Data.malloc ()
- val result = withData (d, fn () => pass z)
- val _ = Data.write (d, concat [!inputFile, ".", name, ".mlmon"])
- val _ = Data.free d
in
- result
+ Exn.finally
+ (fn () => withData (d, fn () => pass z),
+ fn () => (Data.write (d, concat [!inputFile, ".", name, ".mlmon"])
+ ; Data.free d))
end
else pass z
More information about the MLton-commit
mailing list