Sfoglia il codice sorgente

Various changes triggered by comments on the code

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 13 anni fa
parent
commit
e686f1a6d3

+ 16 - 14
common/roxiehelper/roxierow.cpp

@@ -63,19 +63,6 @@ public:
         return doReallocRows(rowset, oldRowCount, newRowCount);
     }
 
-    inline byte * * doReallocRows(byte * * rowset, unsigned oldRowCount, unsigned newRowCount)
-    {
-        if (!rowset)
-            return createRowset(newRowCount);
-
-        //This would be more efficient if previous capacity was stored by the caller - or if capacity() is more efficient
-        if (newRowCount * sizeof(void *) <= RoxieRowCapacity(rowset))
-            return rowset;
-
-        size32_t capacity;
-        return (byte * *)rowManager.resizeRow(rowset, oldRowCount * sizeof(void *), newRowCount * sizeof(void *), allocatorId | ACTIVITY_FLAG_ISREGISTERED, capacity);
-    }
-
     virtual void releaseRow(const void * row)
     {
         ReleaseRoxieRow(row);
@@ -107,6 +94,21 @@ public:
     {
         return meta.createRowDeserializer(ctx, activityId);
     }
+
+protected:
+    inline byte * * doReallocRows(byte * * rowset, unsigned oldRowCount, unsigned newRowCount)
+    {
+        if (!rowset)
+            return createRowset(newRowCount);
+
+        //This would be more efficient if previous capacity was stored by the caller - or if capacity() is more efficient
+        if (newRowCount * sizeof(void *) <= RoxieRowCapacity(rowset))
+            return rowset;
+
+        size32_t capacity;
+        return (byte * *)rowManager.resizeRow(rowset, oldRowCount * sizeof(void *), newRowCount * sizeof(void *), allocatorId | ACTIVITY_FLAG_ISREGISTERED, capacity);
+    }
+
 protected:
     roxiemem::IRowManager & rowManager;
     const CachedOutputMetaData meta;
@@ -170,7 +172,7 @@ public:
 
     virtual void * createRow(size32_t & allocatedSize)
     {
-        allocatedSize = meta.getInitialSize();
+        allocatedSize = meta.getFixedSize();
         return heap->allocate();
     }
 

+ 2 - 4
roxie/ccd/ccdqueue.cpp

@@ -34,9 +34,7 @@
 #include <cppunit/extensions/HelperMacros.h>
 #endif
 
-#ifdef _DEBUG
-#define allocate(a, x) allocate(a, __LINE__)
-#endif
+#define MESSAGE_UNPACKER_ID 1
 
 CriticalSection ibytiCrit; // CAUTION - not safe to use spinlocks as real-time thread accesses
 CriticalSection queueCrit;
@@ -2233,7 +2231,7 @@ public:
         assertex(pos + length <= datalen);
         void * cur = ((char *) data) + pos;
         pos += length;
-        void * ret = rowManager->allocate(length, 0);
+        void * ret = rowManager->allocate(length, MESSAGE_UNPACKER_ID);
         memcpy(ret, cur, length);
         //No need for finalize since only contains plain data.
         return ret;

+ 2 - 2
roxie/roxiemem/roxiemem.cpp

@@ -1027,7 +1027,7 @@ public:
     virtual void *finalizeRow(void *final);
 
 protected:
-    Linked<CChunkingRowManager> rowManager;
+    CChunkingRowManager * rowManager;       // Lifetime of rowManager is guaranteed to be longer
     size32_t fixedSize;
     unsigned activityId;
     RoxieHeapFlags flags;
@@ -1050,7 +1050,7 @@ public:
     virtual void *finalizeRow(void *final, size32_t originalSize, size32_t finalSize);
 
 protected:
-    Linked<CChunkingRowManager> rowManager;
+    CChunkingRowManager * rowManager;       // Lifetime of rowManager is guaranteed to be longer
     unsigned activityId;
     RoxieHeapFlags flags;
 };

+ 1 - 0
rtl/eclrtl/rtlds.cpp

@@ -487,6 +487,7 @@ byte * * RtlLinkedDatasetBuilder::linkrows()
 void RtlLinkedDatasetBuilder::expand(size32_t required)
 {
     assertex(required < choosenLimit);
+    //MORE: Next factoring change this so it passes this logic over to the row allocator
     size32_t newMax = max ? max : 4;
     while (newMax < required)
     {