mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
passing correctly adjusted size to munmap when using mmapped heaps
This commit is contained in:
parent
00e30bfcaa
commit
9a052ddb7c
10 changed files with 21 additions and 32 deletions
|
@ -5,6 +5,7 @@ syntax: glob
|
||||||
*.o
|
*.o
|
||||||
*.so
|
*.so
|
||||||
*.dylib
|
*.dylib
|
||||||
|
*.class
|
||||||
*.dSYM
|
*.dSYM
|
||||||
*.orig
|
*.orig
|
||||||
.hg
|
.hg
|
||||||
|
|
2
AUTHORS
2
AUTHORS
|
@ -16,7 +16,7 @@ Thanks to the following people for patches:
|
||||||
* John Samsa
|
* John Samsa
|
||||||
* Lars J Aas
|
* Lars J Aas
|
||||||
* Lorenzo Campedelli
|
* Lorenzo Campedelli
|
||||||
* sladegen
|
* Michal Kowalski (sladegen)
|
||||||
|
|
||||||
If you would prefer not to be listed, or are one of the users listed
|
If you would prefer not to be listed, or are one of the users listed
|
||||||
without a full name, please contact me. If you've made a contribution
|
without a full name, please contact me. If you've made a contribution
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -213,3 +213,10 @@ dist: cleaner
|
||||||
for f in `hg manifest`; do mkdir -p chibi-scheme-`cat VERSION`/`dirname $$f`; ln -s `pwd`/$$f chibi-scheme-`cat VERSION`/$$f; done
|
for f in `hg manifest`; do mkdir -p chibi-scheme-`cat VERSION`/`dirname $$f`; ln -s `pwd`/$$f chibi-scheme-`cat VERSION`/$$f; done
|
||||||
tar cphzvf chibi-scheme-`cat VERSION`.tgz chibi-scheme-`cat VERSION`
|
tar cphzvf chibi-scheme-`cat VERSION`.tgz chibi-scheme-`cat VERSION`
|
||||||
rm -rf chibi-scheme-`cat VERSION`
|
rm -rf chibi-scheme-`cat VERSION`
|
||||||
|
|
||||||
|
mips-dist: cleaner
|
||||||
|
rm -f chibi-scheme-`date +%Y%m%d`-`hg tags|head -1|sed -n 's/.* \([0-9]*\):.*/\1/p'`.tgz
|
||||||
|
mkdir chibi-scheme-`date +%Y%m%d`-`hg tags|head -1|sed -n 's/.* \([0-9]*\):.*/\1/p'`
|
||||||
|
for f in `hg manifest`; do mkdir -p chibi-scheme-`date +%Y%m%d`-`hg tags|head -1|sed -n 's/.* \([0-9]*\):.*/\1/p'`/`dirname $$f`; ln -s `pwd`/$$f chibi-scheme-`date +%Y%m%d`-`hg tags|head -1|sed -n 's/.* \([0-9]*\):.*/\1/p'`/$$f; done
|
||||||
|
tar cphzvf chibi-scheme-`date +%Y%m%d`-`hg tags|head -1|sed -n 's/.* \([0-9]*\):.*/\1/p'`.tgz chibi-scheme-`date +%Y%m%d`-`hg tags|head -1|sed -n 's/.* \([0-9]*\):.*/\1/p'`
|
||||||
|
rm -rf chibi-scheme-`date +%Y%m%d`-`hg tags|head -1|sed -n 's/.* \([0-9]*\):.*/\1/p'`
|
||||||
|
|
8
gc.c
8
gc.c
|
@ -8,16 +8,8 @@
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SEXP_64_BIT
|
|
||||||
#define sexp_heap_align(n) sexp_align(n, 5)
|
|
||||||
#else
|
|
||||||
#define sexp_heap_align(n) sexp_align(n, 4)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SEXP_MINIMUM_OBJECT_SIZE (sexp_heap_align(sexp_sizeof(pair)))
|
#define SEXP_MINIMUM_OBJECT_SIZE (sexp_heap_align(sexp_sizeof(pair)))
|
||||||
|
|
||||||
#define sexp_heap_pad_size(s) (sizeof(struct sexp_heap_t) + (s) + sexp_heap_align(1))
|
|
||||||
|
|
||||||
#if SEXP_USE_GLOBAL_HEAP
|
#if SEXP_USE_GLOBAL_HEAP
|
||||||
sexp_heap sexp_global_heap;
|
sexp_heap sexp_global_heap;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -113,13 +113,18 @@ enum sexp_types {
|
||||||
typedef unsigned int sexp_tag_t;
|
typedef unsigned int sexp_tag_t;
|
||||||
typedef unsigned long sexp_uint_t;
|
typedef unsigned long sexp_uint_t;
|
||||||
typedef long sexp_sint_t;
|
typedef long sexp_sint_t;
|
||||||
|
#define sexp_heap_align(n) sexp_align(n, 5)
|
||||||
#else
|
#else
|
||||||
typedef unsigned short sexp_tag_t;
|
typedef unsigned short sexp_tag_t;
|
||||||
typedef unsigned int sexp_uint_t;
|
typedef unsigned int sexp_uint_t;
|
||||||
typedef int sexp_sint_t;
|
typedef int sexp_sint_t;
|
||||||
|
#define sexp_heap_align(n) sexp_align(n, 4)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct sexp_struct *sexp;
|
typedef struct sexp_struct *sexp;
|
||||||
|
|
||||||
|
#define sexp_heap_pad_size(s) (sizeof(struct sexp_heap_t) + (s) + sexp_heap_align(1))
|
||||||
|
|
||||||
#define __HALF_MAX_SIGNED(type) ((type)1 << (sizeof(type)*8-2))
|
#define __HALF_MAX_SIGNED(type) ((type)1 << (sizeof(type)*8-2))
|
||||||
#define __MAX_SIGNED(type) (__HALF_MAX_SIGNED(type) - 1 + __HALF_MAX_SIGNED(type))
|
#define __MAX_SIGNED(type) (__HALF_MAX_SIGNED(type) - 1 + __HALF_MAX_SIGNED(type))
|
||||||
#define __MIN_SIGNED(type) (-1 - __MAX_SIGNED(type))
|
#define __MIN_SIGNED(type) (-1 - __MAX_SIGNED(type))
|
||||||
|
|
|
@ -115,6 +115,7 @@
|
||||||
(gap buffer-gap buffer-gap-set!)
|
(gap buffer-gap buffer-gap-set!)
|
||||||
(width buffer-width buffer-width-set!)
|
(width buffer-width buffer-width-set!)
|
||||||
(string buffer-string buffer-string-set!)
|
(string buffer-string buffer-string-set!)
|
||||||
|
(kill-ring buffer-kill-ring buffer-kill-ring-set!)
|
||||||
(history buffer-history buffer-history-set!))
|
(history buffer-history buffer-history-set!))
|
||||||
|
|
||||||
(define default-buffer-size 256)
|
(define default-buffer-size 256)
|
||||||
|
|
2
sexp.c
2
sexp.c
|
@ -311,7 +311,7 @@ void sexp_destroy_context (sexp ctx) {
|
||||||
for ( ; heap; heap=tmp) {
|
for ( ; heap; heap=tmp) {
|
||||||
tmp = heap->next;
|
tmp = heap->next;
|
||||||
#if SEXP_USE_MMAP_GC
|
#if SEXP_USE_MMAP_GC
|
||||||
munmap(heap, heap->size);
|
munmap(heap, sexp_heap_pad_size(heap->size));
|
||||||
#else
|
#else
|
||||||
free(heap);
|
free(heap);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
(set! *tests-run* (+ *tests-run* 1))
|
(set! *tests-run* (+ *tests-run* 1))
|
||||||
(let ((str (call-with-output-string
|
(let ((str (call-with-output-string
|
||||||
(lambda (out)
|
(lambda (out)
|
||||||
(write *tests-run*)
|
(write *tests-run* out)
|
||||||
(display ". ")
|
(display ". " out)
|
||||||
(display 'expr out))))
|
(display 'expr out))))
|
||||||
(res expr))
|
(res expr))
|
||||||
(display str)
|
(display str)
|
||||||
|
|
|
@ -216,24 +216,6 @@
|
||||||
|
|
||||||
(test 288 (lcm 32 -36))
|
(test 288 (lcm 32 -36))
|
||||||
|
|
||||||
;;;; these will fail when compiled either without flonums or trig funcs
|
|
||||||
|
|
||||||
;; (test #t (= -5 (floor -4.3)))
|
|
||||||
|
|
||||||
;; (test #t (= -4 (ceiling -4.3)))
|
|
||||||
|
|
||||||
;; (test #t (= -4 (truncate -4.3)))
|
|
||||||
|
|
||||||
;; (test #t (= -4 (round -4.3)))
|
|
||||||
|
|
||||||
;; (test #t (= 3 (floor 3.5)))
|
|
||||||
|
|
||||||
;; (test #t (= 4 (ceiling 3.5)))
|
|
||||||
|
|
||||||
;; (test #t (= 3 (truncate 3.5)))
|
|
||||||
|
|
||||||
;; (test #t (= 4 (round 3.5)))
|
|
||||||
|
|
||||||
(test 100 (string->number "100"))
|
(test 100 (string->number "100"))
|
||||||
|
|
||||||
(test 256 (string->number "100" 16))
|
(test 256 (string->number "100" 16))
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
;;
|
;;
|
||||||
;; Port Types:
|
;; Port Types:
|
||||||
;; input-port output-port
|
;; input-port output-port
|
||||||
|
;; port-or-fd - an fd-backed port or a fixnum
|
||||||
;;
|
;;
|
||||||
;; Struct Types:
|
;; Struct Types:
|
||||||
;;
|
;;
|
||||||
|
@ -620,8 +621,8 @@
|
||||||
" return sexp_xtype_exception(ctx, self, \"not a list of "
|
" return sexp_xtype_exception(ctx, self, \"not a list of "
|
||||||
(type-name type) "s\", " arg ");\n")))
|
(type-name type) "s\", " arg ");\n")))
|
||||||
((eq? base-type 'port-or-fd)
|
((eq? base-type 'port-or-fd)
|
||||||
(cat "if (! (sexp_portp(" arg ") || sexp_fixnump(" arg ")))\n"
|
(cat " if (! (sexp_portp(" arg ") || sexp_fixnump(" arg ")))\n"
|
||||||
" return sexp_xtype_exception(ctx, self, \"not a port of file descriptor\"," arg ");\n"))
|
" return sexp_xtype_exception(ctx, self, \"not a port or file descriptor\"," arg ");\n"))
|
||||||
((or (int-type? base-type)
|
((or (int-type? base-type)
|
||||||
(float-type? base-type)
|
(float-type? base-type)
|
||||||
(string-type? base-type)
|
(string-type? base-type)
|
||||||
|
|
Loading…
Add table
Reference in a new issue