[Ur] Collecting Ur/Web examples
Adam Chlipala
adamc at csail.mit.edu
Sun May 18 19:01:41 EDT 2014
Thanks for the patch! I think your change below isn't enough to avoid
all allocation of non-word-aligned addresses for uses that may require
word alignment. In particular, the patch only changes the code that
runs during process initialization. I've pushed a derived patch that
covers a few more cases, and we can hunt down any that remain on demand,
as folks stumble across them in testing. ;)
On 05/07/2014 11:52 PM, Evan Danaher wrote:
> diff -purN urweb-20131231/src/c/urweb.c urweb-20131231-mine/src/c/urweb.c
> --- urweb-20131231/src/c/urweb.c 2013-12-31 07:49:04.000000000 -0800
> +++ urweb-20131231-mine/src/c/urweb.c 2014-03-26 15:21:42.121568001 -0700
> @@ -1257,12 +1257,13 @@ void *uw_malloc(uw_context ctx, size_t l
> void *result;
>
> if (ctx->amInitializing) {
> - result = malloc(len);
> + int error = posix_memalign(&result, 4, len);
> + //result = malloc(len);
>
> - if (result)
> + if (!error)
> return result;
> else
> - uw_error(ctx, FATAL, "uw_malloc: malloc() returns 0");
> + uw_error(ctx, FATAL, "uw_malloc: posix_memalign() returns %d", error);
> } else {
> uw_check_heap(ctx, len);
More information about the Ur
mailing list