[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-hackers] [PATCH] use correct defaults for nursery size
From: |
Felix |
Subject: |
[Chicken-hackers] [PATCH] use correct defaults for nursery size |
Date: |
Thu, 10 Nov 2011 05:40:50 -0500 (EST) |
The attached patch changes the default nursery size to 256k on 32-bit
systems and 1mb on 64-bit systems. The compiler does not emit
stack-resizing cod unless explicitly requested - this was previously
done, but didn't make sense, because it would override the default
setting with the same value, regardless of the application default.
Using the runtime defaults also prevents distributed C files to override
the nursery size settings (unless requested). Additionally, the handling
of default heap-size settings was slightly cleaned up.
The compiler-options -heap-initial-size, -heap-growth and
-heap-shrinkage have been deprecated.
>From cc8495fb780bd2515dde6b0666db2a8697859928 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Thu, 10 Nov 2011 11:11:36 +0100
Subject: [PATCH] use different default stack-sizes on 32/64 bit platforms;
stack-resizing should not be done in compiled files by
default; deprecate -heap-initial-size, -heap-growth and
-heap-shirnkage options
---
Makefile.mingw | 3 ---
batch-driver.scm | 20 ++++----------------
c-backend.scm | 12 +++---------
c-platform.scm | 3 ++-
compiler-namespace.scm | 4 ----
compiler.scm | 18 ++----------------
csc.scm | 7 +++----
defaults.make | 3 ---
manual/Using the compiler | 6 ------
runtime.c | 7 ++++++-
support.scm | 3 ---
11 files changed, 20 insertions(+), 66 deletions(-)
diff --git a/Makefile.mingw b/Makefile.mingw
index 1f07543..45feda2 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -178,9 +178,6 @@ endif
echo #ifndef C_INSTALL_MORE_STATIC_LIBS >>$@
echo # define C_INSTALL_MORE_STATIC_LIBS "$(LIBRARIES)" >>$@
echo #endif >>$@
- echo #ifndef C_DEFAULT_TARGET_STACK_SIZE >>$@
- echo # define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY) >>$@
- echo #endif >>$@
echo #ifndef C_DEFAULT_TARGET_HEAP_SIZE >>$@
echo # define C_DEFAULT_TARGET_HEAP_SIZE 0 >>$@
echo #endif >>$@
diff --git a/batch-driver.scm b/batch-driver.scm
index 4255099..1bd4f67 100644
--- a/batch-driver.scm
+++ b/batch-driver.scm
@@ -84,9 +84,6 @@
(profile-name
(and-let* ((pn (memq 'profile-name options))) (cadr pn)))
(hsize (memq 'heap-size options))
- (hisize (memq 'heap-initial-size options))
- (hgrowth (memq 'heap-growth options))
- (hshrink (memq 'heap-shrinkage options))
(kwstyle (memq 'keyword-style options))
(uses-units '())
(uunit (memq 'unit options))
@@ -341,20 +338,11 @@
(when (memq 'compile-syntax options)
(set! ##sys#enable-runtime-macros #t) )
(set! target-heap-size
- (if hsize
- (arg-val (option-arg hsize))
- (and-let* ([hsize default-default-target-heap-size]
- [(not (zero? hsize))] )
- hsize) ) )
- (set! target-initial-heap-size (and hisize (arg-val (option-arg hisize))))
- (set! target-heap-growth (and hgrowth (arg-val (option-arg hgrowth))))
- (set! target-heap-shrinkage (and hshrink (arg-val (option-arg hshrink))))
+ (and hsize
+ (arg-val (option-arg hsize))))
(set! target-stack-size
- (if ssize
- (arg-val (option-arg ssize))
- (and-let* ([ssize default-default-target-stack-size]
- [(not (zero? ssize))] )
- ssize) ) )
+ (and ssize
+ (arg-val (option-arg ssize))))
(set! emit-trace-info (not (memq 'no-trace options)))
(set! disable-stack-overflow-checking (memq 'disable-stack-overflow-checks
options))
(set! bootstrap-mode (feature? #:chicken-bootstrap))
diff --git a/c-backend.scm b/c-backend.scm
index 32dab84..18e013e 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -814,15 +814,9 @@
(when disable-stack-overflow-checking
(gen #t "C_disable_overflow_check=1;") )
(unless unit-name
- (cond [target-initial-heap-size
- (gen #t "C_set_or_change_heap_size("
target-initial-heap-size ",1);") ]
- [target-heap-size
- (gen #t "C_set_or_change_heap_size("
target-heap-size ",1);"
- #t "C_heap_size_is_fixed=1;") ] )
- (when target-heap-growth
- (gen #t "C_heap_growth=" target-heap-growth #\;) )
- (when target-heap-shrinkage
- (gen #t "C_heap_shrinkage=" target-heap-shrinkage #\;) )
+ (when target-heap-size
+ (gen #t "C_set_or_change_heap_size(" target-heap-size
",1);"
+ #t "C_heap_size_is_fixed=1;"))
(when target-stack-size
(gen #t "C_resize_stack(" target-stack-size ");") ) )
(gen #t "C_check_nursery_minimum(" demand ");"
diff --git a/c-platform.scm b/c-platform.scm
index 0e98754..5d69bcd 100644
--- a/c-platform.scm
+++ b/c-platform.scm
@@ -104,7 +104,8 @@
prelude postlude prologue epilogue nursery extend feature no-feature types
emit-import-library emit-inline-file static-extension consult-inline-file
emit-type-file
- heap-growth heap-shrinkage heap-initial-size ffi-define ffi-include-path) )
+ heap-growth heap-shrinkage heap-initial-size ; DEPRECATED
+ ffi-define ffi-include-path) )
;;; Standard and extended bindings:
diff --git a/compiler-namespace.scm b/compiler-namespace.scm
index a23d31d..819aae1 100644
--- a/compiler-namespace.scm
+++ b/compiler-namespace.scm
@@ -82,7 +82,6 @@
default-debugging-declarations
default-declarations
default-default-target-heap-size
- default-default-target-stack-size
default-extended-bindings
default-optimization-iterations
default-optimization-passes
@@ -277,11 +276,8 @@
stringify
substitution-table
symbolify
- target-heap-growth
- target-heap-shrinkage
target-heap-size
target-include-file
- target-initial-heap-size
target-stack-size
toplevel-lambda-id
toplevel-scope
diff --git a/compiler.scm b/compiler.scm
index d907f63..83de2d2 100644
--- a/compiler.scm
+++ b/compiler.scm
@@ -279,15 +279,8 @@
(define-inline (gensym-f-id) (gensym 'f_))
-(eval-when (eval)
- (define installation-home #f)
- (define default-target-heap-size #f)
- (define default-target-stack-size #f) )
-
-(eval-when (load)
- (define-foreign-variable installation-home c-string "C_INSTALL_SHARE_HOME")
- (define-foreign-variable default-target-heap-size int
"C_DEFAULT_TARGET_HEAP_SIZE")
- (define-foreign-variable default-target-stack-size int
"C_DEFAULT_TARGET_STACK_SIZE") )
+(define-foreign-variable installation-home c-string "C_INSTALL_SHARE_HOME")
+(define-foreign-variable default-target-heap-size int
"C_DEFAULT_TARGET_HEAP_SIZE")
(define-constant foreign-type-table-size 301)
(define-constant analysis-database-size 3001)
@@ -313,7 +306,6 @@
(define block-compilation #f)
(define line-number-database-size default-line-number-database-size)
(define target-heap-size #f)
-(define target-initial-heap-size #f)
(define target-stack-size #f)
(define optimize-leaf-routines #f)
(define emit-profile #f)
@@ -344,12 +336,6 @@
(define enable-specialization #f)
-;;; These are here so that the backend can access them:
-
-(define default-default-target-heap-size default-target-heap-size)
-(define default-default-target-stack-size default-target-stack-size)
-
-
;;; Other global variables:
(define verbose-mode #f)
diff --git a/csc.scm b/csc.scm
index 11bbff0..8afbdf6 100644
--- a/csc.scm
+++ b/csc.scm
@@ -148,7 +148,9 @@
-optimize-level -include-path -database-size -extend -prelude -postlude
-prologue -epilogue
-inline-limit -profile-name
-emit-inline-file -types -emit-type-file
- -feature -debug-level -heap-growth -heap-shrinkage -heap-initial-size
-consult-inline-file
+ -feature -debug-level
+ -heap-growth -heap-shrinkage -heap-initial-size ; DEPRECATED
+ -consult-inline-file
-emit-import-library
-no-feature))
@@ -403,9 +405,6 @@ Usage: #{csc} FILENAME | OPTION ...
-unit NAME compile file as a library unit
-uses NAME declare library unit as used.
-heap-size NUMBER specifies heap-size of compiled executable
- -heap-initial-size NUMBER specifies heap-size at startup time
- -heap-growth PERCENTAGE specifies growth-rate of expanding heap
- -heap-shrinkage PERCENTAGE specifies shrink-rate of contracting heap
-nursery NUMBER -stack-size NUMBER
specifies nursery size of compiled
executable
diff --git a/defaults.make b/defaults.make
index b1f971e..b806196 100644
--- a/defaults.make
+++ b/defaults.make
@@ -395,9 +395,6 @@ endif
echo "#ifndef C_INSTALL_MORE_STATIC_LIBS" >>$@
echo "# define C_INSTALL_MORE_STATIC_LIBS \"$(LIBRARIES)\"" >>$@
echo "#endif" >>$@
- echo "#ifndef C_DEFAULT_TARGET_STACK_SIZE" >>$@
- echo "# define C_DEFAULT_TARGET_STACK_SIZE $(NURSERY)" >>$@
- echo "#endif" >>$@
echo "#ifndef C_DEFAULT_TARGET_HEAP_SIZE" >>$@
echo "# define C_DEFAULT_TARGET_HEAP_SIZE 0" >>$@
echo "#endif" >>$@
diff --git a/manual/Using the compiler b/manual/Using the compiler
index a3470f2..9d9253e 100644
--- a/manual/Using the compiler
+++ b/manual/Using the compiler
@@ -68,12 +68,6 @@ the source text should be read from standard input.
; -heap-size NUMBER : Sets a fixed heap size of the generated executable to
{{NUMBER}} bytes. The parameter may be followed by a {{M}} ({{m}}) or {{K}}
({{k}}) suffix which stand for mega- and kilobytes, respectively. The default
heap size is 5 kilobytes. Note that only half of it is in use at every given
time.
-; -heap-initial-size NUMBER : Sets the size that the heap of the compiled
application should have at startup time.
-
-; -heap-growth PERCENTAGE : Sets the heap-growth rate for the compiled program
at compile time (see: {{-:hg}}).
-
-; -heap-shrinkage PERCENTAGE : Sets the heap-shrinkage rate for the compiled
program at compile time (see: {{-:hs}}).
-
; -help : Print a summary of available options and the format of the command
line parameters and exit the compiler.
; -ignore-repository : Do not load any extensions from the repository (treat
repository as empty). Also do not consult compiled (only interpreted) import
libraries in {{import}} forms.
diff --git a/runtime.c b/runtime.c
index a6b2d35..09b1393 100644
--- a/runtime.c
+++ b/runtime.c
@@ -131,7 +131,12 @@ extern void _C_do_apply_hack(void *proc, C_word *args, int
count) C_noret;
#define RELAX_MULTIVAL_CHECK
-#define DEFAULT_STACK_SIZE 64000
+#ifdef C_SIXTY_FOUR
+# define DEFAULT_STACK_SIZE (1024 * 1024)
+#else
+# define DEFAULT_STACK_SIZE (256 * 1024)
+#endif
+
#define DEFAULT_SYMBOL_TABLE_SIZE 2999
#define DEFAULT_HEAP_SIZE 500000
#define MINIMAL_HEAP_SIZE 500000
diff --git a/support.scm b/support.scm
index 28c950b..8bf2b6d 100644
--- a/support.scm
+++ b/support.scm
@@ -1685,9 +1685,6 @@ Usage: chicken FILENAME OPTION ...
-unit NAME compile file as a library unit
-uses NAME declare library unit as used.
-heap-size NUMBER specifies heap-size of compiled executable
- -heap-initial-size NUMBER specifies heap-size at startup time
- -heap-growth PERCENTAGE specifies growth-rate of expanding heap
- -heap-shrinkage PERCENTAGE specifies shrink-rate of contracting heap
-nursery NUMBER -stack-size NUMBER
specifies nursery size of compiled executable
-extend FILENAME load file before compilation commences
--
1.7.6.msysgit.0
- [Chicken-hackers] [PATCH] use correct defaults for nursery size,
Felix <=