ruby-changes:16505
From: nobu <ko1@a...>
Date: Thu, 1 Jul 2010 08:41:00 +0900 (JST)
Subject: [ruby-changes:16505] Ruby:r28495 (trunk): * marshal.c (w_object): suppress empty instance variable entry on
nobu 2010-07-01 08:40:37 +0900 (Thu, 01 Jul 2010) New Revision: 28495 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28495 Log: * marshal.c (w_object): suppress empty instance variable entry on compatible dump objects. Modified files: trunk/ChangeLog trunk/marshal.c Index: ChangeLog =================================================================== --- ChangeLog (revision 28494) +++ ChangeLog (revision 28495) @@ -1,3 +1,8 @@ +Thu Jul 1 08:40:26 2010 Nobuyoshi Nakada <nobu@r...> + + * marshal.c (w_object): suppress empty instance variable entry on + compatible dump objects. + Wed Jun 30 07:29:11 2010 Nobuyoshi Nakada <nobu@r...> * test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using Index: marshal.c =================================================================== --- marshal.c (revision 28494) +++ marshal.c (revision 28495) @@ -607,9 +607,6 @@ return; } - if ((hasiv = has_ivars(obj, ivtbl)) != 0) { - w_byte(TYPE_IVAR, arg); - } if (obj == Qnil) { w_byte(TYPE_NIL, arg); } @@ -646,6 +643,8 @@ v = rb_funcall(obj, s_mdump, 0, 0); check_dump_arg(arg, s_mdump); + hasiv = has_ivars(obj, ivtbl); + if (hasiv) w_byte(TYPE_IVAR, arg); w_class(TYPE_USRMARSHAL, obj, arg, FALSE); w_object(v, arg, limit); if (hasiv) w_ivar(obj, ivtbl, &c_arg); @@ -661,6 +660,8 @@ if (TYPE(v) != T_STRING) { rb_raise(rb_eTypeError, "_dump() must return string"); } + hasiv = has_ivars(obj, ivtbl); + if (hasiv) w_byte(TYPE_IVAR, arg); if ((hasiv2 = has_ivars(v, ivtbl2)) != 0 && !hasiv) { w_byte(TYPE_IVAR, arg); } @@ -678,6 +679,7 @@ st_add_direct(arg->data, obj, arg->data->num_entries); + hasiv = has_ivars(obj, ivtbl); { st_data_t compat_data; rb_alloc_func_t allocator = rb_get_alloc_func(RBASIC(obj)->klass); @@ -688,8 +690,10 @@ VALUE real_obj = obj; obj = compat->dumper(real_obj); st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj); + if (obj != real_obj && !ivtbl) hasiv = 0; } } + if (hasiv) w_byte(TYPE_IVAR, arg); switch (BUILTIN_TYPE(obj)) { case T_CLASS: -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/