~ chicken-core (chicken-5) 0978b624ce13e4bfa422102d27c862be14c2804a
commit 0978b624ce13e4bfa422102d27c862be14c2804a
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Thu May 2 19:06:51 2019 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Sat May 4 19:57:10 2019 +0200
Reduce default keyword table size, use symbol table size as a basis when given
Signed-off-by: felix <felix@call-with-current-continuation.org>
diff --git a/manual/Embedding b/manual/Embedding
index d6cd42cc..a4a5f319 100644
--- a/manual/Embedding
+++ b/manual/Embedding
@@ -26,12 +26,13 @@ only if this function has been called by the containing application.
[C function] int CHICKEN_initialize (int heap, int stack, int symbols, void *toplevel)
-Initializes the Scheme execution context and memory. {{heap}}
-holds the number of bytes that are to be allocated for the secondary
+Initializes the Scheme execution context and memory. {{heap}} holds
+the number of bytes that are to be allocated for the secondary
heap. {{stack}} holds the number of bytes for the primary
-heap. {{symbols}} contains the size of the symbol table. Passing
-{{0}} to one or more of these parameters will select a default
-size.
+heap. {{symbols}} contains the size of the symbol table. The keyword
+table will be 1/4th the symbol table size. Passing {{0}} to one or
+more of these parameters will select a default size.
+
{{toplevel}} should be a pointer to the toplevel entry point
procedure. You should pass {{C_toplevel}} here. In any subsequent
call to {{CHICKEN_run}} you can simply
diff --git a/runtime.c b/runtime.c
index 842f8645..5638df55 100644
--- a/runtime.c
+++ b/runtime.c
@@ -155,7 +155,7 @@ static C_TLS int timezone;
#endif
#define DEFAULT_SYMBOL_TABLE_SIZE 2999
-#define DEFAULT_KEYWORD_TABLE_SIZE 999
+#define DEFAULT_KEYWORD_TABLE_SIZE 499
#define DEFAULT_HEAP_SIZE DEFAULT_STACK_SIZE
#define MINIMAL_HEAP_SIZE DEFAULT_STACK_SIZE
#define DEFAULT_SCRATCH_SPACE_SIZE 256
@@ -716,8 +716,7 @@ int CHICKEN_initialize(int heap, int stack, int symbols, void *toplevel)
if(symbol_table == NULL)
return 0;
- /* TODO: Should we use "symbols" here too? */
- keyword_table = C_new_symbol_table("kw", DEFAULT_KEYWORD_TABLE_SIZE);
+ keyword_table = C_new_symbol_table("kw", symbols ? symbols / 4 : DEFAULT_KEYWORD_TABLE_SIZE);
if(keyword_table == NULL)
return 0;
Trap