mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* gc.c: use VALGRIND_MAKE_MEM_UNDEFINED to detect use of collected
objects if valgrind is available. It cannot detect first 2 words because they are used as the free list. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									0a02ad5e2e
								
							
						
					
					
						commit
						1d23c250f0
					
				
					 2 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,9 @@
 | 
			
		|||
Sun Aug 19 13:31:40 2007  Tanaka Akira  <akr@fsij.org>
 | 
			
		||||
 | 
			
		||||
	* gc.c: use VALGRIND_MAKE_MEM_UNDEFINED to detect use of collected
 | 
			
		||||
	  objects if valgrind is available.  It cannot detect first 2 words
 | 
			
		||||
	  because they are used as the free list.
 | 
			
		||||
 | 
			
		||||
Sun Aug 19 13:13:52 2007  Koichi Sasada  <ko1@atdot.net>
 | 
			
		||||
 | 
			
		||||
	* compile.c (iseq_compile_each/NODE_RESBODY): fix to add
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										9
									
								
								gc.c
									
										
									
									
									
								
							
							
						
						
									
										9
									
								
								gc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -40,8 +40,12 @@
 | 
			
		|||
# ifndef VALGRIND_MAKE_MEM_DEFINED
 | 
			
		||||
#  define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE(p, n)
 | 
			
		||||
# endif
 | 
			
		||||
# ifndef VALGRIND_MAKE_MEM_UNDEFINED
 | 
			
		||||
#  define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE(p, n)
 | 
			
		||||
# endif
 | 
			
		||||
#else
 | 
			
		||||
# define VALGRIND_MAKE_MEM_DEFINED(p, n) /* empty */
 | 
			
		||||
# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) /* empty */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int rb_io_fptr_finalize(struct rb_io_t*);
 | 
			
		||||
| 
						 | 
				
			
			@ -1099,6 +1103,7 @@ finalize_list(RVALUE *p)
 | 
			
		|||
	RVALUE *tmp = p->as.free.next;
 | 
			
		||||
	run_final((VALUE)p);
 | 
			
		||||
	if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */
 | 
			
		||||
            VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
 | 
			
		||||
	    p->as.free.flags = 0;
 | 
			
		||||
	    p->as.free.next = freelist;
 | 
			
		||||
	    freelist = p;
 | 
			
		||||
| 
						 | 
				
			
			@ -1168,6 +1173,7 @@ gc_sweep(void)
 | 
			
		|||
		    final_list = p;
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
                    VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
 | 
			
		||||
		    p->as.free.flags = 0;
 | 
			
		||||
		    p->as.free.next = freelist;
 | 
			
		||||
		    freelist = p;
 | 
			
		||||
| 
						 | 
				
			
			@ -1218,6 +1224,7 @@ gc_sweep(void)
 | 
			
		|||
void
 | 
			
		||||
rb_gc_force_recycle(VALUE p)
 | 
			
		||||
{
 | 
			
		||||
    VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
 | 
			
		||||
    RANY(p)->as.free.flags = 0;
 | 
			
		||||
    RANY(p)->as.free.next = freelist;
 | 
			
		||||
    freelist = RANY(p);
 | 
			
		||||
| 
						 | 
				
			
			@ -2001,10 +2008,12 @@ rb_gc_call_finalizer_at_exit(void)
 | 
			
		|||
		else if (RANY(p)->as.data.dfree) {
 | 
			
		||||
		    (*RANY(p)->as.data.dfree)(DATA_PTR(p));
 | 
			
		||||
		}
 | 
			
		||||
                VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
 | 
			
		||||
	    }
 | 
			
		||||
	    else if (BUILTIN_TYPE(p) == T_FILE) {
 | 
			
		||||
		if (rb_io_fptr_finalize(RANY(p)->as.file.fptr)) {
 | 
			
		||||
		    p->as.free.flags = 0;
 | 
			
		||||
                    VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
 | 
			
		||||
		}
 | 
			
		||||
	    }
 | 
			
		||||
	    p++;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue