浏览代码

HPCC-8882 Make eclrtl depend on roxiemem and remove row callback

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 12 年之前
父节点
当前提交
3189d4e8be

+ 0 - 1
ecl/eclagent/eclagent.cpp

@@ -2011,7 +2011,6 @@ void EclAgent::runProcess(IEclProcess *process)
     allocatorMetaCache.setown(createRowAllocatorCache(this));
     rowManager.setown(roxiemem::createRowManager(0, NULL, queryDummyContextLogger(), allocatorMetaCache, false));
     setHThorRowManager(rowManager.get());
-    rtlSetReleaseRowHook(queryHThorRtlRowCallback());
 
     //Get memory limit. Workunit specified value takes precedence over config file
     int memLimitMB = globals->getPropInt("defaultMemoryLimitMB", DEFAULT_MEM_LIMIT);

+ 0 - 25
ecl/hthor/hthor.cpp

@@ -9960,28 +9960,3 @@ extern HTHOR_API IEngineRowAllocator * createHThorRowAllocator(IRowManager & _ro
 {
     return createRoxieRowAllocator(_rowManager, _meta, _activityId, _allocatorId, roxiemem::RHFnone);
 }
-
-static class RowCallbackHook : implements IRtlRowCallback
-{
-public:
-    virtual void releaseRow(const void * row) const
-    {
-        releaseHThorRow(row);
-    }
-    virtual void releaseRowset(unsigned count, byte * * rowset) const
-    {
-        ReleaseRoxieRowset(count, rowset);
-    }
-    virtual void * linkRow(const void * row) const
-    {
-        linkHThorRow(row);
-        return const_cast<void *>(row);
-    }
-    virtual byte * * linkRowset(byte * * rowset) const
-    {
-        linkHThorRow(rowset);
-        return const_cast<byte * *>(rowset);
-    }
-} callbackHook;
-
-extern HTHOR_API IRtlRowCallback * queryHThorRtlRowCallback() { return &callbackHook; }

+ 0 - 1
ecl/hthor/hthor.hpp

@@ -216,7 +216,6 @@ extern HTHOR_API IHThorException * makeHThorException(ThorActivityKind kind, uns
 extern HTHOR_API IHThorException * makeHThorException(ThorActivityKind kind, unsigned activityId, unsigned subgraphId, IException * exc, char const * extra);
 
 extern HTHOR_API IEngineRowAllocator * createHThorRowAllocator(roxiemem::IRowManager & _rowManager, IOutputMetaData * _meta, unsigned _activityId, unsigned _allocatorId);
-extern HTHOR_API IRtlRowCallback * queryHThorRtlRowCallback();
 
 
 #endif // HTHOR_INCL

+ 0 - 24
roxie/ccd/ccdmain.cpp

@@ -406,29 +406,6 @@ int myhook(int alloctype, void *, size_t nSize, int p1, long allocSeq, const uns
 }
 #endif
 
-static class RoxieRowCallbackHook : implements IRtlRowCallback
-{
-public:
-    virtual void releaseRow(const void * row) const
-    {
-        ReleaseRoxieRow(row);
-    }
-    virtual void releaseRowset(unsigned count, byte * * rowset) const
-    {
-        ReleaseRoxieRowset(count, rowset);
-    }
-    virtual void * linkRow(const void * row) const
-    {
-        LinkRoxieRow(row);
-        return const_cast<void *>(row);
-    }
-    virtual byte * * linkRowset(byte * * rowset) const
-    {
-        LinkRoxieRow(rowset);
-        return const_cast<byte * *>(rowset);
-    }
-} callbackHook;
-
 int STARTQUERY_API start_query(int argc, const char *argv[])
 {
     EnableSEHtoExceptionMapping();
@@ -744,7 +721,6 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
         if (!totalMemoryLimit)
             totalMemoryLimit = 1024 * 0x100000;  // 1 Gb;
         roxiemem::setTotalMemoryLimit(totalMemoryLimit, 0, NULL);
-        rtlSetReleaseRowHook(&callbackHook);
 
         traceStartStop = topology->getPropBool("@traceStartStop", false);
         traceServerSideCache = topology->getPropBool("@traceServerSideCache", false);

+ 2 - 0
roxie/roxiemem/roxiemem.hpp

@@ -255,7 +255,9 @@ public:
 #define ReleaseRoxieRow(row) roxiemem::HeapletBase::release(row)
 #define ReleaseClearRoxieRow(row) roxiemem::HeapletBase::releaseClear(row)
 #define LinkRoxieRow(row) roxiemem::HeapletBase::link(row)
+
 #define ReleaseRoxieRowset(cnt, rowset) roxiemem::HeapletBase::releaseRowset(cnt, rowset)
+#define LinkRoxieRowset(rowset) roxiemem::HeapletBase::link(rowset)
 
 //Functions to determine information about roxie rows
 #define RoxieRowCapacity(row)  roxiemem::HeapletBase::capacity(row)

+ 3 - 1
rtl/eclrtl/CMakeLists.txt

@@ -44,6 +44,7 @@ include_directories (
          ./../../rtl/nbcd 
          ./../../system/include 
          ./../../system/jlib 
+         ./../../roxie/roxiemem
          ./../../testing/unittests
          ${ICU_INCLUDE_DIR}
          ${BOOST_REGEX_INCLUDE_DIR}
@@ -62,7 +63,8 @@ target_link_libraries ( eclrtl
       ${BOOST_REGEX_LIBRARIES}
       ${ICU_LIBRARIES}
       jlib
-      nbcd 
+      nbcd
+      roxiemem
     )
 
 FOREACH( iFILES

+ 8 - 13
rtl/eclrtl/eclrtl.cpp

@@ -43,6 +43,8 @@
 #include "jmd5.hpp"
 #include "rtlqstr.ipp"
 
+#include "roxiemem.hpp"
+
 #ifndef _WIN32
 //typedef long long __int64;
 #define _fastcall
@@ -87,34 +89,27 @@ ECLRTL_API void * rtlRealloc(void * _ptr, size32_t size)
 }
 
 //=============================================================================
-static IRtlRowCallback * rowCallback = NULL;
 
 ECLRTL_API void rtlReleaseRow(const void * row)
 {
-    if (row)
-        rowCallback->releaseRow(row);
+    ReleaseRoxieRow(row);
 }
 
 ECLRTL_API void rtlReleaseRowset(unsigned count, byte * * rowset)
 {
-    rowCallback->releaseRowset(count, rowset);
-}
-
-ECLRTL_API IRtlRowCallback * rtlSetReleaseRowHook(IRtlRowCallback * hook)
-{
-    IRtlRowCallback * prev = rowCallback;
-    rowCallback = hook;
-    return prev;
+    ReleaseRoxieRowset(count, rowset);
 }
 
 ECLRTL_API void * rtlLinkRow(const void * row)
 {
-    return rowCallback->linkRow(row);
+    LinkRoxieRow(row);
+    return const_cast<void *>(row);
 }
 
 ECLRTL_API byte * * rtlLinkRowset(byte * * rowset)
 {
-    return rowCallback->linkRowset(rowset);
+    LinkRoxieRowset(rowset);
+    return rowset;
 }
 
 //=============================================================================

+ 0 - 13
rtl/eclrtl/eclrtl.hpp

@@ -62,14 +62,6 @@ class MemoryBuffer;
 
 //-----------------------------------------------------------------------------
 
-interface IRtlRowCallback
-{
-    virtual void releaseRow(const void * row) const = 0;
-    virtual void releaseRowset(unsigned count, byte * * rowset) const = 0;
-    virtual void * linkRow(const void * row) const = 0;
-    virtual byte * * linkRowset(byte * * rowset) const = 0;
-};
-
 // RegEx Compiler for ansii  strings (uses BOOST)
 interface IStrRegExprFindInstance
 {
@@ -498,11 +490,6 @@ ECLRTL_API void * rtlLinkRow(const void * row);
 ECLRTL_API void rtlReleaseRowset(unsigned count, byte * * rowset);
 ECLRTL_API byte * * rtlLinkRowset(byte * * rowset);
 
-// argument is not linked, and must remain until closedown, or called with NULL.  Returns the previous value.  
-// Not thread safe, but shouldn't need to be.
-ECLRTL_API IRtlRowCallback * rtlSetReleaseRowHook(IRtlRowCallback * hook);      
-
-
 ECLRTL_API void ensureRtlLoaded();      // call this to create a static link to the rtl...
 
 ECLRTL_API void outputXmlString(unsigned len, const char *field, const char *fieldname, StringBuffer &out);

+ 1 - 23
thorlcr/thorutil/thmem.cpp

@@ -1714,7 +1714,7 @@ ILargeMemLimitNotify *createMultiThorResourceMutex(const char *grpname,CSDSServe
 }
 
 
-class CThorAllocator : public CSimpleInterface, implements IRtlRowCallback, implements IThorAllocator, implements IRowAllocatorMetaActIdCacheCallback
+class CThorAllocator : public CSimpleInterface, implements IThorAllocator, implements IRowAllocatorMetaActIdCacheCallback
 {
 protected:
     mutable Owned<IRowAllocatorMetaActIdCache> allocatorMetaCache;
@@ -1729,13 +1729,11 @@ public:
         allocatorMetaCache.setown(createRowAllocatorCache(this));
         rowManager.setown(roxiemem::createRowManager(memSize, NULL, queryDummyContextLogger(), allocatorMetaCache, false));
         rowManager->setMemoryLimit(memSize, 0==memorySpillAt ? 0 : memSize/100*memorySpillAt);
-        rtlSetReleaseRowHook(this);
     }
     ~CThorAllocator()
     {
         rowManager.clear();
         allocatorMetaCache.clear();
-        rtlSetReleaseRowHook(NULL); // nothing should use it beyond this point anyway
     }
 // roxiemem::IRowAllocatorMetaActIdCacheCallback
     virtual IEngineRowAllocator *createAllocator(IOutputMetaData *meta, unsigned activityId, unsigned id) const
@@ -1753,26 +1751,6 @@ public:
     }
     virtual roxiemem::RoxieHeapFlags queryFlags() const { return flags; }
     virtual bool queryCrc() const { return false; }
-
-// IRtlRowCallback
-    virtual void releaseRow(const void * row) const
-    {
-        ReleaseThorRow(row);
-    }
-    virtual void releaseRowset(unsigned count, byte * * rowset) const
-    {
-        ReleaseRoxieRowset(count, rowset);
-    }
-    virtual void *linkRow(const void * row) const
-    {
-        LinkThorRow(row);
-        return const_cast<void *>(row);
-    }
-    virtual byte * * linkRowset(byte * * rowset) const
-    {
-        LinkThorRow(rowset);
-        return const_cast<byte * *>(rowset);
-    }
 };
 
 // derived to avoid a 'crcChecking' check per getRowAllocator only