Update to actionmonkey-tamarin
authorBenjamin Smedberg <benjamin@smedbergs.us>
Tue, 01 Apr 2008 10:51:14 -0400
changeset 41 84ba4253dc28
parent 40 432248c58b48
child 42 53c5098cb79e
push id1
push userbsmedberg@mozilla.com
push dateMon, 21 Apr 2008 01:54:18 +0000
Update to actionmonkey-tamarin
enable-traces
export-gcthread
remove-extra-auto-storage-specifiers
series
tweak-esc-main.sh
valgrind-annotations
--- a/enable-traces
+++ b/enable-traces
@@ -1,12 +1,12 @@
 diff --git a/MMgc/GCMemoryProfiler.cpp b/MMgc/GCMemoryProfiler.cpp
 --- a/MMgc/GCMemoryProfiler.cpp
 +++ b/MMgc/GCMemoryProfiler.cpp
-@@ -50,7 +50,7 @@ namespace MMgc
- 	GCThreadLocal<void*> memtype;
+@@ -57,7 +57,7 @@
+ 
  
  	// Turn this to see GC stack traces.
 -	const bool enableTraces = false;
 +	const bool enableTraces = true;
  
  	// this is how many stack frames we'll attempt to lookup, we may not get this many and 
  	// we may leave some out
