You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/11/07 18:06:35 UTC

[1/6] lucy git commit: Make num_slices a local variable

Repository: lucy
Updated Branches:
  refs/heads/master 4ad7e2fe6 -> b2c004b77


Make num_slices a local variable


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

Branch: refs/heads/master
Commit: 75a1c6ee751b2fcb7e031ca08cfecdb9bfdbabfa
Parents: 25759e0
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Nov 5 17:14:43 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Nov 5 17:14:43 2015 +0100

----------------------------------------------------------------------
 core/Lucy/Util/SortExternal.c   | 18 ++++++++----------
 core/Lucy/Util/SortExternal.cfh |  1 -
 2 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/75a1c6ee/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 4d75839..55ac9a2 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -55,7 +55,6 @@ SortEx_init(SortExternal *self) {
     ivars->runs         = Vec_new(0);
     ivars->slice_sizes  = NULL;
     ivars->slice_starts = NULL;
-    ivars->num_slices   = 0;
     ivars->flipped      = false;
 
     ABSTRACT_CLASS_CHECK(self, SORTEXTERNAL);
@@ -267,6 +266,7 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
     if (ivars->buf_max != 0) { THROW(ERR, "Can't refill unless empty"); }
 
     // Move all the elements in range into the main buffer as slices.
+    uint32_t num_slices = 0;
     for (uint32_t i = 0; i < num_runs; i++) {
         SortExternal *const run = (SortExternal*)Vec_Fetch(ivars->runs, i);
         SortExternalIVARS *const run_ivars = SortEx_IVARS(run);
@@ -286,13 +286,13 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
             ivars->buf_max += slice_size;
 
             // Track number of slices and slice sizes.
-            slice_sizes[ivars->num_slices++] = slice_size;
+            slice_sizes[num_slices++] = slice_size;
         }
     }
 
     // Transform slice starts from ticks to pointers.
     uint32_t total = 0;
