From 7bcab85e924a1a904a4231492f5cbab8885d965e Mon Sep 17 00:00:00 2001 From: mread Date: Fri, 24 Sep 2010 15:36:20 +0100 Subject: fast allocator compiling for S60 3.2 The fast allocator on S60 3.2 can't use TChunkCreateInfo. Instead, RChunk::CreateDisconnectedLocal() has to be used Task-number: QT-3967 Reviewed-by: Shane Kearns --- src/corelib/arch/symbian/heap_hybrid.cpp | 12 ++++++++---- src/corelib/arch/symbian/heap_hybrid_p.h | 5 +++++ src/corelib/arch/symbian/qt_heapsetup_symbian.cpp | 2 ++ src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h | 4 ++++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/corelib/arch/symbian/heap_hybrid.cpp b/src/corelib/arch/symbian/heap_hybrid.cpp index 1be3cf5..4d101ed 100644 --- a/src/corelib/arch/symbian/heap_hybrid.cpp +++ b/src/corelib/arch/symbian/heap_hybrid.cpp @@ -3284,12 +3284,13 @@ EXPORT_C TInt UserHeap::CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RHeap* GET_PAGE_SIZE(page_size); TInt minLength = _ALIGN_UP(aInfo.iHeapInitialSize, page_size); TInt maxLength = Max(aInfo.iHeapMaxSize, minLength); -#ifndef QT_SYMBIAN4_ALLOCATOR_UNWANTED_CODE +#ifdef ENABLE_BTRACE if (UserTestDebugMaskBit(96)) // 96 == KUSERHEAPTRACE in nk_trace.h aInfo.iFlags |= ETraceHeapAllocs; -#endif // QT_SYMBIAN4_ALLOCATOR_UNWANTED_CODE +#endif // ENABLE_BTRACE // Create the thread's heap chunk. RChunk c; +#ifndef NO_NAMED_LOCAL_CHUNKS TChunkCreateInfo createInfo; createInfo.SetThreadHeap(0, maxLength, KLitDollarHeap()); // Initialise with no memory committed. @@ -3300,7 +3301,7 @@ EXPORT_C TInt UserHeap::CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RHeap* maxLength = 2*maxLength; createInfo.SetDisconnected(0, 0, maxLength); #endif -#ifndef QT_SYMBIAN4_ALLOCATOR_UNWANTED_CODE +#ifdef SYMBIAN_WRITABLE_DATA_PAGING // Set the paging policy of the heap chunk based on the thread's paging policy. TUint pagingflags = aInfo.iFlags & EThreadCreateFlagPagingMask; switch (pagingflags) @@ -3316,9 +3317,12 @@ EXPORT_C TInt UserHeap::CreateThreadHeap(SStdEpocThreadCreateInfo& aInfo, RHeap* // paging policy is used. break; } -#endif // QT_SYMBIAN4_ALLOCATOR_UNWANTED_CODE +#endif // SYMBIAN_WRITABLE_DATA_PAGING TInt r = c.Create(createInfo); +#else + TInt r = c.CreateDisconnectedLocal(0, 0, maxLength * 2); +#endif if (r!=KErrNone) return r; diff --git a/src/corelib/arch/symbian/heap_hybrid_p.h b/src/corelib/arch/symbian/heap_hybrid_p.h index 467bd69..6583657 100644 --- a/src/corelib/arch/symbian/heap_hybrid_p.h +++ b/src/corelib/arch/symbian/heap_hybrid_p.h @@ -103,6 +103,11 @@ public: EGetSize=48, EGetMaxLength, EGetBase, EAlignInteger, EAlignAddr }; enum TDebugOp { EWalk = 128, EHybridHeap }; + enum TAllocFail + { + /*ERandom, ETrueRandom, EDeterministic, ENone, EFailNext, EReset, EBurstRandom, + EBurstTrueRandom, EBurstDeterministic, EBurstFailNext,*/ ECheckFailure = 10, + }; struct HeapInfo { diff --git a/src/corelib/arch/symbian/qt_heapsetup_symbian.cpp b/src/corelib/arch/symbian/qt_heapsetup_symbian.cpp index a619252..4e2095d 100644 --- a/src/corelib/arch/symbian/qt_heapsetup_symbian.cpp +++ b/src/corelib/arch/symbian/qt_heapsetup_symbian.cpp @@ -67,6 +67,7 @@ Q_CORE_EXPORT TInt qt_symbian_SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCre return r; } +#ifndef NO_NAMED_LOCAL_CHUNKS void TChunkCreateInfo::SetThreadHeap(TInt aInitialSize, TInt aMaxSize, const TDesC& aName) { iType = TChunkCreate::ENormal | TChunkCreate::EData; @@ -77,6 +78,7 @@ void TChunkCreateInfo::SetThreadHeap(TInt aInitialSize, TInt aMaxSize, const TDe iName = &aName; iOwnerType = EOwnerThread; } +#endif // NO_NAMED_LOCAL_CHUNKS void Panic(TCdtPanic reason) { diff --git a/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h b/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h index e0437f9..eb43bf8 100644 --- a/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h +++ b/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h @@ -86,6 +86,10 @@ // disabling code ported from Symbian^4 that we don't want/can't have in earlier platforms #define QT_SYMBIAN4_ALLOCATOR_UNWANTED_CODE +#if defined(SYMBIAN_VERSION_9_2) || defined(SYMBIAN_VERSION_9_1) +#define NO_NAMED_LOCAL_CHUNKS +#endif + #ifndef QT_SYMBIAN_HAVE_U32STD_H struct SThreadCreateInfo { -- cgit v0.12