… | |
… | |
5 | #include "libcoro/coro.c" |
5 | #include "libcoro/coro.c" |
6 | |
6 | |
7 | #ifdef HAVE_MMAP |
7 | #ifdef HAVE_MMAP |
8 | # include <unistd.h> |
8 | # include <unistd.h> |
9 | # include <sys/mman.h> |
9 | # include <sys/mman.h> |
|
|
10 | # ifndef MAP_ANON |
|
|
11 | # ifdef MAP_ANONYMOUS |
|
|
12 | # define MAP_ANON MAP_ANONYMOUS |
|
|
13 | # else |
|
|
14 | # undef HAVE_MMAP |
|
|
15 | # endif |
|
|
16 | # endif |
10 | #endif |
17 | #endif |
11 | |
18 | |
12 | #define MAY_FLUSH /* increases codesize */ |
19 | #define MAY_FLUSH /* increases codesize */ |
13 | |
20 | |
14 | /* perl-related */ |
21 | /* perl-related */ |
… | |
… | |
545 | stack->refcnt = 1; |
552 | stack->refcnt = 1; |
546 | stack->usecnt = 1; |
553 | stack->usecnt = 1; |
547 | stack->gencnt = ctx->gencnt = 0; |
554 | stack->gencnt = ctx->gencnt = 0; |
548 | if (alloc) |
555 | if (alloc) |
549 | { |
556 | { |
550 | #ifdef HAVE_MMAP |
557 | #ifdef HAVE_MMAP |
551 | stack->ssize = 128 * 1024 * sizeof (long); /* mmap should do allocate-on-use */ |
558 | stack->ssize = 128 * 1024 * sizeof (long); /* mmap should do allocate-on-write */ |
552 | stack->sptr = mmap (0, stack->ssize, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 0, 0); |
559 | stack->sptr = mmap (0, stack->ssize, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 0, 0); |
553 | if (stack->sptr == (void *)-1) |
560 | if (stack->sptr == (void *)-1) |
554 | #endif |
561 | #endif |
555 | { |
562 | { |
556 | /*FIXME*//*D*//* reasonable stack size! */ |
563 | /*FIXME*//*D*//* reasonable stack size! */ |