Change direction of swap in/out to forward, so that core is read/written in deque...
authorNick Downing <nick@ndcode.org>
Sun, 31 Mar 2019 02:40:20 +0000 (13:40 +1100)
committerNick Downing <nick@ndcode.org>
Sun, 31 Mar 2019 02:40:20 +0000 (13:40 +1100)
core.h
pool.c
process.c
process_test_run.c
swap.c
swap.h

diff --git a/core.h b/core.h
index a3c98e2..1c6e971 100644 (file)
--- a/core.h
+++ b/core.h
   pool_alloc_moveable(&core_table, item, size)
 #define core_table_realloc(item, size) \
   pool_realloc_moveable(&core_table, item, size)
+#define core_table_realloc_base(item, size) \
+  pool_realloc_base_moveable(&core_table, item, size)
 #else
 #define core_table_alloc(item, size) \
   pool_alloc(&core_table, item, size)
 #define core_table_realloc(item, size) \
   pool_realloc(&core_table, item, size)
+#define core_table_realloc_base(item, size) \
+  pool_realloc_base(&core_table, item, size)
 #endif
 #define core_table_free(item) pool_free(&core_table, item)
 
diff --git a/pool.c b/pool.c
index 70af153..0a55269 100644 (file)
--- a/pool.c
+++ b/pool.c
@@ -719,7 +719,7 @@ blocker_test:
   while (true) {
     p = q;
     q = p->next;
-    if (p == item) {
+    if (q == item) {
       assert(item->limit - size >= item->prev->limit);
       goto resize;
     }
index 6753c09..159d834 100644 (file)
--- a/process.c
+++ b/process.c
@@ -199,7 +199,7 @@ static void do_swap_out(int swap_out) {
   // loop entry code for the case of an existing victim
   if (swap_out > 0) {
     if (victim) {
-      // calculate amount to swap
+      // calculate amount to swap out
 #ifndef PREALLOCATE_CORE
       victim_core_size = victim_core_item.limit - victim_core_item.base;
 #endif
@@ -234,9 +234,10 @@ static void do_swap_out(int swap_out) {
 #else
       pool_move_item(&victim->pool_item, &victim_core_item);
       victim_core_size = victim_core_item.limit - victim_core_item.base;
+ assert(victim_core_size == victim->size);
 #endif
 
-      // calculate amount to swap
+      // calculate amount to swap out
       size = swap_out < victim_core_size ? swap_out : victim_core_size;
  printf("new victim %d, swap out %d of %d\n", (int)(victim - processes), size, victim_core_size);
 
@@ -249,14 +250,14 @@ static void do_swap_out(int swap_out) {
     loop_entry:
       // transfer data to swap
 #ifdef PREALLOCATE_SWAP
-      swap_base = ~(victim->swap_item.base + victim_swap_size);
+      swap_base = victim->swap_item.base + victim_swap_size - size;
 #else
-      swap_base = ~victim_swap_item.limit;
+      swap_base = victim_swap_item.limit - size;
 #endif
 #ifdef PREALLOCATE_CORE
-      core_base = victim->core_item.base + victim_core_size - size;
+      core_base = victim->core_item.base + victim_swap_size - size;
 #else
-      core_base = victim_core_item.limit - size;
+      core_base = victim_core_item.base;
 #endif
 #ifdef INDIRECT_SWAP
       rassert(swap_block_alloc(swap_table_mem + swap_base, size));
@@ -271,7 +272,7 @@ static void do_swap_out(int swap_out) {
       if (victim_core_size) {
 #ifndef PREALLOCATE_CORE
         // no, reduce core allocation, using dedicated core item
-        rassert(core_table_realloc(&victim_core_item, victim_core_size));
+        rassert(core_table_realloc_base(&victim_core_item, victim_core_size));
 #endif
 
         // as an optimization, skip the calculation of swap_out -= size
@@ -457,7 +458,6 @@ bool process_realloc(struct process *process, int size) {
       )
     );
   else
- {
     core_block_free(
 #ifdef PREALLOCATE_CORE
       core_table_mem + process->core_item.limit,
@@ -466,7 +466,6 @@ bool process_realloc(struct process *process, int size) {
 #endif
       -size_change
     );
- }
 #endif
  
   // track total allocation
@@ -517,18 +516,20 @@ void process_run(struct process *process) {
 #else
       pool_move_item(&process->pool_item, &process_swap_item);
       process_swap_size = process_swap_item.limit - process_swap_item.base;
+ assert(process_swap_size == process->size);
 #endif
 
-      // calculate amount to swap
+      // calculate amounts to swap out then in
       size = process_swap_size;
       swap_out = size - core_avail();
+#if !defined(PREALLOCATE_SWAP) || defined(INDIRECT_SWAP)
       if (swap_out > swap_avail()) {
         size += swap_avail() - swap_out;
         swap_out = swap_avail();
       }
+#endif
 
       // free up as much core as we can
-      assert(swap_out <= swap_avail());
       do_swap_out(swap_out);
 
       // add to core pool, using dedicated core item
@@ -569,13 +570,15 @@ void process_run(struct process *process) {
 
     loop_entry_partial:
 #endif
-      // calculate how much to swap
+      // calculate amounts to swap out then in
       size = process_swap_size;
       swap_out = size - core_avail();
+#if !defined(PREALLOCATE_SWAP) || defined(INDIRECT_SWAP)
       if (swap_out > swap_avail()) {
         size += swap_avail() - swap_out;
         swap_out = swap_avail();
       }
+#endif
 
       // free up as much core as we can
       do_swap_out(swap_out);
@@ -583,20 +586,20 @@ void process_run(struct process *process) {
       // increase core allocation
       process_core_size += size;
 #ifndef PREALLOCATE_CORE
-      rassert(core_table_realloc(&process_core_item, process_core_size));
+      rassert(core_table_realloc_base(&process_core_item, process_core_size));
 #endif
 
     loop_entry_full:
       // transfer data to core
 #ifdef PREALLOCATE_SWAP
-      swap_base = ~(process->swap_item.base + process_swap_size);
+      swap_base = process->swap_item.base + process_swap_size - size;
 #else
-      swap_base = ~process_swap_item.limit;
+      swap_base = process_swap_item.limit - size;
 #endif
 #ifdef PREALLOCATE_CORE
-      core_base = process->core_item.base + process_core_size - size;
+      core_base = process->core_item.base + process_swap_size - size;
 #else
-      core_base = process_core_item.limit - size;
+      core_base = process_core_item.base;
 #endif
 #ifdef INDIRECT_CORE
       core_block_alloc(core_table_mem + core_base, size);
@@ -663,7 +666,7 @@ void process_free(struct process *process) {
 #ifdef PREALLOCATE_CORE
 #ifdef INDIRECT_CORE
     core_block_free(
-      core_table_mem + process->core_item.base,
+      core_table_mem + process->core_item.base + victim_swap_size,
       victim_core_size
     );
 #endif
@@ -680,7 +683,7 @@ void process_free(struct process *process) {
 #ifdef PREALLOCATE_SWAP
 #ifdef INDIRECT_SWAP
     swap_block_free(
-      swap_table_mem + ~(process->swap_item.base + victim_swap_size),
+      swap_table_mem + process->swap_item.base,
       victim_swap_size
     );
 #endif
@@ -688,7 +691,7 @@ void process_free(struct process *process) {
 #else
 #ifdef INDIRECT_SWAP
     swap_block_free(
-      swap_table_mem + ~victim_swap_item.limit,
+      swap_table_mem + victim_swap_item.base,
       victim_swap_item.limit - victim_swap_item.base
     );
 #endif
@@ -700,14 +703,14 @@ void process_free(struct process *process) {
 #ifdef PREALLOCATE_SWAP
 #ifdef INDIRECT_SWAP
     swap_block_free(
-      swap_table_mem + ~(process->swap_item.limit),
+      swap_table_mem + process->swap_item.base,
       process->swap_item.limit - process->swap_item.base 
     );
 #endif
 #else
 #ifdef INDIRECT_SWAP
     swap_block_free(
-      swap_table_mem + ~(process->pool_item.limit),
+      swap_table_mem + process->pool_item.base,
       process->pool_item.limit - process->pool_item.base 
     );
 #endif
index cdff8a6..5fbfbe8 100644 (file)
@@ -101,7 +101,7 @@ int main(int argc, char **argv) {
  printf("new core [%d,%d)\n", core_base, core_base + size);
           core_hash_init(process, core_base, 0, size);
 #ifdef PREALLOCATE_SWAP
- printf("new swap [%d,%d)\n", ~processes[process].swap_item.limit, ~processes[process].swap_item.base);
+ printf("new swap [%d,%d)\n", processes[process].swap_item.base, processes[process].swap_item.limit);
 #endif
         }
       }
@@ -151,7 +151,7 @@ int main(int argc, char **argv) {
           rassert(actual_old_size <= old_size);
         }
 #ifdef PREALLOCATE_SWAP
- printf("old core [%d,%d) swap [%d,%d)\n", core_base, core_base + actual_old_size, ~processes[process].swap_item.limit, ~processes[process].swap_item.base);
+ printf("old core [%d,%d) swap [%d,%d)\n", core_base, core_base + actual_old_size, processes[process].swap_item.base, processes[process].swap_item.limit);
 #else
  printf("old core [%d,%d)\n", core_base, core_base + actual_old_size);
 #endif
@@ -177,7 +177,7 @@ int main(int argc, char **argv) {
             rassert(processes[process].pool_item.limit == core_base + size);
 #endif
 #ifdef PREALLOCATE_SWAP
- printf("new core [%d,%d) swap [%d,%d)\n", core_base, core_base + size, ~processes[process].swap_item.limit, ~processes[process].swap_item.base);
+ printf("new core [%d,%d) swap [%d,%d)\n", core_base, core_base + size, processes[process].swap_item.base, processes[process].swap_item.limit);
 #else
  printf("new core [%d,%d)\n", core_base, core_base + size);
 #endif
@@ -218,13 +218,30 @@ int main(int argc, char **argv) {
         }
         bool is_victim = processes + process == victim;
         bool in_core = processes[process].lru_item.prev != NULL;
+#ifdef PREALLOCATE_SWAP
+        int swap_size =
+          is_victim ?
+            victim_swap_size :
+            !in_core ? processes[process].size : 0;
+        int swap_base =
+          processes[process].swap_item.base;
+#else
+        int swap_base =
+          is_victim ?
+            victim_swap_item.base :
+            !in_core ? processes[process].pool_item.base : -1;
+        int swap_size =
+           is_victim ?
+             victim_swap_item.limit - swap_base :
+             !in_core ? processes[process].pool_item.limit - swap_base : 0;
+#endif
 #ifdef PREALLOCATE_CORE
         int core_size =
           is_victim ?
             victim_core_size :
             in_core ? processes[process].size : 0;
         int core_base =
-          processes[process].core_item.base;
+          processes[process].core_item.base + swap_size;
 #else
         int core_base =
           is_victim ?
@@ -234,29 +251,12 @@ int main(int argc, char **argv) {
            is_victim ?
              victim_core_item.limit - core_base :
              in_core ? processes[process].pool_item.limit - core_base : 0;
-#endif
-#ifdef PREALLOCATE_SWAP
-        int swap_size =
-          is_victim ?
-          victim_swap_size :
-          !in_core ? processes[process].size : 0;
-        int swap_limit =
-          processes[process].swap_item.base + swap_size;
-#else
-        int swap_limit =
-          is_victim ?
-            victim_swap_item.limit :
-            !in_core ? processes[process].pool_item.limit : 0;
-        int swap_size =
-          is_victim ?
-            swap_limit - victim_swap_item.base :
-            !in_core ? swap_limit - processes[process].pool_item.base : 0;
 #endif
         rassert(core_size + swap_size == actual_old_size);
-        int swap_base = ~swap_limit;
  printf("old core [%d,%d) swap [%d,%d)\n", core_base, core_base + core_size, swap_base, swap_base + swap_size);
-        core_hash_verify(process, core_base, 0, core_size);
-        swap_hash_verify(process, swap_base, 0, swap_size, core_size);
+ fflush(stdout);
+        core_hash_verify(process, core_base - swap_size, swap_size, swap_size + core_size);
+        swap_hash_verify(process, swap_base, 0, swap_size);
         process_free(processes + process);
         processes[process].size = -1;
         printf("... ok\n");
@@ -274,13 +274,30 @@ done:
     else {
       bool is_victim = processes + i == victim;
       bool in_core = processes[i].lru_item.prev != NULL;
+#ifdef PREALLOCATE_SWAP
+      int swap_size =
+        is_victim ?
+          victim_swap_size :
+          !in_core ? processes[i].size : 0;
+      int swap_base =
+        processes[i].swap_item.base;
+#else
+      int swap_base =
+        is_victim ?
+          victim_swap_item.base :
+          !in_core ? processes[i].pool_item.base : -1;
+      int swap_size =
+         is_victim ?
+           victim_swap_item.limit - swap_base :
+           !in_core ? processes[i].pool_item.limit - swap_base : 0;
+#endif
 #ifdef PREALLOCATE_CORE
       int core_size =
         is_victim ?
           victim_core_size :
           in_core ? processes[i].size : 0;
       int core_base =
-        processes[i].core_item.base;
+        processes[i].core_item.base + swap_size;
 #else
       int core_base =
         is_victim ?
@@ -290,26 +307,8 @@ done:
          is_victim ?
            victim_core_item.limit - core_base :
            in_core ? processes[i].pool_item.limit - core_base : 0;
-#endif
-#ifdef PREALLOCATE_SWAP
-      int swap_size =
-        is_victim ?
-        victim_swap_size :
-        !in_core ? processes[i].size : 0;
-      int swap_limit =
-        processes[i].swap_item.base + swap_size;
-#else
-      int swap_limit =
-        is_victim ?
-          victim_swap_item.limit :
-          !in_core ? processes[i].pool_item.limit : 0;
-      int swap_size =
-        is_victim ?
-          swap_limit - victim_swap_item.base :
-          !in_core ? swap_limit - processes[i].pool_item.base : 0;
 #endif
       rassert(core_size + swap_size == processes[i].size);
-      int swap_base = ~swap_limit;
       printf(
         "process %d: core [%d,%d) swap [%d,%d)\n",
         i,
@@ -318,11 +317,11 @@ done:
         swap_base,
         swap_base + swap_size
       );
-      core_hash_verify(i, core_base, 0, core_size);
+      core_hash_verify(i, core_base - swap_size, swap_size, swap_size + core_size);
 #ifdef INDIRECT_CORE
       core_block_free(core_table_mem + core_base, core_size);
 #endif
-      swap_hash_verify(i, swap_base, 0, swap_size, core_size);
+      swap_hash_verify(i, swap_base, 0, swap_size);
 #ifdef INDIRECT_SWAP
       swap_block_free(swap_table_mem + swap_base, swap_size);
 #endif
diff --git a/swap.c b/swap.c
index 32eae9e..0a04074 100644 (file)
--- a/swap.c
+++ b/swap.c
@@ -21,34 +21,29 @@ int swap_block_avail;
 #endif
 uint8_t *swap_block_mem;
 
-// swap address native wrt. pool and complemented wrt. backing store,
-// means that swap_move() moves upward in backing store, do backward
 static void swap_move(struct pool_item *item, int new_base) {
   int base = item->base;
-  int neg_size = base - item->limit;
-
-  int limit = ~base;
-  int new_limit = ~new_base;
+  int size = item->limit - base;
   printf(
     "swap_move [%d,%d) to [%d,%d)\n",
-    limit + neg_size,
-    limit,
-    new_limit + neg_size,
-    new_limit
+    base,
+    base + size,
+    new_base,
+    new_base + size
   );
-  assert(new_limit >= limit || new_limit <= limit + neg_size);
-  for (int i = -1; i >= neg_size; --i) {
+  assert(new_base <= base || new_base >= base + size);
+  for (int i = 0; i < size; ++i) {
 #ifdef INDIRECT_SWAP
-    swap_table_mem[new_limit + i] = swap_table_mem[limit + i];
-    swap_table_mem[limit + i] = 0x55555555;
+    swap_table_mem[new_base + i] = swap_table_mem[base + i];
+    swap_table_mem[base + i] = 0x55555555;
 #else
     memcpy(
-      swap_block_mem + (new_limit + i) * BLOCK_SIZE,
-      swap_block_mem + (limit + i) * BLOCK_SIZE,
+      swap_block_mem + (new_base + i) * BLOCK_SIZE,
+      swap_block_mem + (base + i) * BLOCK_SIZE,
       BLOCK_SIZE
     );
     memset(
-      swap_block_mem + (limit + i) * BLOCK_SIZE,
+      swap_block_mem + (base + i) * BLOCK_SIZE,
       0xaa,
       BLOCK_SIZE
     );
@@ -57,34 +52,29 @@ static void swap_move(struct pool_item *item, int new_base) {
 }
 
 #ifdef MOVEABLE_SWAP
-// swap address native wrt. pool and complemented wrt. backing store,
-// means that swap_move_up() moves downward in backing store, do forward
 static void swap_move_up(struct pool_item *item, int new_limit) {
   int limit = item->limit;
-  int size = limit - item->base;
-
-  int base = ~limit;
-  int new_base = ~new_limit;
+  int neg_size = item->base - limit;
   printf(
     "swap_move_up [%d,%d) to [%d,%d)\n",
-    base,
-    base + size,
-    new_base,
-    new_base + size
+    limit + neg_size,
+    limit,
+    new_limit + neg_size,
+    new_limit
   );
-  assert(new_base <= base || new_base >= base + size);
-  for (int i = 0; i < size; ++i) {
+  assert(new_limit >= limit || new_limit <= limit + neg_size);
+  for (int i = -1; i >= neg_size; --i) {
 #ifdef INDIRECT_SWAP
-    swap_table_mem[new_base + i] = swap_table_mem[base + i];
-    swap_table_mem[base + i] = 0x55555555;
+    swap_table_mem[new_limit + i] = swap_table_mem[limit + i];
+    swap_table_mem[limit + i] = 0x55555555;
 #else
     memcpy(
-      swap_block_mem + (new_base + i) * BLOCK_SIZE,
-      swap_block_mem + (base + i) * BLOCK_SIZE,
+      swap_block_mem + (new_limit + i) * BLOCK_SIZE,
+      swap_block_mem + (limit + i) * BLOCK_SIZE,
       BLOCK_SIZE
     );
     memset(
-      swap_block_mem + (base + i) * BLOCK_SIZE,
+      swap_block_mem + (limit + i) * BLOCK_SIZE,
       0xaa,
       BLOCK_SIZE
     );
@@ -101,12 +91,12 @@ void swap_init(int n_blocks)
 {
   pool_init(
     &swap_table,
+    0,
 #ifdef INDIRECT_SWAP
-    ~table_size,
+    table_size,
 #else
-    ~n_blocks,
+    n_blocks,
 #endif
-    -1,
     swap_move,
 #ifdef MOVEABLE_SWAP
     swap_move_up
@@ -173,7 +163,6 @@ bool swap_block_alloc(int *table, int size) {
     for (k = 0; (c & 1) == 0; ++k)
       c >>= 1;
     swap_block_bitmap[j] &= ~bits[k];
-    assert(table[i] == 0x55555555);
     swap_block_next = (j << 3) | k;
 
     assert(table[i] == 0x55555555);
@@ -205,10 +194,53 @@ void swap_block_free(int *table, int size) {
 }
 #endif
 
-// swap address complemented wrt. pool and native wrt. backing store
+#if 0 // not needed as always done in core before copying to swap
+void swap_hash_init(int process, int swap_base, int base, int limit) {
+  for (int i = base; i < limit; ++i) {
+#ifdef INDIRECT_SWAP
+    int swap_block = swap_table_mem[swap_base + i];
+#else
+    int swap_block = swap_base + i;
+#endif
+    for (int j = 0; j < BLOCK_SIZE; ++j) {
+      long long hash = process * 17 + i * 29 + j * 37;
+      hash = (hash & 0xffffffffLL) + (hash >> 32);
+      hash = (hash & 0xffffLL) + (hash >> 16);
+      hash = (hash & 0xffLL) + (hash >> 8);
+      hash = (hash & 0xffLL) + (hash >> 8);
+      rassert(swap_block_mem[swap_block * BLOCK_SIZE + j] == 0xaa);
+      swap_block_mem[swap_block * BLOCK_SIZE + j] = (uint8_t)hash;
+    }
+  }
+}
+#endif
+
+void swap_hash_verify(int process, int swap_base, int base, int limit) {
+  for (int i = base; i < limit; ++i) {
+#ifdef INDIRECT_SWAP
+    int swap_block = swap_table_mem[swap_base + i];
+#else
+    int swap_block = swap_base + i;
+#endif
+    for (int j = 0; j < BLOCK_SIZE; ++j) {
+      long long hash = process * 17 + i * 29 + j * 37;
+      hash = (hash & 0xffffffffLL) + (hash >> 32);
+      hash = (hash & 0xffffLL) + (hash >> 16);
+      hash = (hash & 0xffLL) + (hash >> 8);
+      hash = (hash & 0xffLL) + (hash >> 8);
+      rassert(swap_block_mem[swap_block * BLOCK_SIZE + j] == (uint8_t)hash);
+    }
+    memset(
+      swap_block_mem + swap_block * BLOCK_SIZE,
+      0xaa,
+      BLOCK_SIZE
+    );
+  }
+}
+
 void swap_read(int swap_base, int core_base, int size) {
  printf("swap_read swap [%d,%d) to core [%d,%d)\n", swap_base, swap_base + size, core_base, core_base + size);
-#ifdef INDIRECT_SWAP
+#if defined(INDIRECT_CORE) || defined(INDIRECT_SWAP)
  printf("blocks");
 #endif
   for (int i = 0; i < size; ++i) {
@@ -220,7 +252,11 @@ void swap_read(int swap_base, int core_base, int size) {
 #endif
 #ifdef INDIRECT_CORE
     int core_block = core_table_mem[core_base + i];
+#ifdef INDIRECT_SWAP
  printf(",%d", core_block);
+#else
+ printf(" %d", core_block);
+#endif
 #else
     int core_block = core_base + i;
 #endif
@@ -237,15 +273,14 @@ void swap_read(int swap_base, int core_base, int size) {
       BLOCK_SIZE
     );
   }
-#ifdef INDIRECT_SWAP
+#if defined(INDIRECT_CORE) || defined(INDIRECT_SWAP)
  printf("\n");
 #endif
 }
 
-// swap address complemented wrt. pool and native wrt. backing store
 void swap_write(int swap_base, int core_base, int size) {
  printf("swap_write core [%d,%d) to swap [%d,%d)\n", core_base, core_base + size, swap_base, swap_base + size);
-#ifdef INDIRECT_SWAP
+#if defined(INDIRECT_CORE) || defined(INDIRECT_SWAP)
  printf("blocks");
 #endif
   for (int i = 0; i < size; ++i) {
@@ -257,7 +292,11 @@ void swap_write(int swap_base, int core_base, int size) {
 #endif
 #ifdef INDIRECT_SWAP
     int swap_block = swap_table_mem[swap_base + i];
+#ifdef INDIRECT_CORE
  printf(",%d", swap_block);
+#else
+ printf(" %d", swap_block);
+#endif
 #else
     int swap_block = swap_base + i;
 #endif
@@ -274,36 +313,7 @@ void swap_write(int swap_base, int core_base, int size) {
       BLOCK_SIZE
     );
   }
-#ifdef INDIRECT_SWAP
+#if defined(INDIRECT_CORE) || defined(INDIRECT_SWAP)
  printf("\n");
 #endif
 }
-
-void swap_hash_verify(
-  int process,
-  int swap_base,
-  int base,
-  int limit,
-  int offset
-) {
-  for (int i = base; i < limit; ++i) {
-#ifdef INDIRECT_SWAP
-    int swap_block = swap_table_mem[swap_base + i];
-#else
-    int swap_block = swap_base + i;
-#endif
-    for (int j = 0; j < BLOCK_SIZE; ++j) {
-      long long hash = process * 17 + (i + offset) * 29 + j * 37;
-      hash = (hash & 0xffffffffLL) + (hash >> 32);
-      hash = (hash & 0xffffLL) + (hash >> 16);
-      hash = (hash & 0xffLL) + (hash >> 8);
-      hash = (hash & 0xffLL) + (hash >> 8);
-      rassert(swap_block_mem[swap_block * BLOCK_SIZE + j] == (uint8_t)hash);
-    }
-    memset(
-      swap_block_mem + swap_block * BLOCK_SIZE,
-      0xaa,
-      BLOCK_SIZE
-    );
-  }
-}
diff --git a/swap.h b/swap.h
index 9995041..384ad49 100644 (file)
--- a/swap.h
+++ b/swap.h
   pool_alloc_moveable(&swap_table, item, size)
 #define swap_table_realloc(item, size) \
   pool_realloc_moveable(&swap_table, item, size)
+#define swap_table_realloc_base(item, size) \
+  pool_realloc_base_moveable(&swap_table, item, size)
 #else
 #define swap_table_alloc(item, size) \
   pool_alloc(&swap_table, item, size)
 #define swap_table_realloc(item, size) \
   pool_realloc(&swap_table, item, size)
+#define swap_table_realloc_base(item, size) \
+  pool_realloc_base(&swap_table, item, size)
 #endif
 #define swap_table_free(item) pool_free(&swap_table, item)
 
@@ -46,14 +50,9 @@ void swap_block_free(int *blocks, int size);
 #else
 void swap_init(int n_table);
 #endif
+//void swap_hash_init(int process, int swap_base, int base, int limit);
+void swap_hash_verify(int process, int swap_base, int base, int limit);
 void swap_read(int swap_base, int core_base, int size);
 void swap_write(int swap_base, int core_base, int size);
-void swap_hash_verify(
-  int process,
-  int swap_base,
-  int base,
-  int limit,
-  int offset
-);
 
 #endif