summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Patrick Hurst <phurst@mit.edu>2014-02-14 04:00:03 -0500
committerGravatar Patrick Hurst <phurst@mit.edu>2014-02-14 04:00:03 -0500
commit62a18826a55b49f8f3a371a5dca09e203b9e6d2a (patch)
tree33bd2d11b2a2be4e188ac79abcdbfa4df2e2d199
parent1f074cea18228f4100972f7b51f68cd12db15f60 (diff)
parent5537bc4338b4a576b225810c5cca34d3ca7de87f (diff)
Merge in upstream
-rw-r--r--demo/more/orm1.ur2
-rw-r--r--doc/manual.tex1
-rw-r--r--src/c/Makefile.am2
-rw-r--r--src/c/urweb.c2
-rw-r--r--src/compiler.sml1
-rw-r--r--src/mono_reduce.sml9
-rw-r--r--src/settings.sig3
-rw-r--r--src/settings.sml4
8 files changed, 17 insertions, 7 deletions
diff --git a/demo/more/orm1.ur b/demo/more/orm1.ur
index b5ba29ac..989741dd 100644
--- a/demo/more/orm1.ur
+++ b/demo/more/orm1.ur
@@ -40,7 +40,7 @@ fun action () =
| Some r => <xml>{[r.B]}</xml>}
</li></xml>) lsS}
</body></xml>
-
+
fun main () = return <xml><body>
<form><submit action={action}/></form>
</body></xml>
diff --git a/doc/manual.tex b/doc/manual.tex
index 42ab7f70..457df39b 100644
--- a/doc/manual.tex
+++ b/doc/manual.tex
@@ -171,6 +171,7 @@ Here is the complete list of directive forms. ``FFI'' stands for ``foreign func
\item \texttt{linker CMD} sets \texttt{CMD} as the command line prefix to use for linking C object files. The command line will be completed with a space-separated list of \texttt{.o} and \texttt{.a} files, \texttt{-L} and \texttt{-l} flags, and finally with a \texttt{-o} flag to set the location where the executable should be written.
\item \texttt{minHeap NUMBYTES} sets the initial size for thread-local heaps used in handling requests. These heaps grow automatically as needed (up to any maximum set with \texttt{limit}), but each regrow requires restarting the request handling process.
\item \texttt{monoInline TREESIZE} sets how many nodes the AST of a function definition may have before the optimizer stops trying hard to inline calls to that function. (This is one of two options for one of two intermediate languages within the compiler.)
+\item \texttt{neverInline PATH} requests that no call to the referenced function be inlined. Section \ref{structure} explains how functions are assigned path strings.
\item \texttt{noMangleSql} avoids adding a \texttt{uw\_} prefix in front of each identifier in SQL. With this experimental feature, the burden is on the programmer to avoid naming tables or columns after SQL keywords!
\item \texttt{noXsrfProtection URIPREFIX} turns off automatic cross-site request forgery protection for the page handler identified by the given URI prefix. This will avoid checking cryptographic signatures on cookies, which is generally a reasonable idea for some pages, such as login pages that are going to discard all old cookie values, anyway.
\item \texttt{onError Module.var} changes the handling of fatal application errors. Instead of displaying a default, ugly error 500 page, the error page will be generated by calling function \texttt{Module.var} on a piece of XML representing the error message. The error handler should have type $\mt{xbody} \to \mt{transaction} \; \mt{page}$. Note that the error handler \emph{cannot} be in the application's main module, since that would register it as explicitly callable via URLs.
diff --git a/src/c/Makefile.am b/src/c/Makefile.am
index 8ed374f6..d117d018 100644
--- a/src/c/Makefile.am
+++ b/src/c/Makefile.am
@@ -7,7 +7,7 @@ liburweb_fastcgi_la_SOURCES = fastcgi.c fastcgi.h
liburweb_static_la_SOURCES = static.c
AM_CPPFLAGS = -I$(srcdir)/../../include/urweb $(OPENSSL_INCLUDES)
-AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations $(PTHREAD_CFLAGS)
+AM_CFLAGS = -Wimplicit -Wall -Werror -Wno-format-security -Wno-deprecated-declarations -U_FORTIFY_SOURCE $(PTHREAD_CFLAGS)
liburweb_la_LDFLAGS = $(AM_LDFLAGS) $(OPENSSL_LDFLAGS)
liburweb_la_LIBADD = $(PTHREAD_LIBS) -lm $(OPENSSL_LIBS)
liburweb_http_la_LIBADD = liburweb.la
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 4eb542df..7ff8a262 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -3933,7 +3933,7 @@ uw_Basis_int uw_Basis_toSeconds(uw_context ctx, uw_Basis_time tm) {
uw_Basis_time uw_Basis_fromDatetime(uw_context ctx, uw_Basis_int year, uw_Basis_int month, uw_Basis_int day, uw_Basis_int hour, uw_Basis_int minute, uw_Basis_int second) {
struct tm tm = { .tm_year = year - 1900, .tm_mon = month, .tm_mday = day,
.tm_hour = hour, .tm_min = minute, .tm_sec = second };
- uw_Basis_time r = { timegm(&tm) };
+ uw_Basis_time r = { timelocal(&tm) };
return r;
}
diff --git a/src/compiler.sml b/src/compiler.sml
index 21ae903f..cc4e33c5 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -869,6 +869,7 @@ fun parseUrp' accLibs fname =
NONE => ErrorMsg.error ("invalid mono inline level '" ^ arg ^ "'")
| SOME n => Settings.setMonoInline n)
| "alwaysInline" => Settings.addAlwaysInline arg
+ | "neverInline" => Settings.addNeverInline arg
| "noXsrfProtection" => Settings.addNoXsrfProtection arg
| "timeFormat" => Settings.setTimeFormat arg
| "noMangleSql" => Settings.setMangleSql false
diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml
index 846a878b..c92ce5aa 100644
--- a/src/mono_reduce.sml
+++ b/src/mono_reduce.sml
@@ -395,10 +395,11 @@ fun reduce (file : file) =
fun mayInline (n, e, t, s) =
case IM.find (uses, n) of
NONE => false
- | SOME count => count <= 1
- orelse size e <= Settings.getMonoInline ()
- orelse functionInside t
- orelse Settings.checkAlwaysInline s
+ | SOME count => not (Settings.checkNeverInline s)
+ andalso (count <= 1
+ orelse size e <= Settings.getMonoInline ()
+ orelse functionInside t
+ orelse Settings.checkAlwaysInline s)
fun summarize d (e, _) =
let
diff --git a/src/settings.sig b/src/settings.sig
index a7a41447..20dd00c2 100644
--- a/src/settings.sig
+++ b/src/settings.sig
@@ -252,6 +252,9 @@ signature SETTINGS = sig
val addAlwaysInline : string -> unit
val checkAlwaysInline : string -> bool
+ val addNeverInline : string -> unit
+ val checkNeverInline : string -> bool
+
val addNoXsrfProtection : string -> unit
val checkNoXsrfProtection : string -> bool
diff --git a/src/settings.sml b/src/settings.sml
index 93f54427..020ca5a4 100644
--- a/src/settings.sml
+++ b/src/settings.sml
@@ -688,6 +688,10 @@ val alwaysInline = ref SS.empty
fun addAlwaysInline s = alwaysInline := SS.add (!alwaysInline, s)
fun checkAlwaysInline s = SS.member (!alwaysInline, s)
+val neverInline = ref SS.empty
+fun addNeverInline s = neverInline := SS.add (!neverInline, s)
+fun checkNeverInline s = SS.member (!neverInline, s)
+
val noXsrfProtection = ref SS.empty
fun addNoXsrfProtection s = noXsrfProtection := SS.add (!noXsrfProtection, s)
fun checkNoXsrfProtection s = SS.member (!noXsrfProtection, s)