mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
to rb_gc_register_mark_object(). * eval.c, vm.c: initialize vm->mark_object_ary at Init_top_self(). * bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c, io.c, load.c, marshal.c, rational.c, ruby.c, vm.c: use rb_gc_register_mark_object() instead of rb_global_variable() or rb_gc_register_address(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b121e47b44
commit
69029b90fe
14 changed files with 42 additions and 28 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Mon Sep 15 23:52:45 2008 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
|
||||
to rb_gc_register_mark_object().
|
||||
|
||||
* eval.c, vm.c: initialize vm->mark_object_ary at
|
||||
Init_top_self().
|
||||
|
||||
* bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c,
|
||||
io.c, load.c, marshal.c, rational.c, ruby.c, vm.c:
|
||||
use rb_gc_register_mark_object() instead of
|
||||
rb_global_variable() or rb_gc_register_address().
|
||||
|
||||
Mon Sep 15 23:37:15 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* transcode.c (econv_opts): don't use to_sym.
|
||||
|
|
2
bignum.c
2
bignum.c
|
@ -774,7 +774,7 @@ power_cache_get_power0(int base, int i)
|
|||
big2str_power_cache[base - 2][i] =
|
||||
i == 0 ? rb_big_pow(rb_int2big(base), INT2FIX(KARATSUBA_DIGITS))
|
||||
: bigsqr(power_cache_get_power0(base, i - 1));
|
||||
rb_global_variable(&big2str_power_cache[base - 2][i]);
|
||||
rb_gc_register_mark_object(big2str_power_cache[base - 2][i]);
|
||||
}
|
||||
return big2str_power_cache[base - 2][i];
|
||||
}
|
||||
|
|
16
complex.c
16
complex.c
|
@ -1056,29 +1056,29 @@ make_patterns(void)
|
|||
if (comp_pat0) return;
|
||||
|
||||
comp_pat0 = rb_reg_new(comp_pat0_source, sizeof comp_pat0_source - 1, 0);
|
||||
rb_global_variable(&comp_pat0);
|
||||
rb_gc_register_mark_object(comp_pat0);
|
||||
|
||||
comp_pat1 = rb_reg_new(comp_pat1_source, sizeof comp_pat1_source - 1, 0);
|
||||
rb_global_variable(&comp_pat1);
|
||||
rb_gc_register_mark_object(comp_pat1);
|
||||
|
||||
comp_pat2 = rb_reg_new(comp_pat2_source, sizeof comp_pat2_source - 1, 0);
|
||||
rb_global_variable(&comp_pat2);
|
||||
rb_gc_register_mark_object(comp_pat2);
|
||||
|
||||
a_slash = rb_str_new2("/");
|
||||
rb_global_variable(&a_slash);
|
||||
rb_gc_register_mark_object(a_slash);
|
||||
|
||||
a_dot_and_an_e = rb_str_new2(".eE");
|
||||
rb_global_variable(&a_dot_and_an_e);
|
||||
rb_gc_register_mark_object(a_dot_and_an_e);
|
||||
|
||||
null_string = rb_str_new2("");
|
||||
rb_global_variable(&null_string);
|
||||
rb_gc_register_mark_object(null_string);
|
||||
|
||||
underscores_pat = rb_reg_new(underscores_pat_source,
|
||||
sizeof underscores_pat_source - 1, 0);
|
||||
rb_global_variable(&underscores_pat);
|
||||
rb_gc_register_mark_object(underscores_pat);
|
||||
|
||||
an_underscore = rb_str_new2("_");
|
||||
rb_global_variable(&an_underscore);
|
||||
rb_gc_register_mark_object(an_underscore);
|
||||
}
|
||||
|
||||
#define id_match rb_intern("match")
|
||||
|
|
|
@ -1225,10 +1225,11 @@ Init_Encoding(void)
|
|||
rb_define_singleton_method(rb_cEncoding, "default_external", get_default_external, 0);
|
||||
rb_define_singleton_method(rb_cEncoding, "locale_charmap", rb_locale_charmap, 0);
|
||||
|
||||
rb_gc_register_address(&rb_encoding_list);
|
||||
list = rb_ary_new2(enc_table.count);
|
||||
RBASIC(list)->klass = 0;
|
||||
rb_encoding_list = list;
|
||||
rb_gc_register_mark_object(list);
|
||||
|
||||
for (i = 0; i < enc_table.count; ++i) {
|
||||
rb_ary_push(list, enc_new(enc_table.list[i].enc));
|
||||
}
|
||||
|
|
3
eval.c
3
eval.c
|
@ -1129,9 +1129,6 @@ rb_f_method_name(void)
|
|||
void
|
||||
Init_eval(void)
|
||||
{
|
||||
/* TODO: fix position */
|
||||
GET_THREAD()->vm->mark_object_ary = rb_ary_new();
|
||||
|
||||
rb_define_virtual_variable("$@", errat_getter, errat_setter);
|
||||
rb_define_virtual_variable("$!", errinfo_getter, 0);
|
||||
|
||||
|
|
|
@ -8797,7 +8797,7 @@ void
|
|||
Init_win32ole()
|
||||
{
|
||||
ary_ole_event = rb_ary_new();
|
||||
rb_register_mark_object(ary_ole_event);
|
||||
rb_gc_register_mark_object(ary_ole_event);
|
||||
id_events = rb_intern("events");
|
||||
|
||||
com_vtbl.QueryInterface = QueryInterface;
|
||||
|
@ -8816,7 +8816,7 @@ Init_win32ole()
|
|||
message_filter.MessagePending = mf_MessagePending;
|
||||
|
||||
com_hash = Data_Wrap_Struct(rb_cData, rb_mark_hash, st_free_table, st_init_numtable());
|
||||
rb_register_mark_object(com_hash);
|
||||
rb_gc_register_mark_object(com_hash);
|
||||
|
||||
cWIN32OLE = rb_define_class("WIN32OLE", rb_cObject);
|
||||
|
||||
|
|
2
gc.c
2
gc.c
|
@ -722,7 +722,7 @@ rb_gc_disable(void)
|
|||
VALUE rb_mGC;
|
||||
|
||||
void
|
||||
rb_register_mark_object(VALUE obj)
|
||||
rb_gc_register_mark_object(VALUE obj)
|
||||
{
|
||||
VALUE ary = GET_THREAD()->vm->mark_object_ary;
|
||||
rb_ary_push(ary, obj);
|
||||
|
|
|
@ -851,7 +851,7 @@ void rb_define_alias(VALUE,const char*,const char*);
|
|||
void rb_define_attr(VALUE,const char*,int,int);
|
||||
|
||||
void rb_global_variable(VALUE*);
|
||||
void rb_register_mark_object(VALUE);
|
||||
void rb_gc_register_mark_object(VALUE);
|
||||
void rb_gc_register_address(VALUE*);
|
||||
void rb_gc_unregister_address(VALUE*);
|
||||
|
||||
|
|
2
io.c
2
io.c
|
@ -8180,8 +8180,8 @@ Init_IO(void)
|
|||
rb_output_fs = Qnil;
|
||||
rb_define_hooked_variable("$,", &rb_output_fs, 0, rb_str_setter);
|
||||
|
||||
rb_global_variable(&rb_default_rs);
|
||||
rb_rs = rb_default_rs = rb_str_new2("\n");
|
||||
rb_gc_register_mark_object(rb_default_rs);
|
||||
rb_output_rs = Qnil;
|
||||
OBJ_FREEZE(rb_default_rs); /* avoid modifying RS_default */
|
||||
rb_define_hooked_variable("$/", &rb_rs, 0, rb_str_setter);
|
||||
|
|
2
load.c
2
load.c
|
@ -698,5 +698,5 @@ Init_load()
|
|||
rb_define_global_function("autoload?", rb_f_autoload_p, 1);
|
||||
|
||||
ruby_dln_librefs = rb_ary_new();
|
||||
rb_register_mark_object(ruby_dln_librefs);
|
||||
rb_gc_register_mark_object(ruby_dln_librefs);
|
||||
}
|
||||
|
|
|
@ -1723,9 +1723,9 @@ Init_marshal(void)
|
|||
rb_define_const(rb_mMarshal, "MINOR_VERSION", INT2FIX(MARSHAL_MINOR));
|
||||
|
||||
compat_allocator_tbl = st_init_numtable();
|
||||
rb_gc_register_address(&compat_allocator_tbl_wrapper);
|
||||
compat_allocator_tbl_wrapper =
|
||||
Data_Wrap_Struct(rb_cData, mark_marshal_compat_t, 0, compat_allocator_tbl);
|
||||
rb_gc_register_mark_object(compat_allocator_tbl_wrapper);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
|
10
rational.c
10
rational.c
|
@ -1252,20 +1252,20 @@ make_patterns(void)
|
|||
if (rat_pat) return;
|
||||
|
||||
rat_pat = rb_reg_new(rat_pat_source, sizeof rat_pat_source - 1, 0);
|
||||
rb_global_variable(&rat_pat);
|
||||
rb_gc_register_mark_object(rat_pat);
|
||||
|
||||
an_e_pat = rb_reg_new(an_e_pat_source, sizeof an_e_pat_source - 1, 0);
|
||||
rb_global_variable(&an_e_pat);
|
||||
rb_gc_register_mark_object(an_e_pat);
|
||||
|
||||
a_dot_pat = rb_reg_new(a_dot_pat_source, sizeof a_dot_pat_source - 1, 0);
|
||||
rb_global_variable(&a_dot_pat);
|
||||
rb_gc_register_mark_object(a_dot_pat);
|
||||
|
||||
underscores_pat = rb_reg_new(underscores_pat_source,
|
||||
sizeof underscores_pat_source - 1, 0);
|
||||
rb_global_variable(&underscores_pat);
|
||||
rb_gc_register_mark_object(underscores_pat);
|
||||
|
||||
an_underscore = rb_str_new2("_");
|
||||
rb_global_variable(&an_underscore);
|
||||
rb_gc_register_mark_object(an_underscore);
|
||||
}
|
||||
|
||||
#define id_match rb_intern("match")
|
||||
|
|
2
ruby.c
2
ruby.c
|
@ -1478,7 +1478,6 @@ ruby_prog_init(void)
|
|||
rb_define_hooked_variable("$PROGRAM_NAME", &rb_progname, 0, set_arg0);
|
||||
|
||||
rb_define_global_const("ARGV", rb_argv);
|
||||
rb_global_variable(&rb_argv0);
|
||||
|
||||
#ifdef MSDOS
|
||||
/*
|
||||
|
@ -1535,6 +1534,7 @@ ruby_process_options(int argc, char **argv)
|
|||
|
||||
ruby_script(argv[0]); /* for the time being */
|
||||
rb_argv0 = rb_str_new4(rb_progname);
|
||||
rb_gc_register_mark_object(rb_argv0);
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
args.opt = cmdline_options_init(&opt);
|
||||
|
|
7
vm.c
7
vm.c
|
@ -1820,7 +1820,7 @@ Init_VM(void)
|
|||
rb_define_method_id(klass, id_core_define_singleton_method, m_core_define_singleton_method, 3);
|
||||
rb_define_method_id(klass, id_core_set_postexe, m_core_set_postexe, 1);
|
||||
rb_obj_freeze(fcore);
|
||||
rb_global_variable(&rb_mRubyVMFrozenCore);
|
||||
rb_gc_register_mark_object(fcore);
|
||||
rb_mRubyVMFrozenCore = fcore;
|
||||
|
||||
/* ::VM::Env */
|
||||
|
@ -1901,7 +1901,7 @@ Init_VM(void)
|
|||
vm->living_threads = st_init_numtable();
|
||||
st_insert(vm->living_threads, th_self, (st_data_t) th->thread_id);
|
||||
|
||||
rb_register_mark_object(iseqval);
|
||||
rb_gc_register_mark_object(iseqval);
|
||||
GetISeqPtr(iseqval, iseq);
|
||||
th->cfp->iseq = iseq;
|
||||
th->cfp->pc = iseq->iseq_encoded;
|
||||
|
@ -1960,6 +1960,9 @@ Init_top_self(void)
|
|||
|
||||
vm->top_self = rb_obj_alloc(rb_cObject);
|
||||
rb_define_singleton_method(rb_vm_top_self(), "to_s", main_to_s, 0);
|
||||
|
||||
/* initialize mark object array */
|
||||
vm->mark_object_ary = rb_ary_new();
|
||||
}
|
||||
|
||||
VALUE *
|
||||
|
|
Loading…
Add table
Reference in a new issue