lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [51/54] [abbrv] git commit: refs/heads/sortex_ptr_only - Rename some vars in SortExternal.
Date Sat, 26 Apr 2014 23:12:21 GMT
Rename some vars in SortExternal.

Use "buffer" instead of "cache", plus "buf_max" instead "cache_max",
etc.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/4cff84bc
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/4cff84bc
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/4cff84bc

Branch: refs/heads/sortex_ptr_only
Commit: 4cff84bc0451fe784c074bc6866e6d8229be2903
Parents: 79f4ca5
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Wed Jan 9 13:14:00 2013 -0800
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Sat Apr 26 16:00:52 2014 -0700

----------------------------------------------------------------------
 core/Lucy/Index/PostingPool.c     |  42 +++++------
 core/Lucy/Index/SortFieldWriter.c |  24 +++---
 core/Lucy/Util/BBSortEx.c         |  30 ++++----
 core/Lucy/Util/SortExternal.c     | 130 ++++++++++++++++-----------------
 core/Lucy/Util/SortExternal.cfh   |  10 +--
 5 files changed, 118 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/4cff84bc/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index cc56c34..9c538ed 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -191,7 +191,7 @@ PostPool_Flip_IMP(PostingPool *self) {
     }
 
     PostPool_Sort_Cache(self);
