mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Issue #69 - Removed symtbl size checks
libck already does this internally
This commit is contained in:
parent
a6c3e4818a
commit
f86132591d
1 changed files with 2 additions and 7 deletions
|
@ -124,7 +124,7 @@ static symbol_type __EOF = { {0}, eof_tag, "", NULL }; // symbol_type in lieu o
|
||||||
|
|
||||||
const object Cyc_EOF = &__EOF;
|
const object Cyc_EOF = &__EOF;
|
||||||
static ck_hs_t symbol_table;
|
static ck_hs_t symbol_table;
|
||||||
static int symbol_table_size = 65536;
|
static int symbol_table_initial_size = 4096;
|
||||||
static pthread_mutex_t symbol_table_lock;
|
static pthread_mutex_t symbol_table_lock;
|
||||||
|
|
||||||
// Functions to support concurrency kit hashset
|
// Functions to support concurrency kit hashset
|
||||||
|
@ -192,7 +192,7 @@ void gc_init_heap(long heap_size)
|
||||||
if (!ck_hs_init(&symbol_table,
|
if (!ck_hs_init(&symbol_table,
|
||||||
CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC,
|
CK_HS_MODE_OBJECT | CK_HS_MODE_SPMC,
|
||||||
hs_hash, hs_compare,
|
hs_hash, hs_compare,
|
||||||
&my_allocator, symbol_table_size, 43423)) {
|
&my_allocator, symbol_table_initial_size, 43423)) {
|
||||||
fprintf(stderr, "Unable to initialize symbol table\n");
|
fprintf(stderr, "Unable to initialize symbol table\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -289,11 +289,6 @@ object add_symbol(symbol_type * psym)
|
||||||
{
|
{
|
||||||
//printf("Adding symbol %s, table size = %ld\n", symbol_pname(psym), ck_hs_count(&symbol_table));
|
//printf("Adding symbol %s, table size = %ld\n", symbol_pname(psym), ck_hs_count(&symbol_table));
|
||||||
pthread_mutex_lock(&symbol_table_lock); // Only 1 "writer" allowed
|
pthread_mutex_lock(&symbol_table_lock); // Only 1 "writer" allowed
|
||||||
if (ck_hs_count(&symbol_table) == symbol_table_size) {
|
|
||||||
// TODO: grow table if it is not big enough
|
|
||||||
fprintf(stderr, "Ran out of symbol table entries\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
set_insert(&symbol_table, psym);
|
set_insert(&symbol_table, psym);
|
||||||
pthread_mutex_unlock(&symbol_table_lock);
|
pthread_mutex_unlock(&symbol_table_lock);
|
||||||
return psym;
|
return psym;
|
||||||
|
|
Loading…
Add table
Reference in a new issue