From 545403c24b92df88267e4c5d03b07ff55af4889f Mon Sep 17 00:00:00 2001 From: cxl Date: Wed, 3 Jan 2018 08:06:45 +0000 Subject: [PATCH] Core: Fixed issue with CoWork, removed HEAP256 option git-svn-id: svn://ultimatepp.org/upp/trunk@11656 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/CoWork.cpp | 5 +++-- uppsrc/Core/Heap.h | 2 -- uppsrc/Core/HeapImp.h | 19 ------------------- uppsrc/Core/heap.cpp | 4 ---- uppsrc/Core/lheap.cpp | 8 -------- 5 files changed, 3 insertions(+), 35 deletions(-) diff --git a/uppsrc/Core/CoWork.cpp b/uppsrc/Core/CoWork.cpp index 18c6abf4e..9e5a47a6e 100644 --- a/uppsrc/Core/CoWork.cpp +++ b/uppsrc/Core/CoWork.cpp @@ -4,7 +4,7 @@ namespace Upp { #ifdef _MULTITHREADED -#define LLOG(x) // DLOG(x) +#define LLOG(x) // RLOG(x) #define LDUMP(x) // DDUMP(x) #define LHITCOUNT(x) // RHITCOUNT(x) @@ -193,12 +193,13 @@ void CoWork::Do0(Function&& fn, bool looper) LLOG("Stack full: running in the originating thread"); LHITCOUNT("CoWork: Stack full: Running in originating thread"); p.lock.Leave(); + Pool::finlock = false; fn(); if(Pool::finlock) p.lock.Leave(); return; } - p.PushJob(pick(fn), this); + p.PushJob(pick(fn), this, looper); todo++; p.lock.Leave(); } diff --git a/uppsrc/Core/Heap.h b/uppsrc/Core/Heap.h index 01bf87509..2eaca523b 100644 --- a/uppsrc/Core/Heap.h +++ b/uppsrc/Core/Heap.h @@ -1,7 +1,5 @@ #ifdef UPP_HEAP -#define HEAP256 - void *MemoryAllocPermanent(size_t size); void *MemoryAllocSz(size_t& size); diff --git a/uppsrc/Core/HeapImp.h b/uppsrc/Core/HeapImp.h index 411b4dfed..c3a568b12 100644 --- a/uppsrc/Core/HeapImp.h +++ b/uppsrc/Core/HeapImp.h @@ -4,11 +4,7 @@ void *SysAllocRaw(size_t size, size_t reqsize); void SysFreeRaw(void *ptr, size_t size); void *AllocRaw4KB(int reqsize); -#ifdef HEAP256 -void *AllocRaw256KB(int reqsize); -#else void *AllocRaw64KB(int reqsize); -#endif void *LAlloc(size_t& size); void LFree(void *ptr); @@ -73,16 +69,10 @@ struct Heap { }; struct Header { // Large block header - #ifdef HEAP256 - dword prev:31; - dword free:1; - dword size; - #else byte free; byte filler1, filler2, filler3; word size; word prev; - #endif Heap *heap; #ifdef CPU_32 dword filler4; @@ -103,13 +93,8 @@ struct Heap { BIGHDRSZ = 48, // size of huge block header REMOTE_OUT_SZ = 2000, // maximum size of remote frees to be buffered to flush at once - #ifdef HEAP256 - MAXBLOCK = 256*1024 - 2 * sizeof(Header) - LARGEHDRSZ, // maximum size of large block - LBINS = 95, // number of large size bins - #else MAXBLOCK = 65536 - 2 * sizeof(Header) - LARGEHDRSZ, // maximum size of large block LBINS = 77, // number of large size bins - #endif }; static_assert(sizeof(Header) == 16, "Wrong sizeof(Header)"); @@ -126,11 +111,7 @@ struct Heap { bool initialized; -#ifdef HEAP256 - static int BinSz[LBINS]; // block size for bin -#else static word BinSz[LBINS]; // block size for bin -#endif static byte SzBin[MAXBLOCK / 8 + 1]; // maps size/8 to bin static byte BlBin[MAXBLOCK / 8 + 1]; // Largest bin less or equal to size/8 (free -> bin) diff --git a/uppsrc/Core/heap.cpp b/uppsrc/Core/heap.cpp index 89217fdb4..ce72e1b7d 100644 --- a/uppsrc/Core/heap.cpp +++ b/uppsrc/Core/heap.cpp @@ -161,11 +161,7 @@ void Heap::Check() { while(l != large) { Header *bh = (Header *)((byte *)l + LARGEHDRSZ); while(bh->size) { - #ifdef HEAP256 - Assert((byte *)bh >= (byte *)l + LARGEHDRSZ && (byte *)bh < (byte *)l + 256*1024); - #else Assert((byte *)bh >= (byte *)l + LARGEHDRSZ && (byte *)bh < (byte *)l + 65536); - #endif if(bh->free) DbgFreeCheck(bh->GetBlock() + 1, bh->size - sizeof(DLink)); bh = bh->Next(); diff --git a/uppsrc/Core/lheap.cpp b/uppsrc/Core/lheap.cpp index 7f348f4aa..6f6d89282 100644 --- a/uppsrc/Core/lheap.cpp +++ b/uppsrc/Core/lheap.cpp @@ -8,11 +8,7 @@ namespace Upp { #include "HeapImp.h" -#ifdef HEAP256 -int Heap::BinSz[LBINS]; -#else word Heap::BinSz[LBINS]; -#endif byte Heap::SzBin[MAXBLOCK / 8 + 1]; // Minimal bin for size (request -> bin) byte Heap::BlBin[MAXBLOCK / 8 + 1]; // Largest bin less or equal to size (free -> bin) @@ -73,11 +69,7 @@ Heap::DLink *Heap::AddChunk(int reqsize) LLOG("Retrieved empty large " << (void *)ml); } else { - #ifdef HEAP256 - ml = (DLink *)AllocRaw256KB(reqsize); - #else ml = (DLink *)AllocRaw64KB(reqsize); - #endif LLOG("AllocRaw64KB " << (void *)ml); } lcount++;