--- a/export-gcthread
+++ b/export-gcthread
@@ -1,12 +0,0 @@
-diff --git a/MMgc/GCThreads.h b/MMgc/GCThreads.h
---- a/MMgc/GCThreads.h
-+++ b/MMgc/GCThreads.h
-@@ -178,7 +178,7 @@ namespace MMgc
-     };
- 
- 	/** A catchall object for per-thread state. */
--	class GCThread {
-+	class MMGC_API GCThread {
- 	public:
- 		static void Init();
- 		static void Destroy();
new file mode 100644
--- /dev/null
+++ b/remove-extra-auto-storage-specifiers
@@ -0,0 +1,21 @@
+diff --git a/MMgc/GC.h b/MMgc/GC.h
+--- a/MMgc/GC.h
++++ b/MMgc/GC.h
+@@ -72,7 +72,7 @@
+ 		_size = (uintptr)_gc->GetStackTop() - (uintptr)_stack;
+ #else
+ #define MMGC_GET_STACK_EXTENTS(_gc, _stack, _size) \
+-		volatile auto int save1,save2,save3,save4,save5,save6,save7;\
++		volatile int save1,save2,save3,save4,save5,save6,save7;\
+ 		asm("movl %%eax,%0" : "=r" (save1));\
+ 		asm("movl %%ebx,%0" : "=r" (save2));\
+ 		asm("movl %%ecx,%0" : "=r" (save3));\
+@@ -107,7 +107,7 @@
+ // 64bit - r8-r15?
+ #define MMGC_GET_STACK_EXTENTS(_gc, _stack, _size) \
+ 		do { \
+-		volatile auto int64 save1,save2,save3,save4,save5,save6,save7;\
++		volatile int64 save1,save2,save3,save4,save5,save6,save7;\
+ 		asm("mov %%rax,%0" : "=r" (save1));\
+ 		asm("mov %%rbx,%0" : "=r" (save2));\
+ 		asm("mov %%rcx,%0" : "=r" (save3));\
--- a/series
+++ b/series
@@ -1,16 +1,12 @@
-tweak-esc-main.sh
-mmgc-graphviz #+jorendorff-graphviz
-mmgc-bit-checks #+jorendorff-private
+remove-extra-auto-storage-specifiers
 const-workitem.patch
 gcstack-access
 workitems-notgc-noassert
-gc-graph #+graphviz
-alloc-backtrace #+graphviz
 enable-traces
 debug-print-finalizers
 finalizable-merge-fixup
 remove-finalize-method
 export-gcthread
 valgrind-annotations
 stack-access2
 double-mark-is-ok
deleted file mode 100644
--- a/tweak-esc-main.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-diff --git a/esc/build/main.sh b/esc/build/main.sh
---- a/esc/build/main.sh
-+++ b/esc/build/main.sh
-@@ -1,1 +1,2 @@
--/work/tamarin/bin/shell ../bin/debug.es.abc ../bin/ast.es.abc ../bin/ast-decode.es.abc ../bin/ast-encode.es.abc ../bin/util.es.abc ../bin/lex-char.es.abc ../bin/lex-token.es.abc ../bin/lex-scan.es.abc ../bin/parse.es.abc ../bin/util-tamarin.es.abc ../bin/bytes-tamarin.es.abc ../bin/util-tamarin.es.abc ../bin/asm.es.abc ../bin/abc.es.abc ../bin/emit.es.abc ../bin/cogen.es.abc ../bin/cogen-stmt.es.abc ../bin/cogen-expr.es.abc ../bin/main.es.abc -- $1
-+AVM=${AVM:-/work/tamarin/bin/shell}
-+$AVM ../bin/debug.es.abc ../bin/ast.es.abc ../bin/ast-decode.es.abc ../bin/ast-encode.es.abc ../bin/util.es.abc ../bin/lex-char.es.abc ../bin/lex-token.es.abc ../bin/lex-scan.es.abc ../bin/parse.es.abc ../bin/util-tamarin.es.abc ../bin/bytes-tamarin.es.abc ../bin/util-tamarin.es.abc ../bin/asm.es.abc ../bin/abc.es.abc ../bin/emit.es.abc ../bin/cogen.es.abc ../bin/cogen-stmt.es.abc ../bin/cogen-expr.es.abc ../bin/main.es.abc -- $1
--- a/valgrind-annotations
+++ b/valgrind-annotations
@@ -1,24 +1,24 @@
 Add valgrind annotations for MMgc allocations. Note that there are some extraneous changes to set the current work queue correctly... I need to split those hunks out :-(
 * * *
 
 diff --git a/MMgc/FixedMalloc.cpp b/MMgc/FixedMalloc.cpp
 --- a/MMgc/FixedMalloc.cpp
 +++ b/MMgc/FixedMalloc.cpp
-@@ -79,6 +79,8 @@ namespace MMgc
+@@ -126,6 +126,8 @@
  
  	FixedMalloc::FixedMalloc(GCHeap* heap)
  	{
 +		VALGRIND_CREATE_MEMPOOL(this, 0, 1);
 +
  		m_heap = heap;
  		// Create all the allocators up front (not lazy)
  		// so that we don't have to check the pointers for
-@@ -98,6 +100,7 @@ namespace MMgc
+@@ -164,6 +166,7 @@
  			FixedAllocSafe *a = m_allocs[i];
  			delete a;
  		}		
 +		VALGRIND_DESTROY_MEMPOOL(this);
  	}
  
  	size_t FixedMalloc::Allocated()
 diff --git a/MMgc/FixedMalloc.h b/MMgc/FixedMalloc.h
@@ -28,162 +28,162 @@ diff --git a/MMgc/FixedMalloc.h b/MMgc/F
  #ifndef __Malloc__
  #define __Malloc__
  
 +#include <valgrind/memcheck.h>
 +#include <stdio.h>
  
  namespace MMgc
  {
-@@ -73,6 +75,9 @@ namespace MMgc
+@@ -73,6 +75,9 @@
  			} else {
  				item = LargeAlloc(size);
  			}
 +                        VALGRIND_MEMPOOL_ALLOC(this, item, size);
 +			VALGRIND_CHECK_MEM_IS_DEFINED(item, size);
 +			fprintf(stderr, "FixedMalloc::Alloc = %p\n", item);
  			return item;
  		}
  
-@@ -80,6 +85,8 @@ namespace MMgc
+@@ -80,6 +85,8 @@
  		{
  			if(item == 0)
  				return;
 +
 +			VALGRIND_MEMPOOL_FREE(this, item);
  
  			// small things are never allocated on the 4K boundary b/c the block
  			// header structure is stored there, large things always are		
 diff --git a/MMgc/GC.cpp b/MMgc/GC.cpp
 --- a/MMgc/GC.cpp
 +++ b/MMgc/GC.cpp
-@@ -110,6 +110,8 @@ extern "C" greg_t _getsp(void);
- #define SAMPLE_FRAME(_x, _s) 
- #define SAMPLE_CHECK() 
+@@ -106,6 +106,8 @@
+ #include <sys/stack.h>
+ extern "C" greg_t _getsp(void);
  #endif
 +
 +#include <valgrind/memcheck.h>
  
  namespace MMgc
  {
-@@ -294,7 +296,9 @@ namespace MMgc
+@@ -289,7 +291,9 @@
  		GCAssert (sizeof(sintptr) == 4);
  		GCAssert (sizeof(uintptr) == 4);	
  		#endif		
 -	
 +
 +		VALGRIND_CREATE_MEMPOOL(this, 0, 0);
 +
  #ifdef MMGC_DRC
  		zct.gc = this;
  #endif
-@@ -409,6 +413,8 @@ namespace MMgc
+@@ -405,6 +409,8 @@
  		while(m_callbacks) {
  			m_callbacks->Destroy();			
  		}
 +
 +		VALGRIND_DESTROY_MEMPOOL(this);
  	}
  
  	void GC::Collect()
-@@ -746,6 +752,12 @@ namespace MMgc
+@@ -744,6 +750,12 @@
  			memset(item, 0, Size(item));
  		}
  #endif
 +
 +		VALGRIND_MEMPOOL_ALLOC(this, item, size);
 +		if (flags & kZero) {
 +			int h = VALGRIND_MAKE_MEM_DEFINED(item, size);
 +			VALGRIND_DISCARD(h);
 +		}
  
  		return item;
  	}
-@@ -1543,6 +1555,8 @@ bail:
+@@ -1529,6 +1541,8 @@
  		{
  			const void *val = GC::Pointer(*p++);	
  			
 +			int valhandle = VALGRIND_MAKE_MEM_DEFINED(&val, sizeof(val));
 +
  			if(val < _memStart || val >= _memEnd)
  				continue;
  
-@@ -1558,6 +1572,8 @@ bail:
+@@ -1544,6 +1558,8 @@
  				RCObject *obj = (RCObject*)val;
  				obj->Pin();
  			}
 +
 +			VALGRIND_DISCARD(valhandle);
  		}
  	}
  			
