guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 05/07: Fix default code allocator in Lightning


From: Andy Wingo
Subject: [Guile-commits] 05/07: Fix default code allocator in Lightning
Date: Mon, 20 Aug 2018 06:08:28 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit 4a9de64f81db8377b672c5a20773b3330fc0b0f3
Author: Andy Wingo <address@hidden>
Date:   Mon Aug 20 08:59:19 2018 +0200

    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.
---
 libguile/lightning/lib/lightning.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libguile/lightning/lib/lightning.c 
b/libguile/lightning/lib/lightning.c
index 613c19f..5217466 100644
--- a/libguile/lightning/lib/lightning.c
+++ b/libguile/lightning/lib/lightning.c
@@ -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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]