From 969c0f4dd587edd9f76215461e9b63ec890b4d05 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Thu, 2 May 2019 19:06:51 +0200 Subject: [PATCH] Reduce default keyword table size, use symbol table size as a basis when given --- manual/Embedding | 11 ++++++----- runtime.c | 5 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) 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; -- 2.11.0