-    for (uint32_t i = 0; i < ivars->num_slices; i++) {
+    for (uint32_t i = 0; i < num_slices; i++) {
         slice_starts[i] = ivars->buffer + total;
         total += slice_sizes[i];
     }
@@ -307,12 +307,12 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
 
     // Exploit previous sorting, rather than sort buffer naively.
     // Leave the first slice intact if the number of slices is odd. */
-    while (ivars->num_slices > 1) {
+    while (num_slices > 1) {
         uint32_t i = 0;
         uint32_t j = 0;
 
-        while (i < ivars->num_slices) {
-            if (ivars->num_slices - i >= 2) {
+        while (i < num_slices) {
+            if (num_slices - i >= 2) {
                 // Merge two consecutive slices.
                 const uint32_t merged_size = slice_sizes[i] + slice_sizes[i + 1];
                 Sort_merge(slice_starts[i], slice_sizes[i],
@@ -324,7 +324,7 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
                 i += 2;
                 j += 1;
             }
-            else if (ivars->num_slices - i >= 1) {
+            else if (num_slices - i >= 1) {
                 // Move single slice pointer.
                 slice_sizes[j]  = slice_sizes[i];
                 slice_starts[j] = slice_starts[i];
@@ -332,10 +332,8 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
                 j += 1;
             }
         }
-        ivars->num_slices = j;
+        num_slices = j;
     }
-
-    ivars->num_slices = 0;
 }
 
 void

http://git-wip-us.apache.org/repos/asf/lucy/blob/75a1c6ee/core/Lucy/Util/SortExternal.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.cfh b/core/Lucy/Util/SortExternal.cfh
index 8ac0ad0..cdc2dbb 100644
--- a/core/Lucy/Util/SortExternal.cfh
+++ b/core/Lucy/Util/SortExternal.cfh
@@ -45,7 +45,6 @@ abstract class Lucy::Util::SortExternal nickname SortEx
     Obj          **scratch;
     uint32_t       scratch_cap;
     Vector        *runs;
-    uint32_t       num_slices;
     Obj         ***slice_starts;
     uint32_t      *slice_sizes;
     uint32_t       mem_thresh;


[6/6] lucy git commit: Merge branch 'sort-external'

Posted by nw...@apache.org.
Merge branch 'sort-external'

My main motivation was to switch to a custom implementation of
Clownfish's Sort_merge. I added some improvements to S_absorb_slices
along the way.

Closes #27.


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

Branch: refs/heads/master
Commit: b2c004b7709e1efc4fc42c154c951bf57e51fbf7
Parents: 4ad7e2f 38ac0f0
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Nov 7 18:05:12 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Nov 7 18:05:12 2015 +0100

----------------------------------------------------------------------
 core/Lucy/Index/PostingPool.c       |   6 +-
 core/Lucy/Index/PostingPool.cfh     |   2 +-
 core/Lucy/Index/SortFieldWriter.c   |   6 +-
 core/Lucy/Index/SortFieldWriter.cfh |   2 +-
 core/Lucy/Util/BlobSortEx.c         |   4 +-
 core/Lucy/Util/BlobSortEx.cfh       |   2 +-
 core/Lucy/Util/SortExternal.c       | 123 +++++++++++++++++++++----------
 core/Lucy/Util/SortExternal.cfh     |   3 +-
 8 files changed, 95 insertions(+), 53 deletions(-)
----------------------------------------------------------------------



[3/6] lucy git commit: Avoid initial copy from SortEx run to main buffer

Posted by nw...@apache.org.
Avoid initial copy from SortEx run to main buffer


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

Branch: refs/heads/master
Commit: 781700d9618c75789d75eecdee21ae86a758b6ff
Parents: bd22f8d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Nov 5 18:07:13 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Nov 5 18:07:13 2015 +0100

----------------------------------------------------------------------
 core/Lucy/Util/SortExternal.c | 44 +++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/781700d9/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 6b6fc22..03f0722 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -265,42 +265,42 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
 
     if (ivars->buf_max != 0) { THROW(ERR, "Can't refill unless empty"); }
 
-    // Move all the elements in range into the main buffer as slices.
+    // Find non-empty slices.
     uint32_t num_slices = 0;
+    uint32_t total_size = 0;
     for (uint32_t i = 0; i < num_runs; i++) {
         SortExternal *const run = (SortExternal*)Vec_Fetch(ivars->runs, i);
         SortExternalIVARS *const run_ivars = SortEx_IVARS(run);
         uint32_t slice_size = S_find_slice_size(run, run_ivars, endpost);
 
         if (slice_size) {
-            // Move slice content from run buffer to main buffer.
-            if (ivars->buf_max + slice_size > ivars->buf_cap) {
-                size_t cap = Memory_oversize(ivars->buf_max + slice_size,
-                                             sizeof(Obj*));
-                SortEx_Grow_Buffer(self, cap);
-            }
-            memcpy(ivars->buffer + ivars->buf_max,
-                   run_ivars->buffer + run_ivars->buf_tick,
-                   slice_size * sizeof(Obj*));
+            // Track slice start and size.
+            slice_starts[num_slices] = run_ivars->buffer + run_ivars->buf_tick;
+            slice_sizes[num_slices]  = slice_size;
             run_ivars->buf_tick += slice_size;
-            ivars->buf_max += slice_size;
 
-            // Track number of slices and slice sizes.
-            slice_sizes[num_slices++] = slice_size;
+            num_slices++;
+            total_size += slice_size;
         }
     }
 
-    // Transform slice starts from ticks to pointers.
-    uint32_t total = 0;
-    for (uint32_t i = 0; i < num_slices; i++) {
-        slice_starts[i] = ivars->buffer + total;
-        total += slice_sizes[i];
+    if (num_slices == 0) { return; }
+
+    if (ivars->buf_cap < total_size) {
+        size_t cap = Memory_oversize(total_size, sizeof(Obj*));
+        SortEx_Grow_Buffer(self, cap);
+    }
+    ivars->buf_max = total_size;
+
+    if (num_slices == 1) {
+        // Copy single slice content from run buffer to main buffer.
+        memcpy(ivars->buffer, slice_starts[0], total_size * sizeof(Obj*));
+        return;
     }
 
-    // The main buffer now consists of several slices.  Sort the main buffer,
-    // but exploit the fact that each slice is already sorted.
-    if (ivars->scratch_cap < ivars->buf_cap) {
-        ivars->scratch_cap = ivars->buf_cap;
+    // There are more than two slices to merge.
+    if (ivars->scratch_cap < total_size) {
+        ivars->scratch_cap = total_size;
         ivars->scratch = (Obj**)REALLOCATE(
                             ivars->scratch, ivars->scratch_cap * sizeof(Obj*));
     }


[2/6] lucy git commit: Avoid intermediate copies during SortEx merge

Posted by nw...@apache.org.
Avoid intermediate copies during SortEx merge


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

Branch: refs/heads/master
Commit: bd22f8dc6c918a9627c87063b60f7f5854a6184c
Parents: 75a1c6e
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Nov 5 18:05:02 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Nov 5 18:05:02 2015 +0100

----------------------------------------------------------------------
 core/Lucy/Util/SortExternal.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/bd22f8dc/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 55ac9a2..6b6fc22 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -305,34 +305,43 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
                             ivars->scratch, ivars->scratch_cap * sizeof(Obj*));
     }
 
-    // Exploit previous sorting, rather than sort buffer naively.
-    // Leave the first slice intact if the number of slices is odd. */
+    // Divide-and-conquer k-way merge.
     while (num_slices > 1) {
         uint32_t i = 0;
         uint32_t j = 0;
+        Obj **dest = ivars->scratch;
 
         while (i < num_slices) {
             if (num_slices - i >= 2) {
                 // Merge two consecutive slices.
                 const uint32_t merged_size = slice_sizes[i] + slice_sizes[i + 1];
                 Sort_merge(slice_starts[i], slice_sizes[i],
-                           slice_starts[i + 1], slice_sizes[i + 1], ivars->scratch,
+                           slice_starts[i + 1], slice_sizes[i + 1], dest,
                            sizeof(Obj*), compare, self);
                 slice_sizes[j]  = merged_size;
-                slice_starts[j] = slice_starts[i];
-                memcpy(slice_starts[j], ivars->scratch, merged_size * sizeof(Obj*));
+                slice_starts[j] = dest;
+                dest += merged_size;
                 i += 2;
                 j += 1;
             }
             else if (num_slices - i >= 1) {
-                // Move single slice pointer.
+                // Move last slice.
+                memcpy(dest, slice_starts[i], slice_sizes[i] * sizeof(Obj*));
                 slice_sizes[j]  = slice_sizes[i];
-                slice_starts[j] = slice_starts[i];
+                slice_starts[j] = dest;
                 i += 1;
                 j += 1;
             }
         }
         num_slices = j;
+
+        // Swap scratch and buffer.
+        Obj      **tmp_buf = ivars->buffer;
+        uint32_t   tmp_cap = ivars->buf_cap;
+        ivars->buffer      = ivars->scratch;
+        ivars->buf_cap     = ivars->scratch_cap;
+        ivars->scratch     = tmp_buf;
+        ivars->scratch_cap = tmp_cap;
     }
 }
 


[4/6] lucy git commit: Use custom merge function in SortEx

Posted by nw...@apache.org.
Use custom merge function in SortEx


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

Branch: refs/heads/master
Commit: 670e0133f64031d967acff9513a96e76bcd88d94
Parents: 781700d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Nov 5 20:10:11 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Nov 5 20:10:11 2015 +0100

----------------------------------------------------------------------
 core/Lucy/Util/SortExternal.c | 46 +++++++++++++++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/670e0133/core/Lucy/Util/SortExternal.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.c b/core/Lucy/Util/SortExternal.c
index 03f0722..976cab4 100644
--- a/core/Lucy/Util/SortExternal.c
+++ b/core/Lucy/Util/SortExternal.c
@@ -30,6 +30,12 @@ static void
 S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
                 Obj **endpost);
 
+static void
+S_merge(SortExternal *self,
+        Obj **left_ptr,  size_t left_size,
+        Obj **right_ptr, size_t right_size,
+        Obj **dest, SortEx_Compare_t compare);
+
 // Return the address for the item in one of the runs' buffers which is the
 // highest in sort order, but which we can guarantee is lower in sort order
 // than any item which has yet to enter a run buffer.
@@ -260,8 +266,7 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
     Obj      ***slice_starts = ivars->slice_starts;
     uint32_t   *slice_sizes  = ivars->slice_sizes;
     Class      *klass        = SortEx_get_class(self);
-    CFISH_Sort_Compare_t compare
-        = (CFISH_Sort_Compare_t)METHOD_PTR(klass, LUCY_SortEx_Compare);
+    SortEx_Compare_t compare = METHOD_PTR(klass, LUCY_SortEx_Compare);
 
     if (ivars->buf_max != 0) { THROW(ERR, "Can't refill unless empty"); }
 
@@ -315,9 +320,10 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
             if (num_slices - i >= 2) {
                 // Merge two consecutive slices.
                 const uint32_t merged_size = slice_sizes[i] + slice_sizes[i + 1];
-                Sort_merge(slice_starts[i], slice_sizes[i],
-                           slice_starts[i + 1], slice_sizes[i + 1], dest,
-                           sizeof(Obj*), compare, self);
+                S_merge(self,
+                        slice_starts[i], slice_sizes[i],
+                        slice_starts[i + 1], slice_sizes[i + 1],
+                        dest, compare);
                 slice_sizes[j]  = merged_size;
                 slice_starts[j] = dest;
                 dest += merged_size;
@@ -345,6 +351,36 @@ S_absorb_slices(SortExternal *self, SortExternalIVARS *ivars,
     }
 }
 
+// Assumes left_size > 0 and right_size > 0.
+static void
+S_merge(SortExternal *self,
+        Obj **left_ptr,  size_t left_size,
+        Obj **right_ptr, size_t right_size,
+        Obj **dest, SortEx_Compare_t compare) {
+
+    Obj **left_limit  = left_ptr  + left_size;
+    Obj **right_limit = right_ptr + right_size;
+
+    while (1) {
+        if (compare(self, left_ptr, right_ptr) <= 0) {
+            *dest++ = *left_ptr++;
+            if (left_ptr >= left_limit) {
+                right_size = right_limit - right_ptr;
+                memcpy(dest, right_ptr, right_size * sizeof(Obj*));
+                break;
+            }
+        }
+        else {
+            *dest++ = *right_ptr++;
+            if (right_ptr >= right_limit) {
+                left_size = left_limit - left_ptr;
+                memcpy(dest, left_ptr, left_size * sizeof(Obj*));
+                break;
+            }
+        }
+    }
+}
+
 void
 SortEx_Grow_Buffer_IMP(SortExternal *self, uint32_t cap) {
     SortExternalIVARS *const ivars = SortEx_IVARS(self);


[5/6] lucy git commit: Tighten Sort_Ex_Compare parameter types

Posted by nw...@apache.org.
Tighten Sort_Ex_Compare parameter types


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

Branch: refs/heads/master
Commit: 38ac0f0b2bf4ea0b0af28a0022b5c66498a956ac
Parents: 670e013
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Nov 5 20:19:54 2015 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Nov 5 20:19:54 2015 +0100

----------------------------------------------------------------------
 core/Lucy/Index/PostingPool.c       | 6 +++---
 core/Lucy/Index/PostingPool.cfh     | 2 +-
 core/Lucy/Index/SortFieldWriter.c   | 6 +++---
 core/Lucy/Index/SortFieldWriter.cfh | 2 +-
 core/Lucy/Util/BlobSortEx.c         | 4 ++--
 core/Lucy/Util/BlobSortEx.cfh       | 2 +-
 core/Lucy/Util/SortExternal.cfh     | 2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/38ac0f0b/core/Lucy/Index/PostingPool.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.c b/core/Lucy/Index/PostingPool.c
index 357755a..4ef1c3e 100644
--- a/core/Lucy/Index/PostingPool.c
+++ b/core/Lucy/Index/PostingPool.c
@@ -144,9 +144,9 @@ PostPool_Destroy_IMP(PostingPool *self) {
 }
 
 int
-PostPool_Compare_IMP(PostingPool *self, void *va, void *vb) {
-    RawPostingIVARS *const a     = RawPost_IVARS(*(RawPosting**)va);
-    RawPostingIVARS *const b     = RawPost_IVARS(*(RawPosting**)vb);
+PostPool_Compare_IMP(PostingPool *self, Obj **ptr_a, Obj **ptr_b) {
+    RawPostingIVARS *const a     = RawPost_IVARS(*(RawPosting**)ptr_a);
+    RawPostingIVARS *const b     = RawPost_IVARS(*(RawPosting**)ptr_b);
     const size_t      a_len = a->content_len;
     const size_t      b_len = b->content_len;
     const size_t      len   = a_len < b_len ? a_len : b_len;

http://git-wip-us.apache.org/repos/asf/lucy/blob/38ac0f0b/core/Lucy/Index/PostingPool.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/PostingPool.cfh b/core/Lucy/Index/PostingPool.cfh
index 587955b..a494f8e 100644
--- a/core/Lucy/Index/PostingPool.cfh
+++ b/core/Lucy/Index/PostingPool.cfh
@@ -85,7 +85,7 @@ class Lucy::Index::PostingPool nickname PostPool
     /** Compares two non-NULL RawPosting objects.
      */
     int
-    Compare(PostingPool *self, void *va, void *vb);
+    Compare(PostingPool *self, Obj **ptr_a, Obj **ptr_b);
 
     void
     Finish(PostingPool *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/38ac0f0b/core/Lucy/Index/SortFieldWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c
index 95007a9..f73698c 100644
--- a/core/Lucy/Index/SortFieldWriter.c
+++ b/core/Lucy/Index/SortFieldWriter.c
@@ -327,10 +327,10 @@ S_write_val(Obj *val, int8_t prim_id, OutStream *ix_out, OutStream *dat_out,
 }
 
 int
-SortFieldWriter_Compare_IMP(SortFieldWriter *self, void *va, void *vb) {
+SortFieldWriter_Compare_IMP(SortFieldWriter *self, Obj **ptr_a, Obj **ptr_b) {
     SortFieldWriterIVARS *const ivars = SortFieldWriter_IVARS(self);
-    SFWriterElemIVARS *a = SFWriterElem_IVARS(*(SFWriterElem**)va);
-    SFWriterElemIVARS *b = SFWriterElem_IVARS(*(SFWriterElem**)vb);
+    SFWriterElemIVARS *a = SFWriterElem_IVARS(*(SFWriterElem**)ptr_a);
+    SFWriterElemIVARS *b = SFWriterElem_IVARS(*(SFWriterElem**)ptr_b);
     int32_t comparison
         = FType_null_back_compare_values(ivars->type, a->value, b->value);
     if (comparison == 0) { comparison = a->doc_id - b->doc_id; }

http://git-wip-us.apache.org/repos/asf/lucy/blob/38ac0f0b/core/Lucy/Index/SortFieldWriter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/SortFieldWriter.cfh b/core/Lucy/Index/SortFieldWriter.cfh
index a2d0ddc..f0bcdea 100644
--- a/core/Lucy/Index/SortFieldWriter.cfh
+++ b/core/Lucy/Index/SortFieldWriter.cfh
@@ -83,7 +83,7 @@ class Lucy::Index::SortFieldWriter
     Finish(SortFieldWriter *self);
 
     int
-    Compare(SortFieldWriter *self, void *va, void *vb);
+    Compare(SortFieldWriter *self, Obj **ptr_a, Obj **ptr_b);
 
     int32_t
     Get_Null_Ord(SortFieldWriter *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/38ac0f0b/core/Lucy/Util/BlobSortEx.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/BlobSortEx.c b/core/Lucy/Util/BlobSortEx.c
index 6d41488..3126c1d 100644
--- a/core/Lucy/Util/BlobSortEx.c
+++ b/core/Lucy/Util/BlobSortEx.c
@@ -165,9 +165,9 @@ BlobSortEx_Flip_IMP(BlobSortEx *self) {
 }
 
 int
-BlobSortEx_Compare_IMP(BlobSortEx *self, void *va, void *vb) {
+BlobSortEx_Compare_IMP(BlobSortEx *self, Obj **ptr_a, Obj **ptr_b) {
     UNUSED_VAR(self);
-    return Blob_compare((Blob**)va, (Blob**)vb);
+    return Blob_compare((Blob**)ptr_a, (Blob**)ptr_b);
 }
 
 Vector*

http://git-wip-us.apache.org/repos/asf/lucy/blob/38ac0f0b/core/Lucy/Util/BlobSortEx.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/BlobSortEx.cfh b/core/Lucy/Util/BlobSortEx.cfh
index 47cef86..e603a9b 100644
--- a/core/Lucy/Util/BlobSortEx.cfh
+++ b/core/Lucy/Util/BlobSortEx.cfh
@@ -49,7 +49,7 @@ class Lucy::Util::BlobSortEx
     Flip(BlobSortEx *self);
 
     int
-    Compare(BlobSortEx *self, void *va, void *vb);
+    Compare(BlobSortEx *self, Obj **ptr_a, Obj **ptr_b);
 
     incremented Vector*
     Peek_Cache(BlobSortEx *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/38ac0f0b/core/Lucy/Util/SortExternal.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/SortExternal.cfh b/core/Lucy/Util/SortExternal.cfh
index cdc2dbb..d5395ee 100644
--- a/core/Lucy/Util/SortExternal.cfh
+++ b/core/Lucy/Util/SortExternal.cfh
@@ -56,7 +56,7 @@ abstract class Lucy::Util::SortExternal nickname SortEx
     /** Compare two sortable elements.
      */
     abstract int
-    Compare(SortExternal *self, void *va, void *vb);
+    Compare(SortExternal *self, Obj **ptr_a, Obj **ptr_b);
 
     /** Flush all elements currently in the buffer.
      *