comparison src/corify.sml @ 1878:df6a040f5389

Make transactional FFI functions effectful by default
author Adam Chlipala <adam@chlipala.net>
date Thu, 10 Oct 2013 18:01:30 -0400
parents 21ecf340f05c
children c1ee5dec9cff
comparison
equal deleted inserted replaced
1877:22b44fe822bf 1878:df6a040f5389
794 in 794 in
795 (ds, st) 795 (ds, st)
796 end 796 end
797 797
798 | L.DFfiStr (m, n, (sgn, _)) => 798 | L.DFfiStr (m, n, (sgn, _)) =>
799 (case sgn of 799 (print ("~~~" ^ m ^ "\n"); case sgn of
800 L.SgnConst sgis => 800 L.SgnConst sgis =>
801 let 801 let
802 val (ds, cmap, conmap, st, _) = 802 val (ds, cmap, conmap, st, _) =
803 foldl (fn ((sgi, _), (ds, cmap, conmap, st, trans)) => 803 foldl (fn ((sgi, _), (ds, cmap, conmap, st, trans)) =>
804 case sgi of 804 case sgi of
934 corifyCon st all 934 corifyCon st all
935 | _ => corifyCon st all 935 | _ => corifyCon st all
936 in 936 in
937 transactify c 937 transactify c
938 end 938 end
939
940 fun isTransactional (c, _) =
941 case c of
942 L'.TFun (_, c) => isTransactional c
943 | L'.CApp ((L'.CFfi ("Basis", "transaction"), _), _) => true
944 | _ => false
939 in 945 in
946 Print.epreface (x, CorePrint.p_con CoreEnv.empty c);
947
948 if isTransactional c then
949 let
950 val ffi = (m, x)
951 in
952 if Settings.isBenignEffectful ffi then
953 ()
954 else
955 Settings.addEffectful ffi
956 end
957 else
958 ();
940 (ds, 959 (ds,
941 SM.insert (cmap, x, c), 960 SM.insert (cmap, x, c),
942 conmap, 961 conmap,
943 st, 962 st,
944 trans) 963 trans)