summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-23 12:25:34 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-23 12:25:34 -0500
commit1466bbaa78fe224dd227fb50b2a6a21bcd10a74b (patch)
tree4316dc52416e5099c11db0f6214699bdb950019e
parentff717ba5c13390b4c5412ee968505193f0f7daba (diff)
Stop skipping Especialization of generated functions; fix Compiler.parseUrp; expose uw_really_write(); allow more NULL arguments to uw_register_transactional()
-rw-r--r--include/urweb.h1
-rw-r--r--src/c/urweb.c12
-rw-r--r--src/compiler.sml4
-rw-r--r--src/especialize.sml9
4 files changed, 15 insertions, 11 deletions
diff --git a/include/urweb.h b/include/urweb.h
index 8321aaf2..31b0da5d 100644
--- a/include/urweb.h
+++ b/include/urweb.h
@@ -6,6 +6,7 @@
#include "types.h"
int uw_really_send(int sock, const void *buf, ssize_t len);
+int uw_really_write(int fd, const void *buf, size_t len);
extern uw_unit uw_unit_v;
diff --git a/src/c/urweb.c b/src/c/urweb.c
index f852ddb8..ef159333 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -2773,11 +2773,13 @@ void uw_commit(uw_context ctx) {
for (i = 0; i < ctx->used_transactionals; ++i)
if (ctx->transactionals[i].rollback != NULL)
- ctx->transactionals[i].commit(ctx->transactionals[i].data);
+ if (ctx->transactionals[i].commit)
+ ctx->transactionals[i].commit(ctx->transactionals[i].data);
for (i = 0; i < ctx->used_transactionals; ++i)
if (ctx->transactionals[i].rollback == NULL)
- ctx->transactionals[i].commit(ctx->transactionals[i].data);
+ if (ctx->transactionals[i].commit)
+ ctx->transactionals[i].commit(ctx->transactionals[i].data);
if (uw_db_commit(ctx))
uw_error(ctx, FATAL, "Error running SQL COMMIT");
@@ -2795,7 +2797,8 @@ void uw_commit(uw_context ctx) {
release_client(ctx->client);
for (i = 0; i < ctx->used_transactionals; ++i)
- ctx->transactionals[i].free(ctx->transactionals[i].data);
+ if (ctx->transactionals[i].free)
+ ctx->transactionals[i].free(ctx->transactionals[i].data);
// Splice script data into appropriate part of page
if (ctx->returning_indirectly || ctx->script_header[0] == 0) {
@@ -2855,9 +2858,6 @@ int uw_rollback(uw_context ctx) {
void uw_register_transactional(uw_context ctx, void *data, uw_callback commit, uw_callback rollback,
uw_callback free) {
- if (commit == NULL)
- uw_error(ctx, FATAL, "uw_register_transactional: NULL commit callback");
-
if (ctx->used_transactionals >= ctx->n_transactionals) {
ctx->transactionals = realloc(ctx->transactionals, ctx->used_transactionals+1);
++ctx->n_transactionals;
diff --git a/src/compiler.sml b/src/compiler.sml
index 95ad80ad..88046256 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -596,12 +596,12 @@ fun parseUrp' accLibs fname =
fun p_job' {Job = j, Libs = _ : string list} = p_job j
val parseUrp = {
- func = #Job o parseUrp' false,
+ func = #Job o parseUrp' true,
print = p_job
}
val parseUrp' = {
- func = parseUrp' true,
+ func = parseUrp' false,
print = p_job'
}
diff --git a/src/especialize.sml b/src/especialize.sml
index dfe36ad0..acabe973 100644
--- a/src/especialize.sml
+++ b/src/especialize.sml
@@ -324,10 +324,13 @@ fun specialize' (funcs, specialized) file =
| _ => false) fxs'
orelse (IS.numItems fvs >= length fxs
andalso IS.exists (fn n => functionInside (#2 (List.nth (env, n)))) fvs) then
- default ()
+ ((*Print.prefaces "No" [("name", Print.PD.string name),
+ ("fxs'",
+ Print.p_list (CorePrint.p_exp CoreEnv.empty) fxs')];*)
+ default ())
else
case (KM.find (args, fxs'),
- SS.member (!mayNotSpec, name) orelse IS.member (#specialized st, f)) of
+ SS.member (!mayNotSpec, name) (*orelse IS.member (#specialized st, f)*)) of
(SOME f', _) =>
let
val e = (ENamed f', loc)
@@ -340,7 +343,7 @@ fun specialize' (funcs, specialized) file =
[("e'", CorePrint.p_exp CoreEnv.empty e)];*)
(e, st)
end
- | (_, true) => ((*Print.prefaces ("No(" ^ name ^ ")")
+ | (_, true) => ((*Print.prefaces ("No!(" ^ name ^ ")")
[("fxs'",
Print.p_list (CorePrint.p_exp CoreEnv.empty) fxs')];*)
default ())