Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merge revision(s) 18394,18397:

	* gc.c (chain_finalized_object): deletes finalizers to be invoked from
	  finalizer_table.
	* gc.c (rb_gc_call_finalizer_at_exit): warns when could not invoke
	  finalizers.
	* gc.c (run_final): runs finalizers with the object terminated.
	* gc.c (rb_gc_call_finalizer_at_exit): ObjectSpace::finalizers needs
	  to scan whole object space, although deprecated.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@26170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit e46b881218cc2c52cc604e1232a7ccfbfc86db74 1 parent b2f01ce
@shyouhei shyouhei authored
Showing with 38 additions and 28 deletions.
  1. +15 −0 ChangeLog
  2. +19 −24 gc.c
  3. +4 −4 version.h
View
15 ChangeLog
@@ -1,3 +1,18 @@
+Thu Dec 24 17:06:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (run_final): runs finalizers with the object terminated.
+
+ * gc.c (rb_gc_call_finalizer_at_exit): ObjectSpace::finalizers needs
+ to scan whole object space, although deprecated.
+
+Thu Dec 24 17:06:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (chain_finalized_object): deletes finalizers to be invoked from
+ finalizer_table.
+
+ * gc.c (rb_gc_call_finalizer_at_exit): warns when could not invoke
+ finalizers.
+
Mon Dec 21 16:09:09 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/Makefile.sub (LD_SHARED1): typo.
View
43 gc.c
@@ -1241,7 +1241,7 @@ void
rb_gc_force_recycle(p)
VALUE p;
{
- add_freelist(p);
+ add_freelist(RANY(p));
}
static inline void
@@ -1949,6 +1949,7 @@ run_final(obj)
VALUE args[3], table, objid;
objid = rb_obj_id(obj); /* make obj into id */
+ RBASIC(obj)->klass = 0;
rb_thread_critical = Qtrue;
if (BUILTIN_TYPE(obj) == T_DEFERRED && RDATA(obj)->dfree) {
(*RDATA(obj)->dfree)(DATA_PTR(obj));
@@ -1984,21 +1985,6 @@ rb_gc_finalize_deferred()
}
}
-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|FL_MARK)) == FL_FINALIZE) {
- if (BUILTIN_TYPE(p) != T_DEFERRED) {
- p->as.free.flags = FL_MARK | T_DEFERRED; /* remain marked */
- RDATA(p)->dfree = 0;
- }
- p->as.free.next = *final_list;
- *final_list = p;
- }
- return ST_CONTINUE;
-}
-
void
rb_gc_call_finalizer_at_exit()
{
@@ -2007,14 +1993,23 @@ rb_gc_call_finalizer_at_exit()
/* run finalizers */
if (need_call_final && finalizer_table) {
- do {
- p = deferred_final_list;
- deferred_final_list = 0;
- finalize_list(p);
- mark_tbl(finalizer_table, 0);
- st_foreach(finalizer_table, chain_finalized_object,
- (st_data_t)&deferred_final_list);
- } while (deferred_final_list);
+ p = deferred_final_list;
+ deferred_final_list = 0;
+ finalize_list(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);
+ run_final((VALUE)p);
+ }
+ p++;
+ }
+ }
+ if (finalizer_table) {
+ st_free_table(finalizer_table);
+ finalizer_table = 0;
+ }
}
/* run data object's finalizers */
for (i = 0; i < heaps_used; i++) {
View
8 version.h
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.7"
-#define RUBY_RELEASE_DATE "2009-12-21"
+#define RUBY_RELEASE_DATE "2009-12-24"
#define RUBY_VERSION_CODE 187
-#define RUBY_RELEASE_CODE 20091221
-#define RUBY_PATCHLEVEL 244
+#define RUBY_RELEASE_CODE 20091224
+#define RUBY_PATCHLEVEL 245
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2009
#define RUBY_RELEASE_MONTH 12
-#define RUBY_RELEASE_DAY 21
+#define RUBY_RELEASE_DAY 24
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
Please sign in to comment.
Something went wrong with that request. Please try again.