-    if (num_runs && (ivars->cache_max - ivars->cache_tick) > 0) {
+    if (num_runs && (ivars->buf_max - ivars->buf_tick) > 0) {
         uint32_t num_items = PostPool_Cache_Count(self);
         // Cheap imitation of flush. FIXME.
         PostingPool *run
@@ -202,12 +202,12 @@ PostPool_Flip_IMP(PostingPool *self) {
         PostPool_Grow_Cache(run, num_items);
         PostingPoolIVARS *const run_ivars = PostPool_IVARS(run);
 
-        memcpy(run_ivars->cache, (ivars->cache) + ivars->cache_tick,
+        memcpy(run_ivars->buffer, (ivars->buffer) + ivars->buf_tick,
                num_items * sizeof(Obj*));
-        run_ivars->cache_max = num_items;
+        run_ivars->buf_max = num_items;
         PostPool_Add_Run(self, (SortExternal*)run);
-        ivars->cache_tick = 0;
-        ivars->cache_max = 0;
+        ivars->buf_tick = 0;
+        ivars->buf_max = 0;
     }
 
     // Assign.
@@ -278,10 +278,10 @@ PostPool_Flush_IMP(PostingPool *self) {
                                             ivars->post_temp_out);
 
     // Borrow the cache.
-    run_ivars->cache      = ivars->cache;
-    run_ivars->cache_tick = ivars->cache_tick;
-    run_ivars->cache_max  = ivars->cache_max;
-    run_ivars->cache_cap  = ivars->cache_cap;
+    run_ivars->buffer   = ivars->buffer;
+    run_ivars->buf_tick = ivars->buf_tick;
+    run_ivars->buf_max  = ivars->buf_max;
+    run_ivars->buf_cap  = ivars->buf_cap;
 
     // Write to temp files.
     LexWriter_Enter_Temp_Mode(ivars->lex_writer, ivars->field,
@@ -296,10 +296,10 @@ PostPool_Flush_IMP(PostingPool *self) {
     LexWriter_Leave_Temp_Mode(ivars->lex_writer);
 
     // Return the cache and empty it.
-    run_ivars->cache      = NULL;
-    run_ivars->cache_tick = 0;
-    run_ivars->cache_max  = 0;
-    run_ivars->cache_cap  = 0;
+    run_ivars->buffer   = NULL;
+    run_ivars->buf_tick = 0;
+    run_ivars->buf_max  = 0;
+    run_ivars->buf_cap  = 0;
     PostPool_Clear_Cache(self);
 
     // Add the run to the array.
@@ -459,12 +459,12 @@ PostPool_Refill_IMP(PostingPool *self) {
     else { term_text = (String*)Lex_Get_Term(lexicon); }
 
     // Make sure cache is empty.
-    if (ivars->cache_max - ivars->cache_tick > 0) {
+    if (ivars->buf_max - ivars->buf_tick > 0) {
         THROW(ERR, "Refill called but cache contains %u32 items",
-              ivars->cache_max - ivars->cache_tick);
+              ivars->buf_max - ivars->buf_tick);
     }
-    ivars->cache_max  = 0;
-    ivars->cache_tick = 0;
+    ivars->buf_max  = 0;
+    ivars->buf_tick = 0;
 
     // Ditch old MemoryPool and get another.
     DECREF(ivars->mem_pool);
@@ -515,17 +515,17 @@ PostPool_Refill_IMP(PostingPool *self) {
         }
 
         // Add to the run's cache.
-        if (num_elems >= ivars->cache_cap) {
+        if (num_elems >= ivars->buf_cap) {
             size_t new_cap = Memory_oversize(num_elems + 1, sizeof(Obj*));
             PostPool_Grow_Cache(self, new_cap);
         }
-        ivars->cache[num_elems] = (Obj*)rawpost;
+        ivars->buffer[num_elems] = (Obj*)rawpost;
         num_elems++;
     }
 
     // Reset the cache array position and length; remember file pos.
-    ivars->cache_max   = num_elems;
-    ivars->cache_tick  = 0;
+    ivars->buf_max   = num_elems;
+    ivars->buf_tick  = 0;
 
     return num_elems;
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/4cff84bc/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 2e55a39..1a0d5ff 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -399,10 +399,10 @@ SortFieldWriter_Flush_IMP(SortFieldWriter *self) {
     run_ivars->dat_start = OutStream_Align(temp_dat_out, sizeof(int64_t));
 
     // Have the run borrow the array of elems.
-    run_ivars->cache      = ivars->cache;
-    run_ivars->cache_max  = ivars->cache_max;
-    run_ivars->cache_tick = ivars->cache_tick;
-    run_ivars->cache_cap  = ivars->cache_cap;
+    run_ivars->buffer   = ivars->buffer;
+    run_ivars->buf_max  = ivars->buf_max;
+    run_ivars->buf_tick = ivars->buf_tick;
+    run_ivars->buf_cap  = ivars->buf_cap;
 
     // Write files, record stats.
     run_ivars->run_max = (int32_t)Seg_Get_Count(ivars->segment);
@@ -410,11 +410,11 @@ SortFieldWriter_Flush_IMP(SortFieldWriter *self) {
                                                temp_dat_out);
 
     // Reclaim the buffer from the run and empty it.
-    run_ivars->cache       = NULL;
-    run_ivars->cache_max   = 0;
-    run_ivars->cache_tick  = 0;
-    run_ivars->cache_cap   = 0;
-    ivars->cache_tick = ivars->cache_max;
+    run_ivars->buffer    = NULL;
+    run_ivars->buf_max   = 0;
+    run_ivars->buf_tick  = 0;
+    run_ivars->buf_cap   = 0;
+    ivars->buf_tick = ivars->buf_max;
     SortFieldWriter_Clear_Cache(self);
 
     // Record stream ends.
@@ -434,10 +434,10 @@ SortFieldWriter_Refill_IMP(SortFieldWriter *self) {
     if (!ivars->sort_cache) { return 0; }
 
     // Sanity check, then reset the cache and prepare to start loading items.
-    uint32_t cache_count = SortFieldWriter_Cache_Count(self);
-    if (cache_count) {
+    uint32_t buf_count = SortFieldWriter_Cache_Count(self);
+    if (buf_count) {
         THROW(ERR, "Refill called but cache contains %u32 items",
-              cache_count);
+              buf_count);
     }
     SortFieldWriter_Clear_Cache(self);
     MemPool_Release_All(ivars->mem_pool);

http://git-wip-us.apache.org/repos/asf/lucy/blob/4cff84bc/core/Lucy/Util/BBSortEx.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/BBSortEx.c b/core/Lucy/Util/BBSortEx.c
index c5c4c13..156ab02 100644
--- a/core/Lucy/Util/BBSortEx.c
+++ b/core/Lucy/Util/BBSortEx.c
@@ -76,24 +76,24 @@ BBSortEx_Feed_IMP(BBSortEx *self, Obj *item) {
 void
 BBSortEx_Flush_IMP(BBSortEx *self) {
     BBSortExIVARS *const ivars = BBSortEx_IVARS(self);
-    uint32_t     cache_count = ivars->cache_max - ivars->cache_tick;
-    Obj        **cache = ivars->cache;
+    uint32_t     buf_count = ivars->buf_max - ivars->buf_tick;
+    Obj        **buffer = ivars->buffer;
     VArray      *elems;
 
-    if (!cache_count) { return; }
-    else              { elems = VA_new(cache_count); }
+    if (!buf_count) { return; }
+    else            { elems = VA_new(buf_count); }
 
     // Sort, then create a new run.
     BBSortEx_Sort_Cache(self);
-    for (uint32_t i = ivars->cache_tick; i < ivars->cache_max; i++) {
-        VA_Push(elems, cache[i]);
+    for (uint32_t i = ivars->buf_tick; i < ivars->buf_max; i++) {
+        VA_Push(elems, buffer[i]);
     }
     BBSortEx *run = BBSortEx_new(0, elems);
     DECREF(elems);
     BBSortEx_Add_Run(self, (SortExternal*)run);
 
     // Blank the cache vars.
-    ivars->cache_tick += cache_count;
+    ivars->buf_tick += buf_count;
     BBSortEx_Clear_Cache(self);
 }
 
@@ -102,12 +102,12 @@ BBSortEx_Refill_IMP(BBSortEx *self) {
     BBSortExIVARS *const ivars = BBSortEx_IVARS(self);
 
     // Make sure cache is empty, then set cache tick vars.
-    if (ivars->cache_max - ivars->cache_tick > 0) {
+    if (ivars->buf_max - ivars->buf_tick > 0) {
         THROW(ERR, "Refill called but cache contains %u32 items",
-              ivars->cache_max - ivars->cache_tick);
+              ivars->buf_max - ivars->buf_tick);
     }
-    ivars->cache_tick = 0;
-    ivars->cache_max  = 0;
+    ivars->buf_tick = 0;
+    ivars->buf_max  = 0;
 
     // Read in elements.
     while (1) {
@@ -127,15 +127,15 @@ BBSortEx_Refill_IMP(BBSortEx *self) {
             ivars->mem_consumed += BB_Get_Size(elem);
         }
 
-        if (ivars->cache_max == ivars->cache_cap) {
+        if (ivars->buf_max == ivars->buf_cap) {
             BBSortEx_Grow_Cache(self,
-                                Memory_oversize(ivars->cache_max + 1,
+                                Memory_oversize(ivars->buf_max + 1,
                                                 sizeof(Obj*)));
         }
-        ivars->cache[ivars->cache_max++] = INCREF(elem);
+        ivars->buffer[ivars->buf_max++] = INCREF(elem);
     }
 
-    return ivars->cache_max;
+    return ivars->buf_max;
 }
 
 void

http://git-wip-us.apache.org/repos/asf/lucy/blob/4cff84bc/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index f8a2690..ce42550 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -45,10 +45,10 @@ SortEx_init(SortExternal *self) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
 
     ivars->mem_thresh   = UINT32_MAX;
-    ivars->cache        = NULL;
-    ivars->cache_cap    = 0;
-    ivars->cache_max    = 0;
-    ivars->cache_tick   = 0;
+    ivars->buffer       = NULL;
+    ivars->buf_cap      = 0;
+    ivars->buf_max      = 0;
+    ivars->buf_tick     = 0;
     ivars->scratch      = NULL;
     ivars->scratch_cap  = 0;
     ivars->runs         = VA_new(0);
@@ -67,9 +67,9 @@ SortEx_Destroy_IMP(SortExternal *self) {
     FREEMEM(ivars->scratch);
     FREEMEM(ivars->slice_sizes);
     FREEMEM(ivars->slice_starts);
-    if (ivars->cache) {
+    if (ivars->buffer) {
         SortEx_Clear_Cache(self);
-        FREEMEM(ivars->cache);
+        FREEMEM(ivars->buffer);
     }
     DECREF(ivars->runs);
     SUPER_DESTROY(self, SORTEXTERNAL);
@@ -78,34 +78,34 @@ SortEx_Destroy_IMP(SortExternal *self) {
 void
 SortEx_Clear_Cache_IMP(SortExternal *self) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
-    Obj **const cache = ivars->cache;
-    const uint32_t max = ivars->cache_max;
-    for (uint32_t i = ivars->cache_tick; i < max; i++) {
-        DECREF(cache[i]);
+    Obj **const buffer = ivars->buffer;
+    const uint32_t max = ivars->buf_max;
+    for (uint32_t i = ivars->buf_tick; i < max; i++) {
+        DECREF(buffer[i]);
     }
-    ivars->cache_max    = 0;
-    ivars->cache_tick   = 0;
+    ivars->buf_max    = 0;
+    ivars->buf_tick   = 0;
 }
 
 void
 SortEx_Feed_IMP(SortExternal *self, Obj *item) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
-    if (ivars->cache_max == ivars->cache_cap) {
-        size_t amount = Memory_oversize(ivars->cache_max + 1, sizeof(Obj*));
+    if (ivars->buf_max == ivars->buf_cap) {
+        size_t amount = Memory_oversize(ivars->buf_max + 1, sizeof(Obj*));
         SortEx_Grow_Cache(self, amount);
     }
-    ivars->cache[ivars->cache_max] = item;
-    ivars->cache_max++;
+    ivars->buffer[ivars->buf_max] = item;
+    ivars->buf_max++;
 }
 
 static CFISH_INLINE Obj*
 SI_peek(SortExternal *self, SortExternalIVARS *ivars) {
-    if (ivars->cache_tick >= ivars->cache_max) {
+    if (ivars->buf_tick >= ivars->buf_max) {
         S_refill_cache(self, ivars);
     }
 
-    if (ivars->cache_max > 0) {
-        return ivars->cache[ivars->cache_tick];
+    if (ivars->buf_max > 0) {
+        return ivars->buffer[ivars->buf_tick];
     }
     else {
         return NULL;
@@ -116,7 +116,7 @@ Obj*
 SortEx_Fetch_IMP(SortExternal *self) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
     Obj *item = SI_peek(self, ivars);
-    ivars->cache_tick++;
+    ivars->buf_tick++;
     return item;
 }
 
@@ -129,20 +129,20 @@ SortEx_Peek_IMP(SortExternal *self) {
 void
 SortEx_Sort_Cache_IMP(SortExternal *self) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
-    if (ivars->cache_tick != 0) {
-        THROW(ERR, "Cant Sort_Cache() after fetching %u32 items", ivars->cache_tick);
+    if (ivars->buf_tick != 0) {
+        THROW(ERR, "Cant Sort_Cache() after fetching %u32 items", ivars->buf_tick);
     }
-    if (ivars->cache_max != 0) {
+    if (ivars->buf_max != 0) {
         VTable *vtable = SortEx_Get_VTable(self);
         CFISH_Sort_Compare_t compare
             = (CFISH_Sort_Compare_t)METHOD_PTR(vtable, LUCY_SortEx_Compare);
-        if (ivars->scratch_cap < ivars->cache_cap) {
-            ivars->scratch_cap = ivars->cache_cap;
+        if (ivars->scratch_cap < ivars->buf_cap) {
+            ivars->scratch_cap = ivars->buf_cap;
             ivars->scratch
                 = (Obj**)REALLOCATE(ivars->scratch,
                                     ivars->scratch_cap * sizeof(Obj*));
         }
-        Sort_mergesort(ivars->cache, ivars->scratch, ivars->cache_max,
+        Sort_mergesort(ivars->buffer, ivars->scratch, ivars->buf_max,
                        sizeof(Obj*), compare, self);
     }
 }
@@ -168,24 +168,24 @@ SortEx_Add_Run_IMP(SortExternal *self, SortExternal *run) {
 void
 SortEx_Shrink_IMP(SortExternal *self) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
-    if (ivars->cache_max - ivars->cache_tick > 0) {
-        size_t cache_count = SortEx_Cache_Count(self);
-        size_t size        = cache_count * sizeof(Obj*);
-        if (ivars->cache_tick > 0) {
-            Obj **start = ivars->cache + ivars->cache_tick;
-            memmove(ivars->cache, start, size);
+    if (ivars->buf_max - ivars->buf_tick > 0) {
+        size_t buf_count = SortEx_Cache_Count(self);
+        size_t size        = buf_count * sizeof(Obj*);
+        if (ivars->buf_tick > 0) {
+            Obj **start = ivars->buffer + ivars->buf_tick;
+            memmove(ivars->buffer, start, size);
         }
-        ivars->cache      = (Obj**)REALLOCATE(ivars->cache, size);
-        ivars->cache_tick = 0;
-        ivars->cache_max  = cache_count;
-        ivars->cache_cap  = cache_count;
+        ivars->buffer   = (Obj**)REALLOCATE(ivars->buffer, size);
+        ivars->buf_tick = 0;
+        ivars->buf_max  = buf_count;
+        ivars->buf_cap  = buf_count;
     }
     else {
-        FREEMEM(ivars->cache);
-        ivars->cache      = NULL;
-        ivars->cache_tick = 0;
-        ivars->cache_max  = 0;
-        ivars->cache_cap  = 0;
+        FREEMEM(ivars->buffer);
+        ivars->buffer   = NULL;
+        ivars->buf_tick = 0;
+        ivars->buf_max  = 0;
+        ivars->buf_cap  = 0;
     }
     ivars->scratch_cap = 0;
     FREEMEM(ivars->scratch);
@@ -229,15 +229,15 @@ S_find_endpost(SortExternal *self, SortExternalIVARS *ivars) {
         // Get a run and retrieve the last item in its cache.
         SortExternal *const run = (SortExternal*)VA_Fetch(ivars->runs, i);
         SortExternalIVARS *const run_ivars = SortEx_IVARS(run);
-        const uint32_t tick = run_ivars->cache_max - 1;
-        if (tick >= run_ivars->cache_cap || run_ivars->cache_max < 1) {
+        const uint32_t tick = run_ivars->buf_max - 1;
+        if (tick >= run_ivars->buf_cap || run_ivars->buf_max < 1) {
             THROW(ERR, "Invalid SortExternal cache access: %u32 %u32 %u32", tick,
-                  run_ivars->cache_max, run_ivars->cache_cap);
+                  run_ivars->buf_max, run_ivars->buf_cap);
         }
         else {
             // Cache item with the highest sort value currently held in memory
             // by the run.
-            Obj **candidate = run_ivars->cache + tick;
+            Obj **candidate = run_ivars->buffer + tick;
 
             // If it's the first run, item is automatically the new endpost.
             if (i == 0) {
@@ -263,7 +263,7 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
     CFISH_Sort_Compare_t compare
         = (CFISH_Sort_Compare_t)METHOD_PTR(vtable, LUCY_SortEx_Compare);
 
-    if (ivars->cache_max != 0) { THROW(ERR, "Can't refill unless empty"); }
+    if (ivars->buf_max != 0) { THROW(ERR, "Can't refill unless empty"); }
 
     // Move all the elements in range into the main cache as slices.
     for (uint32_t i = 0; i < num_runs; i++) {
@@ -273,16 +273,16 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
 
         if (slice_size) {
             // Move slice content from run cache to main cache.
-            if (ivars->cache_max + slice_size > ivars->cache_cap) {
-                size_t cap = Memory_oversize(ivars->cache_max + slice_size,
+            if (ivars->buf_max + slice_size > ivars->buf_cap) {
+                size_t cap = Memory_oversize(ivars->buf_max + slice_size,
                                              sizeof(Obj*));
                 SortEx_Grow_Cache(self, cap);
             }
-            memcpy(ivars->cache + ivars->cache_max,
-                   run_ivars->cache + run_ivars->cache_tick,
+            memcpy(ivars->buffer + ivars->buf_max,
+                   run_ivars->buffer + run_ivars->buf_tick,
                    slice_size * sizeof(Obj*));
-            run_ivars->cache_tick += slice_size;
-            ivars->cache_max += slice_size;
+            run_ivars->buf_tick += slice_size;
+            ivars->buf_max += slice_size;
 
             // Track number of slices and slice sizes.
             slice_sizes[ivars->num_slices++] = slice_size;
@@ -292,14 +292,14 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
     // Transform slice starts from ticks to pointers.
     uint32_t total = 0;
     for (uint32_t i = 0; i < ivars->num_slices; i++) {
-        slice_starts[i] = ivars->cache + total;
+        slice_starts[i] = ivars->buffer + total;
         total += slice_sizes[i];
     }
 
     // The main cache now consists of several slices.  Sort the main cache,
     // but exploit the fact that each slice is already sorted.
-    if (ivars->scratch_cap < ivars->cache_cap) {
-        ivars->scratch_cap = ivars->cache_cap;
+    if (ivars->scratch_cap < ivars->buf_cap) {
+        ivars->scratch_cap = ivars->buf_cap;
         ivars->scratch = (Obj**)REALLOCATE(
                             ivars->scratch, ivars->scratch_cap * sizeof(Obj*));
     }
@@ -338,27 +338,27 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
 }
 
 void
-SortEx_Grow_Cache_IMP(SortExternal *self, uint32_t size) {
+SortEx_Grow_Cache_IMP(SortExternal *self, uint32_t cap) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
-    if (size > ivars->cache_cap) {
-        ivars->cache = (Obj**)REALLOCATE(ivars->cache, size * sizeof(Obj*));
-        ivars->cache_cap = size;
+    if (cap > ivars->buf_cap) {
+        ivars->buffer = (Obj**)REALLOCATE(ivars->buffer, cap * sizeof(Obj*));
+        ivars->buf_cap = cap;
     }
 }
 
 static uint32_t
 S_find_slice_size(SortExternal *self, SortExternalIVARS *ivars,
                   Obj **endpost) {
-    int32_t          lo      = ivars->cache_tick - 1;
-    int32_t          hi      = ivars->cache_max;
-    Obj            **cache   = ivars->cache;
+    int32_t          lo      = ivars->buf_tick - 1;
+    int32_t          hi      = ivars->buf_max;
+    Obj            **buffer  = ivars->buffer;
     SortEx_Compare_t compare
         = METHOD_PTR(SortEx_Get_VTable(self), LUCY_SortEx_Compare);
 
     // Binary search.
     while (hi - lo > 1) {
         const int32_t mid   = lo + ((hi - lo) / 2);
-        const int32_t delta = compare(self, cache + mid, endpost);
+        const int32_t delta = compare(self, buffer + mid, endpost);
         if (delta > 0) { hi = mid; }
         else           { lo = mid; }
     }
@@ -366,7 +366,7 @@ S_find_slice_size(SortExternal *self, SortExternalIVARS *ivars,
     // If lo is still -1, we didn't find anything.
     return lo == -1
            ? 0
-           : (lo - ivars->cache_tick) + 1;
+           : (lo - ivars->buf_tick) + 1;
 }
 
 void
@@ -377,7 +377,7 @@ SortEx_Set_Mem_Thresh_IMP(SortExternal *self, uint32_t mem_thresh) {
 uint32_t
 SortEx_Cache_Count_IMP(SortExternal *self) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);
-    return ivars->cache_max - ivars->cache_tick;
+    return ivars->buf_max - ivars->buf_tick;
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/4cff84bc/core/Lucy/Util/SortExternal.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.cfh b/core/Lucy/Util/SortExternal.cfh
index a813459..9674f92 100644
--- a/core/Lucy/Util/SortExternal.cfh
+++ b/core/Lucy/Util/SortExternal.cfh
@@ -38,10 +38,10 @@ parcel Lucy;
 abstract class Lucy::Util::SortExternal nickname SortEx
     inherits Clownfish::Obj {
 
-    Obj          **cache;
-    uint32_t       cache_cap;
-    uint32_t       cache_max;
-    uint32_t       cache_tick;
+    Obj          **buffer;
+    uint32_t       buf_cap;
+    uint32_t       buf_max;
+    uint32_t       buf_tick;
     Obj          **scratch;
     uint32_t       scratch_cap;
     VArray        *runs;
@@ -127,7 +127,7 @@ abstract class Lucy::Util::SortExternal nickname SortEx
     /** Allocate more memory to the cache.
      */
     void
-    Grow_Cache(SortExternal *self, uint32_t new_cache_cap);
+    Grow_Cache(SortExternal *self, uint32_t cap);
 
     void
     Set_Mem_Thresh(SortExternal *self, uint32_t mem_thresh);


Mime
View raw message