On Wed, May 11, 2011 at 09:02:06PM +1200, Michael Cree wrote: > Nice! Thanks...
> Could you send through those patches to get 4.0.1 working please? Attached. They're small enough to risk offending the few debian-alpha subscribers who might not be interested :-). > (...) But as Witold has pointed out JIT involves substantial > work to implement. In that spirit, the "ExecutableAllocator.h" patch can probably be ignored: it's a necessary first step if anyone really wants to go down that rabbit hole, but not necessary for the JIT-less build. Anyway, please find attached the following patches (none of the diffs are reversed this time :-)): js+src+Makefile.in.diff js+src+assembler+jit+ExecutableAllocator.h.diff xpcom+glue+nsThreadUtils.cpp.diff xpcom+glue+nsThreadUtils.h.diff These are all applied from the source root, i.e., "mozilla-2.0". For the sake of completeness, the remaining "usual" Alpha patches are as follows (also relative to the source root): (1) xpcom/reflect/xptcall/src/md/unix/Makefile.in Under the "Linux/Alpha" section, add "Linuxalphaev56" (or whatever is appropriate for your particular system) to the filter statement. "Linuxalpha" will not match the PWS 433au. (2) configure.in Add "-Wl,--no-relax" to DSO_LDOPTS. There's an outstanding bug in the GNU ld "relax" code from 2007 that causes the "libxul.so" build to fail. The ".mozconfig" file I'm using is as follows: ====--CUT HERE--==== . $topsrcdir/browser/config/mozconfig mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox_obj ac_add_options --enable-official-branding ac_add_options --disable-optimize ac_add_options --disable-debug ac_add_options --disable-tests ac_add_options --disable-ipc ====--TUC EREH--==== For legal reasons, you may wish to omit the "--enable-official-branding" option. I include it for my personal builds because I don't distribute the binaries, nor do I misrepresent to anyone what I *do* build as an official (supported) Mozilla product. --Bob
--- js/src/Makefile.in.ORIG 2011-04-14 00:28:30.000000000 -0500 +++ js/src/Makefile.in 2011-05-09 23:55:32.000000000 -0500 @@ -914,7 +914,11 @@ # Needed to "configure" it correctly. Unfortunately these # flags wind up being applied to all code in js/src, not just # the code in js/src/assembler. -CXXFLAGS += -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1 +#CXXFLAGS += -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1 +# +# "--disable-jit" no longer honored: do it manually. --rct +# +CXXFLAGS += -DUSE_SYSTEM_MALLOC=1 INCLUDES += -I$(srcdir)/assembler -I$(srcdir)/yarr
--- js/src/assembler/jit/ExecutableAllocator.h.ORIG 2011-04-14 00:28:30.000000000 -0500 +++ js/src/assembler/jit/ExecutableAllocator.h 2011-05-09 15:03:02.000000000 -0500 @@ -311,7 +311,7 @@ #endif -#if WTF_CPU_X86 || WTF_CPU_X86_64 +#if WTF_CPU_X86 || WTF_CPU_X86_64 || WTF_CPU_ALPHA static void cacheFlush(void*, size_t) { }
--- xpcom/glue/nsThreadUtils.cpp.ORIG 2011-04-14 00:28:50.000000000 -0500 +++ xpcom/glue/nsThreadUtils.cpp 2011-05-10 14:11:55.000000000 -0500 @@ -46,10 +46,6 @@ # include "nsServiceManagerUtils.h" #endif -#ifdef XP_WIN -#include <windows.h> -#endif - #ifndef XPCOM_GLUE_AVOID_NSPR NS_IMPL_THREADSAFE_ISUPPORTS1(nsRunnable, nsIRunnable) @@ -120,36 +116,20 @@ #endif } -#ifndef MOZILLA_INTERNAL_API -bool NS_IsMainThread() +NS_METHOD_(PRBool) +NS_IsMainThread() { PRBool result = PR_FALSE; +#ifdef MOZILLA_INTERNAL_API + nsThreadManager::get()->nsThreadManager::GetIsMainThread(&result); +#else nsCOMPtr<nsIThreadManager> mgr = do_GetService(NS_THREADMANAGER_CONTRACTID); if (mgr) mgr->GetIsMainThread(&result); - return bool(result); -} -#elif defined(XP_WIN) -extern DWORD gTLSThreadIDIndex; -bool -NS_IsMainThread() -{ - return TlsGetValue(gTLSThreadIDIndex) == (void*) mozilla::threads::Main; -} -#elif !defined(NS_TLS) -bool NS_IsMainThread() -{ - PRBool result = PR_FALSE; - nsThreadManager::get()->nsThreadManager::GetIsMainThread(&result); - return bool(result); -} -#elif !defined(MOZ_ENABLE_LIBXUL) -bool NS_IsMainThread() -{ - return gTLSThreadID == mozilla::threads::Main; -} #endif + return result; +} NS_METHOD NS_DispatchToCurrentThread(nsIRunnable *event) @@ -207,27 +187,24 @@ } #endif // XPCOM_GLUE_AVOID_NSPR -inline PRBool -hasPendingEvents(nsIThread *thread) -{ - PRBool val; - return NS_SUCCEEDED(thread->HasPendingEvents(&val)) && val; -} - PRBool NS_HasPendingEvents(nsIThread *thread) { +#ifdef MOZILLA_INTERNAL_API if (!thread) { -#ifndef MOZILLA_INTERNAL_API - nsCOMPtr<nsIThread> current; - NS_GetCurrentThread(getter_AddRefs(current)); - return hasPendingEvents(current); -#else thread = NS_GetCurrentThread(); NS_ENSURE_TRUE(thread, PR_FALSE); -#endif } - return hasPendingEvents(thread); +#else + nsCOMPtr<nsIThread> current; + if (!thread) { + NS_GetCurrentThread(getter_AddRefs(current)); + NS_ENSURE_TRUE(current, PR_FALSE); + thread = current.get(); + } +#endif + PRBool val; + return NS_SUCCEEDED(thread->HasPendingEvents(&val)) && val; } PRBool
--- xpcom/glue/nsThreadUtils.h.ORIG 2011-04-14 00:28:50.000000000 -0500 +++ xpcom/glue/nsThreadUtils.h 2011-05-10 14:35:07.000000000 -0500 @@ -100,29 +100,14 @@ extern NS_COM_GLUE NS_METHOD NS_GetMainThread(nsIThread **result); -#if defined(MOZILLA_INTERNAL_API) && defined(XP_WIN) -NS_COM bool NS_IsMainThread(); -#elif defined(MOZILLA_INTERNAL_API) && defined(NS_TLS) -// This is defined in nsThreadManager.cpp and initialized to `Main` for the -// main thread by nsThreadManager::Init. -extern NS_TLS mozilla::threads::ID gTLSThreadID; -#ifdef MOZ_ENABLE_LIBXUL -inline bool NS_IsMainThread() -{ - return gTLSThreadID == mozilla::threads::Main; -} -#else -NS_COM bool NS_IsMainThread(); -#endif -#else /** * Test to see if the current thread is the main thread. * * @returns PR_TRUE if the current thread is the main thread, and PR_FALSE * otherwise. */ -extern NS_COM_GLUE bool NS_IsMainThread(); -#endif +extern NS_COM_GLUE NS_METHOD_(PRBool) +NS_IsMainThread(); /** * Dispatch the given event to the current thread. @@ -271,25 +256,6 @@ { public: virtual void Revoke() = 0; - - // These ReturnTypeEnforcer classes set up a blacklist for return types that - // we know are not safe. The default ReturnTypeEnforcer compiles just fine but - // already_AddRefed will not. - template <typename OtherReturnType> - class ReturnTypeEnforcer - { - public: - typedef int ReturnTypeIsSafe; - }; - - template <class T> - class ReturnTypeEnforcer<already_AddRefed<T> > - { - // No ReturnTypeIsSafe makes this illegal! - }; - - // Make sure this return type is safe. - typedef typename ReturnTypeEnforcer<ReturnType>::ReturnTypeIsSafe check; }; template <class ClassType, bool Owning>