[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#487745: epiphany-webkit: crashes on startup



On Tue, Jun 24, 2008 at 08:20:12AM +0200, Mike Hommey wrote:
> It could make sense, if sparc needs this uint64_t to be 64-bit aligned.
> And it looks like so:
> 
> (gdb) print $pc
> $1 = (void (*)(void)) 0xf7e3b880 <WTF::TCMalloc_PageHeap::GrowHeap(unsigned int)+104>
> 
> (gdb) disassemble $pc $npc
> Dump of assembler code from 0xf7e3b880 to 0xf7e3b884:
> 0xf7e3b880 <_ZN3WTF17TCMalloc_PageHeap8GrowHeapEj+104>: ldd  [ %i0 + %g2 ], %o4
> End of assembler dump.
> 
> (gdb) info registers i0 g2
> i0             0xf7f9cdc4       -134623804
> g2             0x50b8   20664
> 
> 0x50b8 & 7 is 0, but 0xf7f9cdc4 & 7 is not, so i0 + g2 is not 64-bit
> aligned.
> 
> If the diagnostic is correct, what would be the best way to fix this ?
> Split the assignment into 2 uint32_t ones ? Or is there a way to have
> the class 64-bit aligned ? Or maybe a way to get gcc to split the
> uint64_t assignment itself ?

Or maybe something like this:

diff --git a/JavaScriptCore/wtf/FastMalloc.cpp b/JavaScriptCore/wtf/FastMalloc.cpp
index 8afc70d..496d1ee 100644
--- a/JavaScriptCore/wtf/FastMalloc.cpp
+++ b/JavaScriptCore/wtf/FastMalloc.cpp
@@ -1820,7 +1820,7 @@ static TCMalloc_Central_FreeListPadded central_cache[kNumClasses];
 
 // Page-level allocator
 static SpinLock pageheap_lock = SPINLOCK_INITIALIZER;
-static void* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(void*) - 1) / sizeof(void*)];
+static uint64_t* pageheap_memory[(sizeof(TCMalloc_PageHeap) + sizeof(uint64_t*) - 1) / sizeof(uint64_t*)];
 static bool phinited = false;
 
 // Avoid extra level of indirection by making "pageheap" be just an alias


The relevant code is:
http://git.debian.org/?p=pkg-webkit/webkit.git;a=blob;f=JavaScriptCore/wtf/FastMalloc.cpp;h=8afc70d9d6ded4cd4a056220ac750c1abd1044d2;hb=1f5af570264d9bac805c25c6ccdff320782bb243#l1821

The stacktrace being:
#0  WTF::TCMalloc_PageHeap::GrowHeap (this=0xf7f68dc4, n=1) at ../JavaScriptCore/wtf/FastMalloc.cpp:1466
#1  0xf7e6753c in WTF::TCMalloc_PageHeap::New (this=0xf7f68dc4, n=1) at ../JavaScriptCore/wtf/FastMalloc.cpp:1186
#2  0xf7e07ca0 in WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe (this=0xf7f6fdf0) at ../JavaScriptCore/wtf/FastMalloc.cpp:2116

And line 2116 reading:
        span = pageheap->New(npages);

Where pageheap is a macro for getPageHeap(). So what is actually not
64-bit aligned is not allocated through the a dynamic allocator...

So, I'd say forcing this to be 64-bit aligned should be enough, and the
above diff should be doing just this.

What do you think?

Mike


Reply to: