Mercurial > urweb
comparison src/monoize.sml @ 1360:02fc16faecf3
[De]serialization of times in JavaScript; proper integer division in JavaScript; Basis.crypt; Top.mkRead'; more aggressive Mono-level inlining, for values of function-y types
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Thu, 23 Dec 2010 17:46:40 -0500 |
parents | 32c8a3509369 |
children | b02cb9da5686 |
comparison
equal
deleted
inserted
replaced
1359:e525ad571e15 | 1360:02fc16faecf3 |
---|---|
893 | L.EFfi ("Basis", "eq_int") => | 893 | L.EFfi ("Basis", "eq_int") => |
894 ((L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), | 894 ((L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), |
895 (L'.TFun ((L'.TFfi ("Basis", "int"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 895 (L'.TFun ((L'.TFfi ("Basis", "int"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
896 (L'.EAbs ("y", (L'.TFfi ("Basis", "int"), loc), | 896 (L'.EAbs ("y", (L'.TFfi ("Basis", "int"), loc), |
897 (L'.TFfi ("Basis", "bool"), loc), | 897 (L'.TFfi ("Basis", "bool"), loc), |
898 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), | 898 (L'.EBinop (L'.Int, "==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), |
899 fm) | 899 fm) |
900 | L.EFfi ("Basis", "eq_float") => | 900 | L.EFfi ("Basis", "eq_float") => |
901 ((L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), | 901 ((L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), |
902 (L'.TFun ((L'.TFfi ("Basis", "float"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 902 (L'.TFun ((L'.TFfi ("Basis", "float"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
903 (L'.EAbs ("y", (L'.TFfi ("Basis", "float"), loc), | 903 (L'.EAbs ("y", (L'.TFfi ("Basis", "float"), loc), |
904 (L'.TFfi ("Basis", "bool"), loc), | 904 (L'.TFfi ("Basis", "bool"), loc), |
905 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), | 905 (L'.EBinop (L'.NotInt, "==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), |
906 fm) | 906 fm) |
907 | L.EFfi ("Basis", "eq_bool") => | 907 | L.EFfi ("Basis", "eq_bool") => |
908 ((L'.EAbs ("x", (L'.TFfi ("Basis", "bool"), loc), | 908 ((L'.EAbs ("x", (L'.TFfi ("Basis", "bool"), loc), |
909 (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 909 (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
910 (L'.EAbs ("y", (L'.TFfi ("Basis", "bool"), loc), | 910 (L'.EAbs ("y", (L'.TFfi ("Basis", "bool"), loc), |
911 (L'.TFfi ("Basis", "bool"), loc), | 911 (L'.TFfi ("Basis", "bool"), loc), |
912 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), | 912 (L'.EBinop (L'.NotInt, "==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), |
913 fm) | 913 fm) |
914 | L.EFfi ("Basis", "eq_string") => | 914 | L.EFfi ("Basis", "eq_string") => |
915 ((L'.EAbs ("x", (L'.TFfi ("Basis", "string"), loc), | 915 ((L'.EAbs ("x", (L'.TFfi ("Basis", "string"), loc), |
916 (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 916 (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
917 (L'.EAbs ("y", (L'.TFfi ("Basis", "string"), loc), | 917 (L'.EAbs ("y", (L'.TFfi ("Basis", "string"), loc), |
918 (L'.TFfi ("Basis", "bool"), loc), | 918 (L'.TFfi ("Basis", "bool"), loc), |
919 (L'.EBinop ("!strcmp", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), | 919 (L'.EBinop (L'.NotInt, "!strcmp", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), |
920 fm) | 920 fm) |
921 | L.EFfi ("Basis", "eq_char") => | 921 | L.EFfi ("Basis", "eq_char") => |
922 ((L'.EAbs ("x", (L'.TFfi ("Basis", "char"), loc), | 922 ((L'.EAbs ("x", (L'.TFfi ("Basis", "char"), loc), |
923 (L'.TFun ((L'.TFfi ("Basis", "char"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 923 (L'.TFun ((L'.TFfi ("Basis", "char"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
924 (L'.EAbs ("y", (L'.TFfi ("Basis", "char"), loc), | 924 (L'.EAbs ("y", (L'.TFfi ("Basis", "char"), loc), |
925 (L'.TFfi ("Basis", "bool"), loc), | 925 (L'.TFfi ("Basis", "bool"), loc), |
926 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), | 926 (L'.EBinop (L'.NotInt, "==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), |
927 fm) | 927 fm) |
928 | L.EFfi ("Basis", "eq_time") => | 928 | L.EFfi ("Basis", "eq_time") => |
929 ((L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), | 929 ((L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), |
930 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 930 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
931 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc), | 931 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc), |
932 (L'.TFfi ("Basis", "bool"), loc), | 932 (L'.TFfi ("Basis", "bool"), loc), |
933 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), | 933 (L'.EBinop (L'.NotInt, "==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc), |
934 fm) | 934 fm) |
935 | 935 |
936 | L.ECApp ((L.EFfi ("Basis", "mkEq"), _), t) => | 936 | L.ECApp ((L.EFfi ("Basis", "mkEq"), _), t) => |
937 let | 937 let |
938 val t = monoType env t | 938 val t = monoType env t |
997 fun intBin s = | 997 fun intBin s = |
998 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), | 998 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), |
999 (L'.TFun ((L'.TFfi ("Basis", "int"), loc), (L'.TFfi ("Basis", "int"), loc)), loc), | 999 (L'.TFun ((L'.TFfi ("Basis", "int"), loc), (L'.TFfi ("Basis", "int"), loc)), loc), |
1000 (L'.EAbs ("y", (L'.TFfi ("Basis", "int"), loc), | 1000 (L'.EAbs ("y", (L'.TFfi ("Basis", "int"), loc), |
1001 (L'.TFfi ("Basis", "int"), loc), | 1001 (L'.TFfi ("Basis", "int"), loc), |
1002 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) | 1002 (L'.EBinop (L'.Int, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) |
1003 in | 1003 in |
1004 numEx ((L'.TFfi ("Basis", "int"), loc), | 1004 numEx ((L'.TFfi ("Basis", "int"), loc), |
1005 Prim.Int (Int64.fromInt 0), | 1005 Prim.Int (Int64.fromInt 0), |
1006 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), | 1006 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), |
1007 (L'.TFfi ("Basis", "int"), loc), | 1007 (L'.TFfi ("Basis", "int"), loc), |
1017 fun floatBin s = | 1017 fun floatBin s = |
1018 (L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), | 1018 (L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), |
1019 (L'.TFun ((L'.TFfi ("Basis", "float"), loc), (L'.TFfi ("Basis", "float"), loc)), loc), | 1019 (L'.TFun ((L'.TFfi ("Basis", "float"), loc), (L'.TFfi ("Basis", "float"), loc)), loc), |
1020 (L'.EAbs ("y", (L'.TFfi ("Basis", "float"), loc), | 1020 (L'.EAbs ("y", (L'.TFfi ("Basis", "float"), loc), |
1021 (L'.TFfi ("Basis", "float"), loc), | 1021 (L'.TFfi ("Basis", "float"), loc), |
1022 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) | 1022 (L'.EBinop (L'.NotInt, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) |
1023 in | 1023 in |
1024 numEx ((L'.TFfi ("Basis", "float"), loc), | 1024 numEx ((L'.TFfi ("Basis", "float"), loc), |
1025 Prim.Float 0.0, | 1025 Prim.Float 0.0, |
1026 (L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), | 1026 (L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), |
1027 (L'.TFfi ("Basis", "float"), loc), | 1027 (L'.TFfi ("Basis", "float"), loc), |
1084 fun intBin s = | 1084 fun intBin s = |
1085 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), | 1085 (L'.EAbs ("x", (L'.TFfi ("Basis", "int"), loc), |
1086 (L'.TFun ((L'.TFfi ("Basis", "int"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 1086 (L'.TFun ((L'.TFfi ("Basis", "int"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
1087 (L'.EAbs ("y", (L'.TFfi ("Basis", "int"), loc), | 1087 (L'.EAbs ("y", (L'.TFfi ("Basis", "int"), loc), |
1088 (L'.TFfi ("Basis", "bool"), loc), | 1088 (L'.TFfi ("Basis", "bool"), loc), |
1089 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) | 1089 (L'.EBinop (L'.Int, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) |
1090 in | 1090 in |
1091 ordEx ((L'.TFfi ("Basis", "int"), loc), | 1091 ordEx ((L'.TFfi ("Basis", "int"), loc), |
1092 intBin "<", | 1092 intBin "<", |
1093 intBin "<=") | 1093 intBin "<=") |
1094 end | 1094 end |
1097 fun floatBin s = | 1097 fun floatBin s = |
1098 (L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), | 1098 (L'.EAbs ("x", (L'.TFfi ("Basis", "float"), loc), |
1099 (L'.TFun ((L'.TFfi ("Basis", "float"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 1099 (L'.TFun ((L'.TFfi ("Basis", "float"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
1100 (L'.EAbs ("y", (L'.TFfi ("Basis", "float"), loc), | 1100 (L'.EAbs ("y", (L'.TFfi ("Basis", "float"), loc), |
1101 (L'.TFfi ("Basis", "bool"), loc), | 1101 (L'.TFfi ("Basis", "bool"), loc), |
1102 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) | 1102 (L'.EBinop (L'.NotInt, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) |
1103 in | 1103 in |
1104 ordEx ((L'.TFfi ("Basis", "float"), loc), | 1104 ordEx ((L'.TFfi ("Basis", "float"), loc), |
1105 floatBin "<", | 1105 floatBin "<", |
1106 floatBin "<=") | 1106 floatBin "<=") |
1107 end | 1107 end |
1110 fun boolBin s = | 1110 fun boolBin s = |
1111 (L'.EAbs ("x", (L'.TFfi ("Basis", "bool"), loc), | 1111 (L'.EAbs ("x", (L'.TFfi ("Basis", "bool"), loc), |
1112 (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 1112 (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
1113 (L'.EAbs ("y", (L'.TFfi ("Basis", "bool"), loc), | 1113 (L'.EAbs ("y", (L'.TFfi ("Basis", "bool"), loc), |
1114 (L'.TFfi ("Basis", "bool"), loc), | 1114 (L'.TFfi ("Basis", "bool"), loc), |
1115 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) | 1115 (L'.EBinop (L'.NotInt, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) |
1116 in | 1116 in |
1117 ordEx ((L'.TFfi ("Basis", "bool"), loc), | 1117 ordEx ((L'.TFfi ("Basis", "bool"), loc), |
1118 boolBin "<", | 1118 boolBin "<", |
1119 boolBin "<=") | 1119 boolBin "<=") |
1120 end | 1120 end |
1123 fun boolBin s = | 1123 fun boolBin s = |
1124 (L'.EAbs ("x", (L'.TFfi ("Basis", "string"), loc), | 1124 (L'.EAbs ("x", (L'.TFfi ("Basis", "string"), loc), |
1125 (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 1125 (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
1126 (L'.EAbs ("y", (L'.TFfi ("Basis", "string"), loc), | 1126 (L'.EAbs ("y", (L'.TFfi ("Basis", "string"), loc), |
1127 (L'.TFfi ("Basis", "bool"), loc), | 1127 (L'.TFfi ("Basis", "bool"), loc), |
1128 (L'.EBinop (s, | 1128 (L'.EBinop (L'.NotInt, s, |
1129 (L'.EBinop ("strcmp", | 1129 (L'.EBinop (L'.NotInt, "strcmp", |
1130 (L'.ERel 1, loc), | 1130 (L'.ERel 1, loc), |
1131 (L'.ERel 0, loc)), loc), | 1131 (L'.ERel 0, loc)), loc), |
1132 (L'.EPrim (Prim.Int (Int64.fromInt 0)), loc)), loc)), loc)), loc) | 1132 (L'.EPrim (Prim.Int (Int64.fromInt 0)), loc)), loc)), loc)), loc) |
1133 in | 1133 in |
1134 ordEx ((L'.TFfi ("Basis", "string"), loc), | 1134 ordEx ((L'.TFfi ("Basis", "string"), loc), |
1140 fun charBin s = | 1140 fun charBin s = |
1141 (L'.EAbs ("x", (L'.TFfi ("Basis", "char"), loc), | 1141 (L'.EAbs ("x", (L'.TFfi ("Basis", "char"), loc), |
1142 (L'.TFun ((L'.TFfi ("Basis", "char"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 1142 (L'.TFun ((L'.TFfi ("Basis", "char"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
1143 (L'.EAbs ("y", (L'.TFfi ("Basis", "char"), loc), | 1143 (L'.EAbs ("y", (L'.TFfi ("Basis", "char"), loc), |
1144 (L'.TFfi ("Basis", "bool"), loc), | 1144 (L'.TFfi ("Basis", "bool"), loc), |
1145 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) | 1145 (L'.EBinop (L'.NotInt, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) |
1146 in | 1146 in |
1147 ordEx ((L'.TFfi ("Basis", "char"), loc), | 1147 ordEx ((L'.TFfi ("Basis", "char"), loc), |
1148 charBin "<", | 1148 charBin "<", |
1149 charBin "<=") | 1149 charBin "<=") |
1150 end | 1150 end |
1153 fun boolBin s = | 1153 fun boolBin s = |
1154 (L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), | 1154 (L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), |
1155 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), | 1155 (L'.TFun ((L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc), |
1156 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc), | 1156 (L'.EAbs ("y", (L'.TFfi ("Basis", "time"), loc), |
1157 (L'.TFfi ("Basis", "bool"), loc), | 1157 (L'.TFfi ("Basis", "bool"), loc), |
1158 (L'.EBinop (s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) | 1158 (L'.EBinop (L'.NotInt, s, (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc) |
1159 in | 1159 in |
1160 ordEx ((L'.TFfi ("Basis", "time"), loc), | 1160 ordEx ((L'.TFfi ("Basis", "time"), loc), |
1161 boolBin "<", | 1161 boolBin "<", |
1162 boolBin "<=") | 1162 boolBin "<=") |
1163 end | 1163 end |