*improved gc with an array.

This commit is contained in:
paladin-t 2015-12-28 20:23:54 +08:00
parent 36da08e0e2
commit a097d43ad1
2 changed files with 9 additions and 4 deletions

View File

@ -1,3 +1,6 @@
Dec. 29 2015
Improved GC with an array
Dec. 28 2015 Dec. 28 2015
Fixed a GC bug Fixed a GC bug
Fixed a wrong routine evaluation bug Fixed a wrong routine evaluation bug

View File

@ -84,7 +84,7 @@ extern "C" {
/** Macros */ /** Macros */
#define _VER_MAJOR 1 #define _VER_MAJOR 1
#define _VER_MINOR 1 #define _VER_MINOR 1
#define _VER_REVISION 111 #define _VER_REVISION 112
#define _VER_SUFFIX #define _VER_SUFFIX
#define _MB_VERSION ((_VER_MAJOR * 0x01000000) + (_VER_MINOR * 0x00010000) + (_VER_REVISION)) #define _MB_VERSION ((_VER_MAJOR * 0x01000000) + (_VER_MINOR * 0x00010000) + (_VER_REVISION))
#define _STRINGIZE(A) _MAKE_STRINGIZE(A) #define _STRINGIZE(A) _MAKE_STRINGIZE(A)
@ -4309,9 +4309,6 @@ void _gc_add(_ref_t* ref, void* data, _gc_t* gc) {
if(gc && _ht_find(gc->collected_table, ref)) if(gc && _ht_find(gc->collected_table, ref))
return; return;
if(ref->type == _DT_ARRAY)
return;
if(!ref->s->gc.table) if(!ref->s->gc.table)
return; return;
@ -4358,6 +4355,11 @@ int _gc_add_reachable(void* data, void* extra, void* ht) {
if(!_ht_find(htable, &obj->data.usertype_ref->ref)) if(!_ht_find(htable, &obj->data.usertype_ref->ref))
_ht_set_or_insert(htable, &obj->data.usertype_ref->ref, obj->data.usertype_ref); _ht_set_or_insert(htable, &obj->data.usertype_ref->ref, obj->data.usertype_ref);
break;
case _DT_ARRAY:
if(!_ht_find(htable, &obj->data.array->ref))
_ht_set_or_insert(htable, &obj->data.array->ref, obj->data.array);
break; break;
#ifdef MB_ENABLE_COLLECTION_LIB #ifdef MB_ENABLE_COLLECTION_LIB
case _DT_LIST: case _DT_LIST: