1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2002-12-29 14:51:22 +00:00
parent 0569c8422c
commit 05b990b7c1
6 changed files with 35 additions and 44 deletions

View file

@ -1,3 +1,16 @@
Sun Dec 29 23:45:53 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* 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 <aamine@loveruby.net> Sun Dec 29 15:30:37 2002 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb (fu_parseargs): should not inherit ftools.rb's * lib/fileutils.rb (fu_parseargs): should not inherit ftools.rb's

11
dln.c
View file

@ -107,17 +107,18 @@ int eaccess();
static int static int
init_funcname_len(buf, file) init_funcname_len(buf, file)
char **buf; char **buf;
char *file; const char *file;
{ {
char *p, *slash; char *p;
const char *slash;
int len; int len;
/* Load the file as an object one */ /* 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__ #ifdef __MACOS__
if (*p == ':') slash = p; if (*file == ':') slash = file;
#else #else
if (*p == '/') slash = p; if (*file == '/') slash = file;
#endif #endif
len = strlen(FUNCNAME_PATTERN) + strlen(slash + 1); len = strlen(FUNCNAME_PATTERN) + strlen(slash + 1);

2
eval.c
View file

@ -1766,7 +1766,7 @@ rb_mod_alias_method(mod, newname, oldname)
static NODE* static NODE*
copy_node_scope(node, rval) copy_node_scope(node, rval)
NODE *node; NODE *node;
VALUE rval; NODE *rval;
{ {
NODE *copy = rb_node_newnode(NODE_SCOPE,0,rval,node->nd_next); NODE *copy = rb_node_newnode(NODE_SCOPE,0,rval,node->nd_next);

33
gc.c
View file

@ -879,7 +879,7 @@ gc_sweep()
RVALUE *p, *pend, *final_list; RVALUE *p, *pend, *final_list;
int freed = 0; int freed = 0;
int i, j; int i, j;
unsigned long live = 0; unsigned long live = 0, garbage = 0;
if (ruby_in_compile && ruby_parser_stack_on_heap()) { if (ruby_in_compile && ruby_parser_stack_on_heap()) {
/* should not reclaim nodes during compilation /* should not reclaim nodes during compilation
@ -929,32 +929,7 @@ gc_sweep()
} }
else { else {
RBASIC(p)->flags &= ~FL_MARK; RBASIC(p)->flags &= ~FL_MARK;
live += sizeof(VALUE); live++;
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;
}
} }
p++; p++;
} }
@ -971,7 +946,9 @@ gc_sweep()
freed += n; 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; malloc_increase = 0;
if (freed < FREE_MIN) { if (freed < FREE_MIN) {
add_heap(); add_heap();

18
hash.c
View file

@ -120,7 +120,7 @@ static struct st_hash_type objhash = {
struct rb_hash_foreach_arg { struct rb_hash_foreach_arg {
VALUE hash; VALUE hash;
enum st_retval (*func)(); enum st_retval (*func)();
char *arg; VALUE arg;
}; };
static int static int
@ -167,7 +167,7 @@ static int
rb_hash_foreach(hash, func, farg) rb_hash_foreach(hash, func, farg)
VALUE hash; VALUE hash;
enum st_retval (*func)(); enum st_retval (*func)();
char *farg; VALUE farg;
{ {
struct rb_hash_foreach_arg arg; 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) delete_if_i(key, value)
VALUE key, value; VALUE key, value;
{ {
@ -498,9 +498,9 @@ rb_hash_reject(hash)
return rb_hash_delete_if(rb_obj_dup(hash)); return rb_hash_delete_if(rb_obj_dup(hash));
} }
static int static enum st_retval
select_i(key, value, result) select_i(key, value, result)
VALUE key, value; VALUE key, value, result;
{ {
VALUE assoc; VALUE assoc;
@ -611,7 +611,7 @@ rb_hash_empty_p(hash)
return Qfalse; return Qfalse;
} }
static int static enum st_retval
each_value_i(key, value) each_value_i(key, value)
VALUE key, value; VALUE key, value;
{ {
@ -628,7 +628,7 @@ rb_hash_each_value(hash)
return hash; return hash;
} }
static int static enum st_retval
each_key_i(key, value) each_key_i(key, value)
VALUE key, value; VALUE key, value;
{ {
@ -645,7 +645,7 @@ rb_hash_each_key(hash)
return hash; return hash;
} }
static int static enum st_retval
each_pair_i(key, value) each_pair_i(key, value)
VALUE key, value; VALUE key, value;
{ {
@ -1076,7 +1076,7 @@ rb_env_path_tainted()
static int static int
envix(nam) envix(nam)
char *nam; const char *nam;
{ {
register int i, len = strlen(nam); register int i, len = strlen(nam);
char **env; char **env;

View file

@ -208,7 +208,7 @@ step_i(i, iter)
static void static void
range_each_func(range, func, v, e, arg) range_each_func(range, func, v, e, arg)
VALUE range; VALUE range;
void (*func) _((VALUE, void*)); VALUE (*func) _((VALUE, void*));
VALUE v, e; VALUE v, e;
void *arg; void *arg;
{ {