From: Nikodemus Siivola Date: Sat, 19 Nov 2011 12:16:47 +0000 (+0200) Subject: unsigned long -> os_vm_size_t refactoring X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=3cd198ea8fb1635057038934730624e68b5da012;p=sbcl.git unsigned long -> os_vm_size_t refactoring Replace a number of GC related unsigned longs with os_vm_size_t, make it available in on the lisp-side as well, and use where appropriate. Makes BYTES-CONSED-BETWEEN-GCS and its SETF-version also support large nurseries. --- diff --git a/NEWS b/NEWS index 929c240..5c2ea92 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,8 @@ changes relative to sbcl-1.0.53: systems with getaddrinfo(). ** GET-HOST-BY-NAME and GET-HOST-BY-ADDRESS weren't thread or interrupt safe outside systems with getaddrinfo(). + * bug fix: on 64-bit systems setting the nursery size above 4Gb now works. + (lp#870868) changes in sbcl-1.0.53 relative to sbcl-1.0.52: * enhancement: on 64-bit targets, in src/compiler/generic/early-vm.lisp, diff --git a/src/code/gc.lisp b/src/code/gc.lisp index bc5c920..437e9d4 100644 --- a/src/code/gc.lisp +++ b/src/code/gc.lisp @@ -25,7 +25,7 @@ (declaim (inline dynamic-usage)) #!+gencgc (defun dynamic-usage () - (sb!alien:extern-alien "bytes_allocated" sb!alien:unsigned-long)) + (sb!alien:extern-alien "bytes_allocated" os-vm-size-t)) #!-gencgc (defun dynamic-usage () (the (unsigned-byte 32) @@ -176,7 +176,7 @@ NIL as the pathname." (native-pathname (cast val c-string))))) (declaim (inline dynamic-space-size)) (defun dynamic-space-size () - (sb!alien:extern-alien "dynamic_space_size" sb!alien:unsigned-long))) + (sb!alien:extern-alien "dynamic_space_size" os-vm-size-t))) ;;;; SUB-GC @@ -340,13 +340,11 @@ NIL as the pathname." #!+sb-doc "The amount of memory that will be allocated before the next garbage collection is initiated. This can be set with SETF." - (sb!alien:extern-alien "bytes_consed_between_gcs" - (sb!alien:unsigned 32))) + (sb!alien:extern-alien "bytes_consed_between_gcs" os-vm-size-t)) (defun (setf bytes-consed-between-gcs) (val) (declare (type index val)) - (setf (sb!alien:extern-alien "bytes_consed_between_gcs" - (sb!alien:unsigned 32)) + (setf (sb!alien:extern-alien "bytes_consed_between_gcs" os-vm-size-t) val)) (declaim (inline maybe-handle-pending-gc)) @@ -374,12 +372,12 @@ collection is initiated. This can be set with SETF." (alloc-unboxed-start-page page-index-t) (alloc-large-start-page page-index-t) (alloc-large-unboxed-start-page page-index-t) - (bytes-allocated unsigned-long) - (gc-trigger unsigned-long) - (bytes-consed-between-gcs unsigned-long) + (bytes-allocated os-vm-size-t) + (gc-trigger os-vm-size-t) + (bytes-consed-between-gcs os-vm-size-t) (number-of-gcs int) (number-of-gcs-before-promotion int) - (cum-sum-bytes-allocated unsigned-long) + (cum-sum-bytes-allocated os-vm-size-t) (minimum-age-before-gc double))) #!+gencgc diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index 96de172..6db65fc 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -90,8 +90,7 @@ lispobj (*transother[256])(lispobj object); long (*sizetab[256])(lispobj *where); struct weak_pointer *weak_pointers; -unsigned long bytes_consed_between_gcs = 12*1024*1024; - +os_vm_size_t bytes_consed_between_gcs = 12*1024*1024; /* * copying objects diff --git a/src/runtime/gc.h b/src/runtime/gc.h index 10c97a4..5ba50fc 100644 --- a/src/runtime/gc.h +++ b/src/runtime/gc.h @@ -38,6 +38,6 @@ extern void clear_auto_gc_trigger(void); extern boolean maybe_gc(os_context_t *context); -extern unsigned long bytes_consed_between_gcs; +extern os_vm_size_t bytes_consed_between_gcs; #endif /* _GC_H_ */ diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 27ad418..95a5d47 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -149,8 +149,8 @@ boolean gencgc_partial_pickup = 0; */ /* the total bytes allocated. These are seen by Lisp DYNAMIC-USAGE. */ -unsigned long bytes_allocated = 0; -unsigned long auto_gc_trigger = 0; +os_vm_size_t bytes_allocated = 0; +os_vm_size_t auto_gc_trigger = 0; /* the source and destination generations. These are set before a GC starts * scavenging. */ @@ -285,13 +285,13 @@ struct generation { page_index_t alloc_large_unboxed_start_page; /* the bytes allocated to this generation */ - unsigned long bytes_allocated; + os_vm_size_t bytes_allocated; /* the number of bytes at which to trigger a GC */ - unsigned long gc_trigger; + os_vm_size_t gc_trigger; /* to calculate a new level for gc_trigger */ - unsigned long bytes_consed_between_gc; + os_vm_size_t bytes_consed_between_gc; /* the number of GCs since the last raise */ int num_gc; @@ -305,7 +305,7 @@ struct generation { * objects are added from a GC of a younger generation. Dividing by * the bytes_allocated will give the average age of the memory in * this generation since its last GC. */ - unsigned long cum_sum_bytes_allocated; + os_vm_size_t cum_sum_bytes_allocated; /* a minimum average memory age before a GC will occur helps * prevent a GC when a large number of new live objects have been @@ -507,7 +507,7 @@ write_generation_stats(FILE *file) generations[i].num_gc, generation_average_age(i)); } - fprintf(file," Total bytes allocated = %lu\n", bytes_allocated); + fprintf(file," Total bytes allocated = %lu\n", (unsigned long)bytes_allocated); fprintf(file," Dynamic-space-size bytes = %lu\n", (unsigned long)dynamic_space_size); fpu_restore(fpu_state); @@ -3686,8 +3686,8 @@ garbage_collect_generation(generation_index_t generation, int raise) /* As a check re-scavenge the newspace once; no new objects should * be found. */ { - long old_bytes_allocated = bytes_allocated; - long bytes_allocated; + os_vm_size_t old_bytes_allocated = bytes_allocated; + os_vm_size_t bytes_allocated; /* Start with a full scavenge. */ scavenge_newspace_generation_one_scan(new_space); diff --git a/tools-for-build/grovel-headers.c b/tools-for-build/grovel-headers.c index 1b61f98..9746e12 100644 --- a/tools-for-build/grovel-headers.c +++ b/tools-for-build/grovel-headers.c @@ -467,13 +467,16 @@ main(int argc, char *argv[]) printf("\n"); #endif + printf("(in-package \"SB!KERNEL\")\n\n"); #ifdef LISP_FEATURE_GENCGC printf(";;; GENCGC related\n"); - printf("(in-package \"SB!KERNEL\")\n"); DEFTYPE("page-index-t", page_index_t); DEFTYPE("generation-index-t", generation_index_t); printf("\n"); #endif + printf(";;; Our runtime types\n"); + DEFTYPE("os-vm-size-t", os_vm_size_t); + return 0; }