WIP patchset
authorbenjamin@smedbergs.us
Mon, 19 Nov 2007 14:12:29 -0500
changeset 3 942335ad5ee9e1c0c52d9a0472ac3f4180d16ed7
parent 2 8b0ebf10667ee784780547bc06319abb3b2682c2
child 4 2696e7fd59fb342037a49d4823cb86606b2d3fc7
push id1
push userbsmedberg@mozilla.com
push dateMon, 21 Apr 2008 01:54:18 +0000
WIP patchset
cross-compile.patch
explicit-namespaces.patch
series
x86-64
deleted file mode 100644
--- a/cross-compile.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-diff --git a/build/configuration.py b/build/configuration.py
---- a/build/configuration.py
-+++ b/build/configuration.py
-@@ -65,18 +65,21 @@ def writeFileIfChanged(path, contents):
- 
- def _configGuess():
-     ostest = sys.platform
-+    cputest = build.process.run_for_output(['uname', '-m'])
-+    return _configSub(ostest, cputest)
-+
-+def _configSub(ostest, cputest):
-     if ostest.startswith('win'):
-         os = 'windows'
-     elif ostest == 'darwin':
-         os = 'darwin'
--    elif ostest.startswith('linux'):
-+    elif ostest.startswith('linux') or ostest.startswith('pc-linux'):
-         os = 'linux'
-     elif ostest.startswith('sunos'):
-         os = 'sunos'
-     else:
-         raise Exception('Unrecognized OS: ' + ostest)
- 
--    cputest = build.process.run_for_output(['uname', '-m'])
-     if re.search(r'^i(\d86|86pc|x86)$', cputest):
-         cpu = 'i686'
-     elif re.search('^(x86_64|amd64)$', cputest):
-@@ -128,10 +131,12 @@ class Configuration:
-                 self._debug = d
- 
-             if options.host:
--                self._host = _configSub(options.host)
-+                hostcpu, hostos = options.host.split('-', 1)
-+                self._host = _configSub(hostos, hostcpu)
- 
-             if options.target:
--                self._target = _configSub(options.target)
-+                targetcpu, targetos = options.target.split('-', 1)
-+                self._target = _configSub(targetos, targetcpu)
- 
-         self._acvars = {
-             'topsrcdir': self._topsrcdir,
-@@ -218,7 +223,9 @@ class Configuration:
- 
- # -Wno-trigraphs -Wreturn-type -Wnon-virtual-dtor -Wmissing-braces -Wparentheses -Wunused-label  -Wunused-parameter -Wunused-variable -Wunused-value -Wuninitialized
- 
--            if self._target[1] == 'i686':
-+            if 'CXX' in os.environ:
-+                self._acvars['CXX'] = os.environ['CXX']
-+            elif self._target[1] == 'i686':
-                 self._acvars['CXX'] = 'g++-4.0'
-             elif self._target[1] == 'powerpc':
-                 self._acvars['CXX'] = 'g++-3.3'
-@@ -227,9 +234,9 @@ class Configuration:
- 
-         elif self._target[0] == 'linux':
-             self._acvars.update({
--                'CPPFLAGS'     : '',
--                'CXX'          : 'g++',
--                'CXXFLAGS'     : '',
-+                'CPPFLAGS'     : os.environ.get('CPPFLAGS', ''),
-+                'CXX'          : os.environ.get('CXX', 'g++'),
-+                'CXXFLAGS'     : os.environ.get('CXXFLAGS', ''),
-                 'DLL_CFLAGS'   : '-fPIC',
-                 'LD'           : 'ar',
-                 'LDFLAGS'      : '',
-diff --git a/build/getopt.py b/build/getopt.py
---- a/build/getopt.py
-+++ b/build/getopt.py
-@@ -39,7 +39,7 @@ import re
- import re
- 
- _target = re.compile("^--target=(.*)$")
--_host = re.compile("^--host=.*$")
-+_host = re.compile("^--host=(.*)$")
- _ignore = re.compile(r"^--(srcdir|cache-file)=")
- _arg = re.compile(r"^--(enable|disable|with|without)-([\w-]+)(?:=(.*)|$)$")
- _yes = re.compile("^(t|true|yes|y|1)$", re.I)
-@@ -56,12 +56,12 @@ class Options:
-         for arg in argv[1:]:
-             m = _target.search(arg)
-             if m:
--                self.target = m.groups(0)
-+                self.target = m.group(1)
-                 continue
- 
-             m = _host.search(arg)
-             if m:
--                self.host = m.groups(0)
-+                self.host = m.group(1)
-                 continue
- 
-             if _ignore.search(arg) is not None:
new file mode 100644
--- /dev/null
+++ b/explicit-namespaces.patch
@@ -0,0 +1,16 @@
+diff --git a/MMgc/WriteBarrier.h b/MMgc/WriteBarrier.h
+--- a/MMgc/WriteBarrier.h
++++ b/MMgc/WriteBarrier.h
+@@ -45,10 +45,10 @@
+ #ifdef WRITE_BARRIERS
+ 
+ // inline write barrier
+-#define WB(gc, container, addr, value) gc->writeBarrier(container, addr, (const void *)(uintptr)(value))
++#define WB(gc, container, addr, value) gc->writeBarrier(container, addr, (const void *)(MMgc::uintptr)(value))
+ 
+ // fast manual RC write barrier
+-#define WBRC(gc, container, addr, value) gc->writeBarrierRC(container, addr, (const void *)(uintptr)(value))
++#define WBRC(gc, container, addr, value) gc->writeBarrierRC(container, addr, (const void *)(MMgc::uintptr)(value))
+ 
+ // declare write barrier
+ #define DWB(type) MMgc::WriteBarrier<type>
--- a/series
+++ b/series
@@ -1,3 +1,4 @@
-cross-compile.patch
 mmgc-threasafe-build.patch
 finalized-base.patch
+explicit-namespaces.patch
+x86-64
new file mode 100644
--- /dev/null
+++ b/x86-64
@@ -0,0 +1,116 @@
+diff --git a/MMgc/GC.cpp b/MMgc/GC.cpp
+--- a/MMgc/GC.cpp
++++ b/MMgc/GC.cpp
+@@ -1548,7 +1548,7 @@ bail:
+ #elif defined(AVMPLUS_UNIX) // SOLARIS
+ 	pthread_key_t stackTopKey = 0;
+ 
+-	uint32 GC::GetStackTop() const
++	uintptr GC::GetStackTop() const
+ 	{
+ 		if(stackTopKey == 0)
+ 		{
+@@ -1561,7 +1561,7 @@ bail:
+ 
+ 		void *stackTop = pthread_getspecific(stackTopKey);
+ 		if(stackTop)
+-			return (uint32)stackTop;
++			return (uintptr)stackTop;
+ 
+ 		size_t sz;
+ 		void *s_base;
+@@ -1590,7 +1590,7 @@ bail:
+ 		// stackTop has to be greater than current stack pointer
+ 		GCAssert(stackTop > &sz);
+ 		pthread_setspecific(stackTopKey, stackTop);
+-		return (uint32)stackTop;
++		return (uintptr)stackTop;
+ 		
+ 	}
+ #endif // AVMPLUS_UNIX
+diff --git a/MMgc/GCHeapUnix.cpp b/MMgc/GCHeapUnix.cpp
+--- a/MMgc/GCHeapUnix.cpp
++++ b/MMgc/GCHeapUnix.cpp
+@@ -42,8 +42,8 @@
+ 
+ #include <unistd.h>
+ 
++#include "MMgc.h"
+ #include "GCDebug.h"
+-#include "MMgc.h"
+ #include "GC.h"
+ 
+ #ifdef USE_MMAP
+@@ -178,7 +178,7 @@ namespace MMgc
+ 		res = address;
+ 		
+ 		if (res == address)
+-			address = (void*)( (int)address + size );
++			address = (void*)( (uintptr)address + size );
+ 		else
+ 			address = 0;
+ 		return address;
+diff --git a/MMgc/linuxbuild.h b/MMgc/linuxbuild.h
+--- a/MMgc/linuxbuild.h
++++ b/MMgc/linuxbuild.h
+@@ -49,7 +49,14 @@
+ /**
+  * IA-32
+  */
++#ifdef __i386__
+ #define MMGC_IA32
++#elif defined(__x86_64__)
++#define MMGC_AMD64
++#define MMGC_64BIT
++#else
++#error Unknown CPU type
++#endif
+ 
+ /**
+  * Define this to get stack traces.  Helps with memory leaks.
+diff --git a/configure.py b/configure.py
+--- a/configure.py
++++ b/configure.py
+@@ -55,6 +55,10 @@ o = build.getopt.Options()
+ 
+ config = Configuration(thisdir, options = o,
+                        sourcefile = 'core/avmplus.h')
++
++buildTamarin = o.getBoolArg('tamarin', True)
++if buildTamarin:
++    config.subst("ENABLE_TAMARIN", 1)
+ 
+ buildShell = o.getBoolArg("shell", False)
+ if (buildShell):
+@@ -161,6 +165,8 @@ elif cpu == "powerpc":
+     APP_CPPFLAGS += "-DAVMPLUS_PPC "
+ elif cpu == "sparc":
+     APP_CPPFLAGS += "-DAVMPLUS_SPARC "
++elif cpu == "x86_64":
++    APP_CPPFLAGS += "-DAVMPLUS_AMD64 "
+ else:
+     raise Exception("Unsupported OS")
+ 
+diff --git a/manifest.mk b/manifest.mk
+--- a/manifest.mk
++++ b/manifest.mk
+@@ -42,7 +42,10 @@ INCLUDES += \
+   -I$(topsrcdir)/pcre \
+   $(NULL)
+ 
+-$(call RECURSE_DIRS,MMgc core pcre codegen)
++$(call RECURSE_DIRS,MMgc)
++
++ifdef ENABLE_TAMARIN
++$(call RECURSE_DIRS,core pcre codegen)
+ 
+ ifeq (darwin,$(TARGET_OS))
+ $(call RECURSE_DIRS,platform/mac)
+@@ -53,6 +56,7 @@ ifeq (linux,$(TARGET_OS))
+ ifeq (linux,$(TARGET_OS))
+ $(call RECURSE_DIRS,platform/unix)
+ endif
++endif
+ 
+ $(call RECURSE_DIRS,shell)
+