summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ziv Scully <ziv@mit.edu>2015-09-27 17:24:57 -0400
committerGravatar Ziv Scully <ziv@mit.edu>2015-09-27 17:24:57 -0400
commit5d00499cabd7c0ddf5eb9e78c883615cb918197e (patch)
tree31193f03ce0d94ed87a66287afa1e4f70bc91cb3 /src
parent150e1a3cdc0cfae2f583f7d0185b90d5ee82a018 (diff)
Fix effectfulness registration toy cache.
Diffstat (limited to 'src')
-rw-r--r--src/sqlcache.sml7
-rw-r--r--src/toy_cache.sml8
2 files changed, 13 insertions, 2 deletions
diff --git a/src/sqlcache.sml b/src/sqlcache.sml
index e2cc01d7..1518e994 100644
--- a/src/sqlcache.sml
+++ b/src/sqlcache.sml
@@ -41,6 +41,8 @@ val ffiEffectful =
"urlifyBool_w",
"urlifyChannel_w"]
in
+ (* ASK: nicer way than using [Settings.addEffectful] for each Sqlcache
+ function? Right now they're all always effectful. *)
fn (m, f) => Settings.isEffectful (m, f)
andalso not (m = "Basis" andalso SS.member (okayWrites, f))
end
@@ -807,12 +809,15 @@ val expOfSubexp =
fn Pure f => f ()
| Impure e => e
+(* TODO: pick a number. *)
+val sizeWorthCaching = 5
+
fun makeCache (env, exp', index) =
case typOfExp' env exp' of
NONE => NONE
| SOME (TFun _, _) => NONE
| SOME typ =>
- if expSize (exp', dummyLoc) < 5 (* TODO: pick a number. *)
+ if expSize (exp', dummyLoc) < sizeWorthCaching
then NONE
else case List.foldr (fn ((_, _), NONE) => NONE
| ((n, typ), SOME args) =>
diff --git a/src/toy_cache.sml b/src/toy_cache.sml
index 126768b6..34a7a26f 100644
--- a/src/toy_cache.sml
+++ b/src/toy_cache.sml
@@ -13,7 +13,13 @@ val optionStringTyp = (TOption stringTyp, dummyLoc)
fun withTyp typ = map (fn exp => (exp, typ))
fun ffiAppCache' (func, index, argTyps) =
- EFfiApp ("Sqlcache", func ^ Int.toString index, argTyps)
+ let
+ val m = "Sqlcache"
+ val f = func ^ Int.toString index
+ in
+ Settings.addEffectful (m, f);
+ EFfiApp (m, f, argTyps)
+ end
fun check (index, keys) =
ffiAppCache' ("check", index, withTyp stringTyp keys)