SVN commit 492977 by zack: __ppc__ is not defined on ppc linux. use __PPC__ or __powerpc__ here. these should be pushed up to webkit M +27 -27 collector.cpp --- branches/work/kdelibs-js/kjs/collector.cpp #492976:492977 @@ -91,7 +91,7 @@ size_t numBlocks; size_t usedBlocks; size_t firstBlockWithPossibleSpace; - + CollectorCell **oversizeCells; size_t numOversizeCells; size_t usedOversizeCells; @@ -114,7 +114,7 @@ collect(); numLiveObjects = heap.numLiveObjects; } - + if (s > CELL_SIZE) { // oversize allocator @@ -126,7 +126,7 @@ heap.numOversizeCells = numOversizeCells; heap.oversizeCells = static_cast(fastRealloc(heap.oversizeCells, numOversizeCells * sizeof(CollectorCell *))); } - + void *newCell = fastMalloc(s); heap.oversizeCells[usedOversizeCells] = static_cast(newCell); heap.usedOversizeCells = usedOversizeCells + 1; @@ -134,9 +134,9 @@ return newCell; } - + // slab allocator - + size_t usedBlocks = heap.usedBlocks; size_t i = heap.firstBlockWithPossibleSpace; @@ -172,10 +172,10 @@ heap.usedBlocks = usedBlocks + 1; heap.firstBlockWithPossibleSpace = usedBlocks; } - + // find a free spot in the block and detach it from the free list CollectorCell *newCell = targetBlock->freeList; - + // "next" field is a byte offset -- 0 means next cell, so a zeroed block is already initialized // could avoid the casts by using a cell offset, but this avoids a relatively-slow multiply targetBlock->freeList = reinterpret_cast(reinterpret_cast(newCell + 1) + newCell->u.freeCell.next); @@ -198,8 +198,8 @@ pthread_key_t registeredThreadKey; pthread_once_t registeredThreadKeyOnce = PTHREAD_ONCE_INIT; Collector::Thread *registeredThreads; - -static void destroyRegisteredThread(void *data) + +static void destroyRegisteredThread(void *data) { Collector::Thread *thread = (Collector::Thread *)data; @@ -256,10 +256,10 @@ assert(((char *)end - (char *)start) < 0x1000000); assert(IS_POINTER_ALIGNED(start)); assert(IS_POINTER_ALIGNED(end)); - + char **p = (char **)start; char **e = (char **)end; - + size_t usedBlocks = heap.usedBlocks; CollectorBlock **blocks = heap.blocks; size_t usedOversizeCells = heap.usedOversizeCells; @@ -339,11 +339,11 @@ i386_thread_state_t regs; unsigned user_count = sizeof(regs)/sizeof(int); thread_state_flavor_t flavor = i386_THREAD_STATE; -#elif __ppc__ +#elif __ppc__ || __PPC__ || __powerpc__ ppc_thread_state_t regs; unsigned user_count = PPC_THREAD_STATE_COUNT; thread_state_flavor_t flavor = PPC_THREAD_STATE; -#elif __ppc64__ +#elif __ppc64__ || __PPC64__ ppc_thread_state64_t regs; unsigned user_count = PPC_THREAD_STATE64_COUNT; thread_state_flavor_t flavor = PPC_THREAD_STATE64; @@ -352,14 +352,14 @@ #endif // get the thread register state thread_get_state(thread->machThread, flavor, (thread_state_t)®s, &user_count); - + // scan the registers markStackObjectsConservatively((void *)®s, (void *)((char *)®s + (user_count * sizeof(usword_t)))); - + // scan the stack #if __i386__ markStackObjectsConservatively((void *)regs.esp, pthread_get_stackaddr_np(thread->posixThread)); -#elif defined(__ppc__) || defined(__ppc64__) +#elif defined(__ppc__) || defined(__ppc64__) || defined(__PPC__) || defined(__powerpc__) markStackObjectsConservatively((void *)regs.r1, pthread_get_stackaddr_np(thread->posixThread)); #else #error Unknown Architecture @@ -416,7 +416,7 @@ List::markProtectedLists(); // SWEEP: delete everything with a zero refcount (garbage) and unmark everything else - + size_t emptyBlocks = 0; size_t numLiveObjects = heap.numLiveObjects; @@ -467,7 +467,7 @@ } } } - + curBlock->usedCells = usedCells; curBlock->freeList = freeList; @@ -483,7 +483,7 @@ block--; // Don't move forward a step in this case if (heap.numBlocks > MIN_ARRAY_SIZE && heap.usedBlocks < heap.numBlocks / LOW_WATER_FACTOR) { - heap.numBlocks = heap.numBlocks / GROWTH_FACTOR; + heap.numBlocks = heap.numBlocks / GROWTH_FACTOR; heap.blocks = (CollectorBlock **)fastRealloc(heap.blocks, heap.numBlocks * sizeof(CollectorBlock *)); } } @@ -492,11 +492,11 @@ if (heap.numLiveObjects != numLiveObjects) heap.firstBlockWithPossibleSpace = 0; - + size_t cell = 0; while (cell < heap.usedOversizeCells) { AllocatedValueImp *imp = (AllocatedValueImp *)heap.oversizeCells[cell]; - + if (!imp->m_marked) { imp->~AllocatedValueImp(); #if DEBUG_COLLECTOR @@ -512,7 +512,7 @@ numLiveObjects--; if (heap.numOversizeCells > MIN_ARRAY_SIZE && heap.usedOversizeCells < heap.numOversizeCells / LOW_WATER_FACTOR) { - heap.numOversizeCells = heap.numOversizeCells / GROWTH_FACTOR; + heap.numOversizeCells = heap.numOversizeCells / GROWTH_FACTOR; heap.oversizeCells = (CollectorCell **)fastRealloc(heap.oversizeCells, heap.numOversizeCells * sizeof(CollectorCell *)); } } else { @@ -520,20 +520,20 @@ cell++; } } - + bool deleted = heap.numLiveObjects != numLiveObjects; heap.numLiveObjects = numLiveObjects; heap.numLiveObjectsAtLastCollect = numLiveObjects; - + memoryFull = (numLiveObjects >= KJS_MEM_LIMIT); return deleted; } -size_t Collector::size() +size_t Collector::size() { - return heap.numLiveObjects; + return heap.numLiveObjects; } #ifdef KJS_DEBUG_MEM @@ -622,7 +622,7 @@ CFRelease(name); } } - + return classes; }