From a80c5278e09b17e56a8ae22a06025ba0a2848793 Mon Sep 17 00:00:00 2001 From: Boris Smilga Date: Sun, 23 Feb 2014 11:58:15 +0400 Subject: [PATCH 1/2] Trivial adaptation to non-Linux environments lacking mremap(2). --- src/mtagmap.lisp | 14 +++++++++++++- src/struct.lisp | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mtagmap.lisp b/src/mtagmap.lisp index 5107258..85733ea 100644 --- a/src/mtagmap.lisp +++ b/src/mtagmap.lisp @@ -136,7 +136,11 @@ (mtagmap-fd mtagmap) fd (mtagmap-ptr mtagmap) ptr (mtagmap-len mtagmap) bytes - fd nil ptr nil)) + fd nil ptr nil) + #-linux + (setf + (mtagmap-protection mtagmap) protection + (mtagmap-sharing mtagmap) sharing) ) (when ptr (osicat-posix:munmap ptr bytes))))) (when fd @@ -151,7 +155,15 @@ (osicat-posix:ftruncate (mtagmap-fd mtagmap) new-len)) (remap () (setf (mtagmap-ptr mtagmap) + #+linux (osicat-posix:mremap (mtagmap-ptr mtagmap) len new-len osicat-posix:MREMAP-MAYMOVE) + #-linux + (let ((ptr (mtagmap-ptr mtagmap)) + (fd (mtagmap-fd mtagmap)) + (protection (mtagmap-protection mtagmap)) + (sharing (mtagmap-sharing mtagmap))) + (assert (zerop (osicat-posix:munmap ptr len))) + (osicat-posix:mmap (cffi:null-pointer) new-len protection sharing fd 0)) len new-len))) (let (done) (unwind-protect diff --git a/src/struct.lisp b/src/struct.lisp index 9a282f6..7bc5a5c 100644 --- a/src/struct.lisp +++ b/src/struct.lisp @@ -81,6 +81,9 @@ Remains constant across remappings of the memory mapped regions to different off (ptr (cffi:null-pointer) :type machine-pointer) (len 0 :type mindex) + #-linux protection + #-linux sharing + class layout instantiator From 480ffea696c609353cefdb450bbdf838b539ce53 Mon Sep 17 00:00:00 2001 From: Boris Smilga Date: Sun, 23 Feb 2014 11:59:28 +0400 Subject: [PATCH 2/2] Fixed: STORE-ALL-SYMBOLS-TEST was failing when trying to iterate over hashtable as over a list. --- t/symbol.lisp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/symbol.lisp b/t/symbol.lisp index 413f9df..ac32789 100644 --- a/t/symbol.lisp +++ b/t/symbol.lisp @@ -28,11 +28,11 @@ (setf (gethash sym table) mptr)))) (do-all-syms (sym) (add sym (lisp-object-to-mptr sym))) - (iter (for (sym mptr) in table) + (iter (for (sym mptr) in-hashtable table) (stefil:is (= mptr (lisp-object-to-mptr sym)))) (do-all-syms (sym) (stefil:is (eq sym (mptr-to-lisp-object (lisp-object-to-mptr sym))))) - (iter (for (sym mptr) in table) + (iter (for (sym mptr) in-hashtable table) (stefil:is (eq sym (mptr-to-lisp-object mptr)))) (do-all-syms (sym) (add sym (lisp-object-to-mptr sym))))))))