浏览代码

enable interior pointers by default (for stack scanning, safer wrt recent compilers)

Nicolas Cannasse 2 年之前
父节点
当前提交
066d5e1569
共有 2 个文件被更改,包括 6 次插入12 次删除
  1. 1 3
      src/gc.c
  2. 5 9
      src/std/maps.h

+ 1 - 3
src/gc.c

@@ -73,9 +73,7 @@ static int_val gc_hash( void *ptr ) {
 #	define GC_MEMCHK
 #endif
 
-#if defined(HL_NX) || defined(HL_PS)
-#	define GC_INTERIOR_POINTERS
-#endif
+#define GC_INTERIOR_POINTERS
 
 #define out_of_memory(reason)		hl_fatal("Out of Memory (" reason ")")
 

+ 5 - 9
src/std/maps.h

@@ -115,16 +115,12 @@ static void _MNAME(resize)( t_map *m ) {
 		memset(m->values, 0, nentries * sizeof(t_value));
 		hl_freelist_init(&m->lfree);
 		hl_freelist_add_range(&m->lfree,0,m->maxentries);
-		if( old.ncells ) {
-			hl_add_root(&old); // prevent old.cells pointer aliasing
-			for(i=0;i<old.ncells;i++) {
-				int c = old.maxentries < _MLIMIT ? ((char*)old.cells)[i] : ((int*)old.cells)[i];
-				while( c >= 0 ) {
-					_MNAME(set_impl)(m,_MKEY((&old),c),old.values[c].value);
-					c = _MNEXT(&old,c);
-				}
+		for(i=0;i<old.ncells;i++) {
+			int c = old.maxentries < _MLIMIT ? ((char*)old.cells)[i] : ((int*)old.cells)[i];
+			while( c >= 0 ) {
+				_MNAME(set_impl)(m,_MKEY((&old),c),old.values[c].value);
+				c = _MNEXT(&old,c);
 			}
-			hl_remove_root(&old);
 		}
 	}
 }