1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 22:10:21 +02:00

Fix default code allocator in Lightning

* libguile/lightning/lib/lightning.c (_jit_emit): The default code
  allocator will simply mmap a code buffer, try to emit into that
  buffer, and if it fails, try again with a larger buffer.  However the
  buffer size starts at 0, for some reason.  Why?  I can't see the
  reason.  Change the default to 4096.  In the future we will need to
  implement our own allocator anyway so that we can pack multiple JIT
  runs in one page.
This commit is contained in:
Andy Wingo 2018-08-20 08:59:19 +02:00
parent dca1e9d7bd
commit 4a9de64f81

View file

@ -2070,6 +2070,9 @@ _jit_emit(jit_state_t *_jit)
#if defined(__sgi)
mmap_fd = open("/dev/zero", O_RDWR);
#endif
if (_jit->code.length == 0)
_jit->code.length = 4096;
_jit->code.ptr = mmap(NULL, _jit->code.length,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, mmap_fd, 0);