diff --git a/ChangeLog b/ChangeLog index 908db69be0..a431f525e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Sun Dec 29 23:45:53 2002 Nobuyoshi Nakada + + * gc.c (gc_sweep): adjust GC trigger. + + * dln.c (init_funcname_len): get rid of gcc-3 -O3 warning. + + * eval.c (copy_node_scope): ditto. + + * hash.c (rb_hash_foreach, delete_if_i, select_i, each_value_i, + each_key_i, each_pair_i, envix): ditto. + + * range.c (range_each_func): ditto. + Sun Dec 29 15:30:37 2002 Minero Aoki * lib/fileutils.rb (fu_parseargs): should not inherit ftools.rb's diff --git a/dln.c b/dln.c index 55b751223b..af87a2e727 100644 --- a/dln.c +++ b/dln.c @@ -107,17 +107,18 @@ int eaccess(); static int init_funcname_len(buf, file) char **buf; - char *file; + const char *file; { - char *p, *slash; + char *p; + const char *slash; int len; /* Load the file as an object one */ - for (p = file, slash = p-1; *p; p++) /* Find position of last '/' */ + for (slash = file-1; *file; file++) /* Find position of last '/' */ #ifdef __MACOS__ - if (*p == ':') slash = p; + if (*file == ':') slash = file; #else - if (*p == '/') slash = p; + if (*file == '/') slash = file; #endif len = strlen(FUNCNAME_PATTERN) + strlen(slash + 1); diff --git a/eval.c b/eval.c index e363b20930..1c32855f8f 100644 --- a/eval.c +++ b/eval.c @@ -1766,7 +1766,7 @@ rb_mod_alias_method(mod, newname, oldname) static NODE* copy_node_scope(node, rval) NODE *node; - VALUE rval; + NODE *rval; { NODE *copy = rb_node_newnode(NODE_SCOPE,0,rval,node->nd_next); diff --git a/gc.c b/gc.c index f925e55e0c..788036a980 100644 --- a/gc.c +++ b/gc.c @@ -879,7 +879,7 @@ gc_sweep() RVALUE *p, *pend, *final_list; int freed = 0; int i, j; - unsigned long live = 0; + unsigned long live = 0, garbage = 0; if (ruby_in_compile && ruby_parser_stack_on_heap()) { /* should not reclaim nodes during compilation @@ -929,32 +929,7 @@ gc_sweep() } else { RBASIC(p)->flags &= ~FL_MARK; - live += sizeof(VALUE); - switch (BUILTIN_TYPE(p)) { - case T_OBJECT: - live += size_of_table(ROBJECT(p)->iv_tbl); - break; - case T_CLASS: - case T_ICLASS: - live += size_of_table(RCLASS(p)->iv_tbl); - live += size_of_table(RCLASS(p)->m_tbl); - break; - case T_STRING: - live += RSTRING(p)->len+1; - break; - case T_ARRAY: - live += RARRAY(p)->len * sizeof(VALUE); - break; - case T_HASH: - live += size_of_table(RHASH(p)->tbl); - break; - case T_BIGNUM: - live += RBIGNUM(p)->len * sizeof(BDIGIT); - break; - case T_STRUCT: - live += RSTRUCT(p)->len * sizeof(VALUE); - break; - } + live++; } p++; } @@ -971,7 +946,9 @@ gc_sweep() freed += n; } } - malloc_limit = live; + malloc_limit += malloc_increase; + malloc_limit *= (double)live / (live + freed); + if (malloc_limit < GC_MALLOC_LIMIT) malloc_limit = GC_MALLOC_LIMIT; malloc_increase = 0; if (freed < FREE_MIN) { add_heap(); diff --git a/hash.c b/hash.c index d579e307d6..f2014a4d96 100644 --- a/hash.c +++ b/hash.c @@ -120,7 +120,7 @@ static struct st_hash_type objhash = { struct rb_hash_foreach_arg { VALUE hash; enum st_retval (*func)(); - char *arg; + VALUE arg; }; static int @@ -167,7 +167,7 @@ static int rb_hash_foreach(hash, func, farg) VALUE hash; enum st_retval (*func)(); - char *farg; + VALUE farg; { struct rb_hash_foreach_arg arg; @@ -462,7 +462,7 @@ rb_hash_shift(hash) } } -static int +static enum st_retval delete_if_i(key, value) VALUE key, value; { @@ -498,9 +498,9 @@ rb_hash_reject(hash) return rb_hash_delete_if(rb_obj_dup(hash)); } -static int +static enum st_retval select_i(key, value, result) - VALUE key, value; + VALUE key, value, result; { VALUE assoc; @@ -611,7 +611,7 @@ rb_hash_empty_p(hash) return Qfalse; } -static int +static enum st_retval each_value_i(key, value) VALUE key, value; { @@ -628,7 +628,7 @@ rb_hash_each_value(hash) return hash; } -static int +static enum st_retval each_key_i(key, value) VALUE key, value; { @@ -645,7 +645,7 @@ rb_hash_each_key(hash) return hash; } -static int +static enum st_retval each_pair_i(key, value) VALUE key, value; { @@ -1076,7 +1076,7 @@ rb_env_path_tainted() static int envix(nam) -char *nam; +const char *nam; { register int i, len = strlen(nam); char **env; diff --git a/range.c b/range.c index bb12bc38c2..3b56ee7d0b 100644 --- a/range.c +++ b/range.c @@ -208,7 +208,7 @@ step_i(i, iter) static void range_each_func(range, func, v, e, arg) VALUE range; - void (*func) _((VALUE, void*)); + VALUE (*func) _((VALUE, void*)); VALUE v, e; void *arg; {