-@@ -2509,6 +2525,8 @@ bail:
+@@ -2495,6 +2511,8 @@
  		while(p < end) 
  		{
  			uintptr val = *p++;  
 +			
 +			int valhandle = VALGRIND_MAKE_MEM_DEFINED(&val, sizeof(val));
  
  			if(val < _memStart || val >= _memEnd)
  				continue;
-@@ -2520,6 +2538,8 @@ bail:
+@@ -2506,6 +2524,8 @@
  			{
  				const void *item;
  				GCAlloc::GCBlock *block = (GCAlloc::GCBlock*) (val & ~0xFFF);
 +
 +				VALGRIND_CHECK_MEM_IS_DEFINED(&block, sizeof(GCAlloc::GCBlock*));
  
  #ifdef MMGC_INTERIOR_PTRS
  				item = (void*) val;
-@@ -2660,6 +2680,8 @@ bail:
+@@ -2649,6 +2669,8 @@
  					#endif
  				}
  			}
 +
 +			VALGRIND_DISCARD(valhandle);
  		}
  	}
  
 diff --git a/MMgc/GCAlloc.cpp b/MMgc/GCAlloc.cpp
 --- a/MMgc/GCAlloc.cpp
 +++ b/MMgc/GCAlloc.cpp
-@@ -711,5 +711,7 @@ start:
+@@ -711,5 +711,7 @@
  #endif
  		// Add this item to the free list
  		*((void**)item) = oldFree;	
 +
 +                VALGRIND_MEMPOOL_FREE(GC::GetGC(item), GetUserPointer(item));
  	}
  }
 diff --git a/MMgc/GCHeap.cpp b/MMgc/GCHeap.cpp
 --- a/MMgc/GCHeap.cpp
 +++ b/MMgc/GCHeap.cpp
-@@ -43,6 +43,8 @@
- #endif
+@@ -39,6 +39,8 @@
+ #include <string.h>
  
  #include "MMgc.h"
 +
 +#include <valgrind/memcheck.h>
  
- namespace MMgc
- {
-@@ -182,6 +184,9 @@ namespace MMgc
+ #if defined(DARWIN) || defined(MMGC_ARM) || defined (MMGC_SPARC)
+ #include <stdlib.h>
+@@ -190,6 +192,9 @@
  			if (!block) {
  				return NULL;
  			}
 +
 +                        VALGRIND_MAKE_MEM_NOACCESS(block->baseAddr,
 +                                                   block->size * kBlockSize);
  
  			GCAssert(block->size == size);
  			
 diff --git a/MMgc/GCLargeAlloc.cpp b/MMgc/GCLargeAlloc.cpp
 --- a/MMgc/GCLargeAlloc.cpp
 +++ b/MMgc/GCLargeAlloc.cpp
-@@ -100,6 +100,8 @@ namespace MMgc
+@@ -100,6 +100,8 @@
  
  		if(b->flags & kHasWeakRef)
  			b->gc->ClearWeakRef(GetUserPointer(item));
 +
 +                VALGRIND_MEMPOOL_FREE(b->gc, GetUserPointer(item));
  
  		LargeBlock **prev = &m_blocks;
  		while(*prev)