ruby-changes:6228
From: nobu <ko1@a...>
Date: Mon, 30 Jun 2008 22:43:05 +0900 (JST)
Subject: [ruby-changes:6228] Ruby:r17741 (mvm): * merged from trunk r17728:17740.
nobu 2008-06-30 22:42:46 +0900 (Mon, 30 Jun 2008) New Revision: 17741 Modified files: branches/mvm/.merged-trunk-revision branches/mvm/ChangeLog branches/mvm/ext/stringio/stringio.c branches/mvm/gc.c branches/mvm/io.c branches/mvm/lib/test/unit/collector/dir.rb Log: * merged from trunk r17728:17740. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17741 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/ext/stringio/stringio.c?r1=17741&r2=17740&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/ChangeLog?r1=17741&r2=17740&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/gc.c?r1=17741&r2=17740&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/io.c?r1=17741&r2=17740&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/lib/test/unit/collector/dir.rb?r1=17741&r2=17740&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/.merged-trunk-revision?r1=17741&r2=17740&diff_format=u Index: mvm/ChangeLog =================================================================== --- mvm/ChangeLog (revision 17740) +++ mvm/ChangeLog (revision 17741) @@ -1,3 +1,35 @@ +Mon Jun 30 22:30:37 2008 Nobuyoshi Nakada <nobu@r...> + + * lib/test/unit/collector/dir.rb (recursive_collect): r15662 reverted. + +Mon Jun 30 22:27:39 2008 Yusuke Endoh <mame@t...> + + * ext/stringio/stringio.c (strio_getline): fix for nil and "" as + separator. [ruby-dev:34591] + +Mon Jun 30 22:21:30 2008 Yusuke Endoh <mame@t...> + + * io.c (argf_each_line): pass args to each_line. [ruby-dev:34958] + +Mon Jun 30 22:12:46 2008 Nobuyoshi Nakada <nobu@r...> + + * gc.c (chain_finalized_object): should not delete from finalizer + table until run. + + * gc.c (rb_gc_call_finalizer_at_exit): deferred_final_list may be + empty first. + +Mon Jun 30 18:57:05 2008 Nobuyoshi Nakada <nobu@r...> + + * gc.c (gc_finalize_deferred): allow object allocation in finalizers. + + * gc.c (rb_gc_call_finalizer_at_exit): ditto. + +Mon Jun 30 14:41:36 2008 NAKAMURA Usaku <usa@r...> + + * gc.c (rb_newobj): prohibit call of rb_newobj() during gc when + USE_VALUE_CACHE is not defined (normal case). + Mon Jun 30 10:28:33 2008 Yukihiro Matsumoto <matz@r...> * ext/syslog/syslog.c (syslog_write): syslog operations should be @@ -52,29 +84,31 @@ Sun Jun 29 17:44:23 2008 Kouhei Sutou <kou@c...> * lib/rss/parser.rb (RSS::ListenerMixin#known_class): define to - work with ruby 1.8.x too. + work with ruby 1.8.x too. Sun Jun 29 17:41:42 2008 Kouhei Sutou <kou@c...> * lib/rss/maker/base.rb (RSS::Maker::RSSBase#to_feed): raise - exception not return nil if RSS::Maker.make can't get required - information. + exception not return nil if RSS::Maker.make can't get required + information. + * test/rss/rss-assertions.rb: follow the above change. Sun Jun 29 17:37:23 2008 Kouhei Sutou <kou@c...> * lib/rss/maker/base.rb (RSS::Maker::RSSBase#make): require block. + * test/rss/test_maker_{0.9,1.0,2.0}.rb: follow the above change. Sun Jun 29 17:33:34 2008 Kouhei Sutou <kou@c...> * lib/rss/maker/base.rb, lib/rss/maker/itunes.rb: don't use - instance_eval to initialize variables. (speed up) + instance_eval to initialize variables. (speed up) Sun Jun 29 17:31:15 2008 Kouhei Sutou <kou@c...> * lib/rss/rss.rb, test/rss/test_version.rb (RSS::VERSION): - 0.2.4 -> 0.2.5. + 0.2.4 -> 0.2.5. Sun Jun 29 11:36:20 2008 Yusuke Endoh <mame@t...> @@ -211,7 +245,7 @@ Thu Jun 26 11:04:30 2008 Eric Hodel <drbrain@s...> * lib/rubygems: Update to RubyGems 1.2.0 r1824. Incorporates patch by - Yusuke ENDOH [ruby-core:17353]. + Yusuke ENDOH [ruby-core:17353]. Thu Jun 26 00:48:31 2008 Yukihiro Matsumoto <matz@r...> @@ -474,7 +508,7 @@ Fri Jun 20 03:14:31 2008 Eric Hodel <drbrain@s...> * lib/rubygems*, test/rubygems/*: Update to RubyGems 1.1.1 r1784 (pre - 1.2). + 1.2). Fri Jun 20 03:01:59 2008 Yusuke Endoh <mame@t...> @@ -641,7 +675,7 @@ * lib/rubygems/*: Fix errors for 1.9. * gem_prelude.rb: Only remove methods from gem_prelude.rb when - loading real RubyGems. + loading real RubyGems. Wed Jun 18 07:03:30 2008 Eric Hodel <drbrain@e...> @@ -716,7 +750,7 @@ * dir.c (dir_s_open): changed for dir_initialize. * dir.c (dir_open_dir): ditto. - + * dir.c (dir_foreach): changed for dir_open_dir. * dir.c (dir_entries): changed for dir_open_dir. @@ -3595,7 +3629,7 @@ Tue Apr 22 17:54:05 2008 URABE Shyouhei <shyouhei@r...> * vm_core.h (exec_event_hooks): ``inline'' is a type modifier, not - a type itself. + a type itself. Tue Apr 22 16:24:27 2008 URABE Shyouhei <shyouhei@r...> @@ -12814,7 +12848,7 @@ * lib/yaml.rb (quick_emit): use combination of object_id and hash to identify repeated object references, since GC will reuse memory of - objects during output of YAML. [ruby-Bugs-8548] [ruby-Bugs-3698] + objects during output of YAML. [ruby-Bugs-8548] [ruby-Bugs-3698] Thu Nov 15 19:49:03 2007 NAKAMURA Usaku <usa@r...> @@ -13140,7 +13174,7 @@ Sat Nov 10 14:43:30 2007 David Flanagan <davidflanagan@r...> * parse.y: use ASCII encoding for string literals that are - 7-bit clean, fixing regression from my previous patch + 7-bit clean, fixing regression from my previous patch Sat Nov 10 13:18:54 2007 Nobuyoshi Nakada <nobu@r...> @@ -30267,7 +30301,7 @@ * lib/xmlrpc/server.rb (XMLRPC::Server): Switch from GServer over to WEBrick. This makes file lib/xmlrpc/httpserver.rb obsolete (at least it is - no further used by the XML-RPC library). + no further used by the XML-RPC library). Mon Jul 11 02:50:23 2005 GOTOU Yuuzou <gotoyuzo@n...> Index: mvm/io.c =================================================================== --- mvm/io.c (revision 17740) +++ mvm/io.c (revision 17741) @@ -7320,7 +7320,7 @@ RETURN_ENUMERATOR(argf, argc, argv); for (;;) { if (!next_argv()) return Qnil; - rb_block_call(argf_of(argf).current_file, rb_intern("each_line"), 0, 0, rb_yield, 0); + rb_block_call(argf_of(argf).current_file, rb_intern("each_line"), argc, argv, rb_yield, 0); argf_of(argf).next_p = 1; } return argf; Index: mvm/lib/test/unit/collector/dir.rb =================================================================== --- mvm/lib/test/unit/collector/dir.rb (revision 17740) +++ mvm/lib/test/unit/collector/dir.rb (revision 17741) @@ -16,7 +16,7 @@ @file = file @object_space = object_space @req = req - @pattern = [] + @pattern = [/\btest_.*\.rb\Z/m] @exclude = [] end @@ -64,7 +64,6 @@ sub_suites << sub_suite unless(sub_suite.empty?) else next if /~\z/ =~ e_name or /\A\.\#/ =~ e - next unless /\Atest_.*\.rb\z/m =~ e if @pattern and !@pattern.empty? next unless @pattern.any? {|pat| pat =~ e_name} end Index: mvm/gc.c =================================================================== --- mvm/gc.c (revision 17740) +++ mvm/gc.c (revision 17741) @@ -168,7 +168,6 @@ int during_gc; } flags; struct { - int need_call; st_table *table; RVALUE *deferred; } final; @@ -203,7 +202,6 @@ #define heaps_freed objspace->heap.freed #define dont_gc objspace->flags.dont_gc #define during_gc objspace->flags.during_gc -#define need_call_final objspace->final.need_call #define finalizer_table objspace->final.table #define deferred_final_list objspace->final.deferred #define mark_stack objspace->markstack.buffer @@ -212,6 +210,8 @@ #define global_List objspace->global_list #define ruby_gc_stress objspace->gc_stress +#define need_call_final (finalizer_table && finalizer_table->num_entries) + #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE rb_objspace_t * rb_objspace_alloc(void) @@ -732,6 +732,8 @@ return v; #else rb_objspace_t *objspace = &rb_objspace; + if (during_gc) + rb_bug("object allocation during garbage collection phase"); return rb_newobj_from_heap(objspace); #endif } @@ -1366,8 +1368,6 @@ } } -void rb_gc_abort_threads(void); - static void gc_sweep(rb_objspace_t *objspace) { @@ -1955,7 +1955,6 @@ rb_raise(rb_eArgError, "wrong type argument %s (should be callable)", rb_obj_classname(block)); } - need_call_final = 1; FL_SET(obj, FL_FINALIZE); block = rb_ary_new3(2, INT2FIX(rb_safe_level()), block); @@ -2024,13 +2023,11 @@ { RVALUE *p = deferred_final_list; - during_gc++; deferred_final_list = 0; if (p) { finalize_list(objspace, p); } free_unused_heaps(objspace); - during_gc = 0; } void @@ -2039,6 +2036,18 @@ gc_finalize_deferred(&rb_objspace); } +static int +chain_finalized_object(st_data_t key, st_data_t val, st_data_t arg) +{ + RVALUE *p = (RVALUE *)key, **final_list = (RVALUE **)arg; + if (p->as.basic.flags & FL_FINALIZE) { + p->as.free.flags = FL_MARK; /* remain marked */ + p->as.free.next = *final_list; + *final_list = p; + } + return ST_CONTINUE; +} + void rb_gc_call_finalizer_at_exit(void) { @@ -2046,25 +2055,18 @@ RVALUE *p, *pend; size_t i; - /* finalizers are part of garbage collection */ - during_gc++; /* run finalizers */ if (need_call_final) { - p = deferred_final_list; - deferred_final_list = 0; - finalize_list(objspace, p); - for (i = 0; i < heaps_used; i++) { - p = heaps[i].slot; pend = p + heaps[i].limit; - while (p < pend) { - if (FL_TEST(p, FL_FINALIZE)) { - FL_UNSET(p, FL_FINALIZE); - p->as.basic.klass = 0; - run_final(objspace, (VALUE)p); - } - p++; - } - } + do { + p = deferred_final_list; + deferred_final_list = 0; + finalize_list(objspace, p); + st_foreach(finalizer_table, chain_finalized_object, + (st_data_t)&deferred_final_list); + } while (deferred_final_list); } + /* finalizers are part of garbage collection */ + during_gc++; /* run data object's finalizers */ for (i = 0; i < heaps_used; i++) { p = heaps[i].slot; pend = p + heaps[i].limit; Index: mvm/ext/stringio/stringio.c =================================================================== --- mvm/ext/stringio/stringio.c (revision 17740) +++ mvm/ext/stringio/stringio.c (revision 17741) @@ -835,7 +835,7 @@ str = tmp; } } - else { + else if (!NIL_P(str)) { StringValue(str); } } @@ -862,7 +862,7 @@ s = p; while ((p = memchr(p, '\n', e - p)) && (p != e)) { if (*++p == '\n') { - e = p; + e = p + 1; break; } } Index: mvm/.merged-trunk-revision =================================================================== --- mvm/.merged-trunk-revision (revision 17740) +++ mvm/.merged-trunk-revision (revision 17741) @@ -1 +1 @@ -17728 +17740 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/