mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer), (run_final), hash.c (rb_hash_aref, rb_hash_lookup2), (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i), iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink), thread.c (rb_thread_local_aref), variable.c (generic_ivar_remove, ivar_get, rb_const_get_0), (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method), vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method), ext/iconv/iconv.c (map_charset): use st_data_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									17c48bebf8
								
							
						
					
					
						commit
						d410639a6d
					
				
					 13 changed files with 73 additions and 40 deletions
				
			
		
							
								
								
									
										13
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,4 +1,15 @@
 | 
			
		|||
Tue Oct 12 23:35:37 2010  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
Tue Oct 12 23:47:18 2010  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
 | 
			
		||||
	  (syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
 | 
			
		||||
	  (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
 | 
			
		||||
	  (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
 | 
			
		||||
	  iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
 | 
			
		||||
	  thread.c (rb_thread_local_aref),
 | 
			
		||||
	  variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
 | 
			
		||||
	  (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
 | 
			
		||||
	  vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
 | 
			
		||||
	  ext/iconv/iconv.c (map_charset): use st_data_t.
 | 
			
		||||
 | 
			
		||||
	* compile.c (iseq_build_body), insns.def (getglobal, setglobal),
 | 
			
		||||
	  iseq.c (iseq_load, iseq_data_to_ary), util.c (valid_filename):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5257,11 +5257,11 @@ iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
 | 
			
		|||
	else if (TYPE(obj) == T_ARRAY) {
 | 
			
		||||
	    VALUE *argv = 0;
 | 
			
		||||
	    int argc = RARRAY_LENINT(obj) - 1;
 | 
			
		||||
	    VALUE insn_id;
 | 
			
		||||
	    st_data_t insn_id;
 | 
			
		||||
	    VALUE insn;
 | 
			
		||||
 | 
			
		||||
	    insn = (argc < 0) ? Qnil : RARRAY_PTR(obj)[0];
 | 
			
		||||
	    if (st_lookup(insn_table, insn, &insn_id) == 0) {
 | 
			
		||||
	    if (st_lookup(insn_table, (st_data_t)insn, &insn_id) == 0) {
 | 
			
		||||
		/* TODO: exception */
 | 
			
		||||
		RB_GC_GUARD(insn) = rb_inspect(insn);
 | 
			
		||||
		rb_compile_error(RSTRING_PTR(iseq->filename), line_no,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										8
									
								
								error.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								error.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -980,7 +980,7 @@ static st_table *syserr_tbl;
 | 
			
		|||
static VALUE
 | 
			
		||||
set_syserr(int n, const char *name)
 | 
			
		||||
{
 | 
			
		||||
    VALUE error;
 | 
			
		||||
    st_data_t error;
 | 
			
		||||
 | 
			
		||||
    if (!st_lookup(syserr_tbl, n, &error)) {
 | 
			
		||||
	error = rb_define_class_under(rb_mErrno, name, rb_eSystemCallError);
 | 
			
		||||
| 
						 | 
				
			
			@ -996,7 +996,7 @@ set_syserr(int n, const char *name)
 | 
			
		|||
static VALUE
 | 
			
		||||
get_syserr(int n)
 | 
			
		||||
{
 | 
			
		||||
    VALUE error;
 | 
			
		||||
    st_data_t error;
 | 
			
		||||
 | 
			
		||||
    if (!st_lookup(syserr_tbl, n, &error)) {
 | 
			
		||||
	char name[8];	/* some Windows' errno have 5 digits. */
 | 
			
		||||
| 
						 | 
				
			
			@ -1029,11 +1029,13 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
 | 
			
		|||
    VALUE klass = rb_obj_class(self);
 | 
			
		||||
 | 
			
		||||
    if (klass == rb_eSystemCallError) {
 | 
			
		||||
	st_data_t data = (st_data_t)klass;
 | 
			
		||||
	rb_scan_args(argc, argv, "11", &mesg, &error);
 | 
			
		||||
	if (argc == 1 && FIXNUM_P(mesg)) {
 | 
			
		||||
	    error = mesg; mesg = Qnil;
 | 
			
		||||
	}
 | 
			
		||||
	if (!NIL_P(error) && st_lookup(syserr_tbl, NUM2LONG(error), &klass)) {
 | 
			
		||||
	if (!NIL_P(error) && st_lookup(syserr_tbl, NUM2LONG(error), &data)) {
 | 
			
		||||
	    klass = (VALUE)data;
 | 
			
		||||
	    /* change class */
 | 
			
		||||
	    if (TYPE(self) != T_OBJECT) { /* insurance to avoid type crash */
 | 
			
		||||
		rb_raise(rb_eTypeError, "invalid instance type");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -164,10 +164,11 @@ map_charset(VALUE *code)
 | 
			
		|||
    VALUE val = StringValue(*code);
 | 
			
		||||
 | 
			
		||||
    if (RHASH_SIZE(charset_map)) {
 | 
			
		||||
	st_data_t data;
 | 
			
		||||
	VALUE key = rb_funcall2(val, rb_intern("downcase"), 0, 0);
 | 
			
		||||
	StringValuePtr(key);
 | 
			
		||||
	if (st_lookup(RHASH_TBL(charset_map), key, &val)) {
 | 
			
		||||
	    *code = val;
 | 
			
		||||
	if (st_lookup(RHASH_TBL(charset_map), key, &data)) {
 | 
			
		||||
	    *code = (VALUE)data;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    return StringValuePtr(*code);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								gc.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								gc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2699,6 +2699,7 @@ define_final(int argc, VALUE *argv, VALUE os)
 | 
			
		|||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    VALUE obj, block, table;
 | 
			
		||||
    st_data_t data;
 | 
			
		||||
 | 
			
		||||
    rb_scan_args(argc, argv, "11", &obj, &block);
 | 
			
		||||
    if (OBJ_FROZEN(obj)) rb_error_frozen("object");
 | 
			
		||||
| 
						 | 
				
			
			@ -2721,7 +2722,8 @@ define_final(int argc, VALUE *argv, VALUE os)
 | 
			
		|||
    if (!finalizer_table) {
 | 
			
		||||
	finalizer_table = st_init_numtable();
 | 
			
		||||
    }
 | 
			
		||||
    if (st_lookup(finalizer_table, obj, &table)) {
 | 
			
		||||
    if (st_lookup(finalizer_table, obj, &data)) {
 | 
			
		||||
	table = (VALUE)data;
 | 
			
		||||
	rb_ary_push(table, block);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
| 
						 | 
				
			
			@ -2737,10 +2739,12 @@ rb_gc_copy_finalizer(VALUE dest, VALUE obj)
 | 
			
		|||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    VALUE table;
 | 
			
		||||
    st_data_t data;
 | 
			
		||||
 | 
			
		||||
    if (!finalizer_table) return;
 | 
			
		||||
    if (!FL_TEST(obj, FL_FINALIZE)) return;
 | 
			
		||||
    if (st_lookup(finalizer_table, obj, &table)) {
 | 
			
		||||
    if (st_lookup(finalizer_table, obj, &data)) {
 | 
			
		||||
	table = (VALUE)data;
 | 
			
		||||
	st_insert(finalizer_table, dest, table);
 | 
			
		||||
    }
 | 
			
		||||
    FL_SET(dest, FL_FINALIZE);
 | 
			
		||||
| 
						 | 
				
			
			@ -2777,8 +2781,9 @@ run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE objid, VALUE table)
 | 
			
		|||
static void
 | 
			
		||||
run_final(rb_objspace_t *objspace, VALUE obj)
 | 
			
		||||
{
 | 
			
		||||
    VALUE table, objid;
 | 
			
		||||
    VALUE objid;
 | 
			
		||||
    RUBY_DATA_FUNC free_func = 0;
 | 
			
		||||
    st_data_t key, table;
 | 
			
		||||
 | 
			
		||||
    objid = rb_obj_id(obj);	/* make obj into id */
 | 
			
		||||
    RBASIC(obj)->klass = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -2793,9 +2798,10 @@ run_final(rb_objspace_t *objspace, VALUE obj)
 | 
			
		|||
	(*free_func)(DATA_PTR(obj));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    key = (st_data_t)obj;
 | 
			
		||||
    if (finalizer_table &&
 | 
			
		||||
	st_delete(finalizer_table, (st_data_t*)&obj, &table)) {
 | 
			
		||||
	run_finalizer(objspace, obj, objid, table);
 | 
			
		||||
	st_delete(finalizer_table, &key, &table)) {
 | 
			
		||||
	run_finalizer(objspace, obj, objid, (VALUE)table);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										24
									
								
								hash.c
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								hash.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -506,23 +506,23 @@ rb_hash_rehash(VALUE hash)
 | 
			
		|||
VALUE
 | 
			
		||||
rb_hash_aref(VALUE hash, VALUE key)
 | 
			
		||||
{
 | 
			
		||||
    VALUE val;
 | 
			
		||||
    st_data_t val;
 | 
			
		||||
 | 
			
		||||
    if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
 | 
			
		||||
	return rb_funcall(hash, id_default, 1, key);
 | 
			
		||||
    }
 | 
			
		||||
    return val;
 | 
			
		||||
    return (VALUE)val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_hash_lookup2(VALUE hash, VALUE key, VALUE def)
 | 
			
		||||
{
 | 
			
		||||
    VALUE val;
 | 
			
		||||
    st_data_t val;
 | 
			
		||||
 | 
			
		||||
    if (!RHASH(hash)->ntbl || !st_lookup(RHASH(hash)->ntbl, key, &val)) {
 | 
			
		||||
	return def; /* without Hash#default */
 | 
			
		||||
    }
 | 
			
		||||
    return val;
 | 
			
		||||
    return (VALUE)val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -564,7 +564,7 @@ static VALUE
 | 
			
		|||
rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash)
 | 
			
		||||
{
 | 
			
		||||
    VALUE key, if_none;
 | 
			
		||||
    VALUE val;
 | 
			
		||||
    st_data_t val;
 | 
			
		||||
    long block_given;
 | 
			
		||||
 | 
			
		||||
    rb_scan_args(argc, argv, "11", &key, &if_none);
 | 
			
		||||
| 
						 | 
				
			
			@ -584,7 +584,7 @@ rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash)
 | 
			
		|||
	}
 | 
			
		||||
	return if_none;
 | 
			
		||||
    }
 | 
			
		||||
    return val;
 | 
			
		||||
    return (VALUE)val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -1094,6 +1094,12 @@ rb_hash_clear(VALUE hash)
 | 
			
		|||
    return hash;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static st_data_t
 | 
			
		||||
copy_str_key(st_data_t str)
 | 
			
		||||
{
 | 
			
		||||
    return (st_data_t)rb_str_new4((VALUE)str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     hsh[key] = value        -> value
 | 
			
		||||
| 
						 | 
				
			
			@ -1121,7 +1127,7 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
 | 
			
		|||
	st_insert(RHASH(hash)->ntbl, key, val);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	st_insert2(RHASH(hash)->ntbl, key, val, rb_str_new4);
 | 
			
		||||
	st_insert2(RHASH(hash)->ntbl, key, val, copy_str_key);
 | 
			
		||||
    }
 | 
			
		||||
    return val;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1548,14 +1554,14 @@ static int
 | 
			
		|||
eql_i(VALUE key, VALUE val1, VALUE arg)
 | 
			
		||||
{
 | 
			
		||||
    struct equal_data *data = (struct equal_data *)arg;
 | 
			
		||||
    VALUE val2;
 | 
			
		||||
    st_data_t val2;
 | 
			
		||||
 | 
			
		||||
    if (key == Qundef) return ST_CONTINUE;
 | 
			
		||||
    if (!st_lookup(data->tbl, key, &val2)) {
 | 
			
		||||
	data->result = Qfalse;
 | 
			
		||||
	return ST_STOP;
 | 
			
		||||
    }
 | 
			
		||||
    if (!(data->eql ? rb_eql(val1, val2) : (int)rb_equal(val1, val2))) {
 | 
			
		||||
    if (!(data->eql ? rb_eql(val1, (VALUE)val2) : (int)rb_equal(val1, (VALUE)val2))) {
 | 
			
		||||
	data->result = Qfalse;
 | 
			
		||||
	return ST_STOP;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								iseq.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								iseq.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -446,7 +446,7 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
 | 
			
		|||
    VALUE name, filename, filepath, line_no;
 | 
			
		||||
    VALUE type, body, locals, args, exception;
 | 
			
		||||
 | 
			
		||||
    VALUE iseq_type;
 | 
			
		||||
    st_data_t iseq_type;
 | 
			
		||||
    struct st_table *type_map = 0;
 | 
			
		||||
    rb_iseq_t *iseq;
 | 
			
		||||
    rb_compile_option_t option;
 | 
			
		||||
| 
						 | 
				
			
			@ -1304,7 +1304,7 @@ iseq_data_to_ary(rb_iseq_t *iseq)
 | 
			
		|||
 | 
			
		||||
    for (i=0, pos=0; i<RARRAY_LEN(nbody); i++) {
 | 
			
		||||
	VALUE ary = RARRAY_PTR(nbody)[i];
 | 
			
		||||
	VALUE label;
 | 
			
		||||
	st_data_t label;
 | 
			
		||||
 | 
			
		||||
	if (st_lookup(labels_table, pos, &label)) {
 | 
			
		||||
	    rb_ary_push(body, (VALUE)label);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1137,11 +1137,11 @@ id2encidx(ID id, VALUE val)
 | 
			
		|||
static ID
 | 
			
		||||
r_symlink(struct load_arg *arg)
 | 
			
		||||
{
 | 
			
		||||
    ID id;
 | 
			
		||||
    st_data_t id;
 | 
			
		||||
    long num = r_long(arg);
 | 
			
		||||
 | 
			
		||||
    if (st_lookup(arg->symbols, num, &id)) {
 | 
			
		||||
	return id;
 | 
			
		||||
	return (ID)id;
 | 
			
		||||
    }
 | 
			
		||||
    rb_raise(rb_eArgError, "bad symbol");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								thread.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								thread.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1986,7 +1986,7 @@ VALUE
 | 
			
		|||
rb_thread_local_aref(VALUE thread, ID id)
 | 
			
		||||
{
 | 
			
		||||
    rb_thread_t *th;
 | 
			
		||||
    VALUE val;
 | 
			
		||||
    st_data_t val;
 | 
			
		||||
 | 
			
		||||
    GetThreadPtr(thread, th);
 | 
			
		||||
    if (rb_safe_level() >= 4 && th != GET_THREAD()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1996,7 +1996,7 @@ rb_thread_local_aref(VALUE thread, ID id)
 | 
			
		|||
	return Qnil;
 | 
			
		||||
    }
 | 
			
		||||
    if (st_lookup(th->local_storage, id, &val)) {
 | 
			
		||||
	return val;
 | 
			
		||||
	return (VALUE)val;
 | 
			
		||||
    }
 | 
			
		||||
    return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										20
									
								
								variable.c
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								variable.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -885,15 +885,16 @@ static int
 | 
			
		|||
generic_ivar_remove(VALUE obj, ID id, st_data_t *valp)
 | 
			
		||||
{
 | 
			
		||||
    st_table *tbl;
 | 
			
		||||
    st_data_t data;
 | 
			
		||||
    st_data_t data, key = (st_data_t)id;
 | 
			
		||||
    int status;
 | 
			
		||||
 | 
			
		||||
    if (!generic_iv_tbl) return 0;
 | 
			
		||||
    if (!st_lookup(generic_iv_tbl, (st_data_t)obj, &data)) return 0;
 | 
			
		||||
    tbl = (st_table *)data;
 | 
			
		||||
    status = st_delete(tbl, &id, valp);
 | 
			
		||||
    status = st_delete(tbl, &key, valp);
 | 
			
		||||
    if (tbl->num_entries == 0) {
 | 
			
		||||
	st_delete(generic_iv_tbl, &obj, &data);
 | 
			
		||||
	key = (st_data_t)obj;
 | 
			
		||||
	st_delete(generic_iv_tbl, &key, &data);
 | 
			
		||||
	st_free_table((st_table *)data);
 | 
			
		||||
    }
 | 
			
		||||
    return status;
 | 
			
		||||
| 
						 | 
				
			
			@ -1006,8 +1007,8 @@ ivar_get(VALUE obj, ID id, int warn)
 | 
			
		|||
	break;
 | 
			
		||||
      case T_CLASS:
 | 
			
		||||
      case T_MODULE:
 | 
			
		||||
	if (RCLASS_IV_TBL(obj) && st_lookup(RCLASS_IV_TBL(obj), (st_data_t)id, &val))
 | 
			
		||||
	    return val;
 | 
			
		||||
	if (RCLASS_IV_TBL(obj) && st_lookup(RCLASS_IV_TBL(obj), (st_data_t)id, &index))
 | 
			
		||||
	    return (VALUE)index;
 | 
			
		||||
	break;
 | 
			
		||||
      default:
 | 
			
		||||
	if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj))
 | 
			
		||||
| 
						 | 
				
			
			@ -1575,7 +1576,9 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse)
 | 
			
		|||
  retry:
 | 
			
		||||
    while (RTEST(tmp)) {
 | 
			
		||||
	VALUE am = 0;
 | 
			
		||||
	while (RCLASS_IV_TBL(tmp) && st_lookup(RCLASS_IV_TBL(tmp), (st_data_t)id, &value)) {
 | 
			
		||||
	st_data_t data;
 | 
			
		||||
	while (RCLASS_IV_TBL(tmp) && st_lookup(RCLASS_IV_TBL(tmp), (st_data_t)id, &data)) {
 | 
			
		||||
	    value = (VALUE)data;
 | 
			
		||||
	    if (value == Qundef) {
 | 
			
		||||
		if (am == tmp) break;
 | 
			
		||||
		am = tmp;
 | 
			
		||||
| 
						 | 
				
			
			@ -1937,7 +1940,8 @@ rb_cvar_set(VALUE klass, ID id, VALUE val)
 | 
			
		|||
VALUE
 | 
			
		||||
rb_cvar_get(VALUE klass, ID id)
 | 
			
		||||
{
 | 
			
		||||
    VALUE value, tmp, front = 0, target = 0;
 | 
			
		||||
    VALUE tmp, front = 0, target = 0;
 | 
			
		||||
    st_data_t value;
 | 
			
		||||
 | 
			
		||||
    tmp = klass;
 | 
			
		||||
    CVAR_LOOKUP(&value, {if (!front) front = klass; target = klass;});
 | 
			
		||||
| 
						 | 
				
			
			@ -1957,7 +1961,7 @@ rb_cvar_get(VALUE klass, ID id)
 | 
			
		|||
	    st_delete(RCLASS_IV_TBL(front),&did,0);
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    return value;
 | 
			
		||||
    return (VALUE)value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								vm.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								vm.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -948,7 +948,7 @@ static st_table *vm_opt_method_table = 0;
 | 
			
		|||
static void
 | 
			
		||||
rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me)
 | 
			
		||||
{
 | 
			
		||||
    VALUE bop;
 | 
			
		||||
    st_data_t bop;
 | 
			
		||||
    if (!me->def || me->def->type == VM_METHOD_TYPE_CFUNC) {
 | 
			
		||||
	if (st_lookup(vm_opt_method_table, (st_data_t)me, &bop)) {
 | 
			
		||||
	    ruby_vm_redefined_flag[bop] = 1;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1167,9 +1167,11 @@ vm_get_ev_const(rb_thread_t *th, const rb_iseq_t *iseq,
 | 
			
		|||
 | 
			
		||||
	    if (!NIL_P(klass)) {
 | 
			
		||||
		VALUE am = 0;
 | 
			
		||||
		st_data_t data;
 | 
			
		||||
	      search_continue:
 | 
			
		||||
		if (RCLASS_IV_TBL(klass) &&
 | 
			
		||||
		    st_lookup(RCLASS_IV_TBL(klass), id, &val)) {
 | 
			
		||||
		    st_lookup(RCLASS_IV_TBL(klass), id, &data)) {
 | 
			
		||||
		    val = (st_data_t)data;
 | 
			
		||||
		    if (val == Qundef) {
 | 
			
		||||
			if (am == klass) break;
 | 
			
		||||
			am = klass;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -454,7 +454,7 @@ rb_method_entry(VALUE klass, ID id)
 | 
			
		|||
static void
 | 
			
		||||
remove_method(VALUE klass, ID mid)
 | 
			
		||||
{
 | 
			
		||||
    st_data_t data;
 | 
			
		||||
    st_data_t key, data;
 | 
			
		||||
    rb_method_entry_t *me = 0;
 | 
			
		||||
 | 
			
		||||
    if (klass == rb_cObject) {
 | 
			
		||||
| 
						 | 
				
			
			@ -475,7 +475,8 @@ remove_method(VALUE klass, ID mid)
 | 
			
		|||
	rb_name_error(mid, "method `%s' not defined in %s",
 | 
			
		||||
		      rb_id2name(mid), rb_class2name(klass));
 | 
			
		||||
    }
 | 
			
		||||
    st_delete(RCLASS_M_TBL(klass), &mid, &data);
 | 
			
		||||
    key = (st_data_t)mid;
 | 
			
		||||
    st_delete(RCLASS_M_TBL(klass), &key, &data);
 | 
			
		||||
 | 
			
		||||
    rb_vm_check_redefinition_opt_method(me);
 | 
			
		||||
    rb_clear_cache_for_undef(klass, mid);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue