Implemented mtree uninlining and splitting
This is the first step towards a working mtree, though raises more questions than it resolves.
This commit is contained in:
+18
-17
@@ -2245,7 +2245,7 @@ code = '''
|
||||
&alphas[0 % 26], 1) => 0;
|
||||
lfs_size_t n = 1;
|
||||
for (lfs_size_t i = 1; i < N; i++) {
|
||||
int err = lfsr_btree_split(&lfs, &btree, i-1, NULL, 0,
|
||||
int err = lfsr_btree_split(&lfs, &btree, i-1, LFSR_DATA_NULL,
|
||||
LFSR_TAG_INLINED, 1, &alphas[(i-1) % 26], 1,
|
||||
LFSR_TAG_INLINED, 1, &alphas[(i-0) % 26], 1);
|
||||
// ignore space issues
|
||||
@@ -2330,7 +2330,7 @@ code = '''
|
||||
lfs_size_t id = TEST_PRNG(&prng) % sim_size;
|
||||
|
||||
// split btree
|
||||
int err = lfsr_btree_split(&lfs, &btree, id, NULL, 0,
|
||||
int err = lfsr_btree_split(&lfs, &btree, id, LFSR_DATA_NULL,
|
||||
LFSR_TAG_INLINED, 1, &alphas[i % 26], 1,
|
||||
LFSR_TAG_INLINED, 1, &uppers[i % 26], 1);
|
||||
// ignore space issues
|
||||
@@ -2409,7 +2409,7 @@ code = '''
|
||||
&alphas[0 % 26], 1) => 0;
|
||||
lfs_size_t n = 1;
|
||||
for (lfs_size_t i = 1; i < N; i++) {
|
||||
int err = lfsr_btree_split(&lfs, &btree, (i-1)*W+W-1, NULL, 0,
|
||||
int err = lfsr_btree_split(&lfs, &btree, (i-1)*W+W-1, LFSR_DATA_NULL,
|
||||
LFSR_TAG_INLINED, W, &alphas[(i-1) % 26], 1,
|
||||
LFSR_TAG_INLINED, W, &alphas[(i-0) % 26], 1);
|
||||
// ignore space issues
|
||||
@@ -2508,7 +2508,7 @@ code = '''
|
||||
|
||||
// split btree
|
||||
int err = lfsr_btree_split(&lfs, &btree,
|
||||
weighted_id+sim_weights[id]-1, NULL, 0,
|
||||
weighted_id+sim_weights[id]-1, LFSR_DATA_NULL,
|
||||
LFSR_TAG_INLINED, weight1, &alphas[i % 26], 1,
|
||||
LFSR_TAG_INLINED, weight2, &uppers[i % 26], 1);
|
||||
// ignore space issues
|
||||
@@ -3027,7 +3027,7 @@ code = '''
|
||||
// create a two-entry tree
|
||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "0", 1) => 0;
|
||||
lfsr_btree_split(&lfs, &btree, 0, "aab", 3,
|
||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
||||
LFSR_TAG_INLINED, 1, "0", 1,
|
||||
LFSR_TAG_INLINED, 1, "1", 1) => 0;
|
||||
printf("btree: w%d 0x%x.%x\n",
|
||||
@@ -3084,10 +3084,10 @@ code = '''
|
||||
// create a two-entry tree
|
||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "0", 1) => 0;
|
||||
lfsr_btree_split(&lfs, &btree, 0, "aab", 3,
|
||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
||||
LFSR_TAG_INLINED, 1, "0", 1,
|
||||
LFSR_TAG_INLINED, 1, "1", 1) => 0;
|
||||
lfsr_btree_split(&lfs, &btree, 1, "aac", 3,
|
||||
lfsr_btree_split(&lfs, &btree, 1, LFSR_DATA_BUF("aac", 3),
|
||||
LFSR_TAG_INLINED, 1, "1", 1,
|
||||
LFSR_TAG_INLINED, 1, "2", 1) => 0;
|
||||
printf("btree: w%d 0x%x.%x\n",
|
||||
@@ -3152,10 +3152,10 @@ code = '''
|
||||
// create a two-entry tree
|
||||
lfsr_btree_t btree = LFSR_BTREE_NULL;
|
||||
lfsr_btree_push(&lfs, &btree, 0, LFSR_TAG_INLINED, 1, "0", 1) => 0;
|
||||
lfsr_btree_split(&lfs, &btree, 0, "aac", 3,
|
||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aac", 3),
|
||||
LFSR_TAG_INLINED, 1, "1", 1,
|
||||
LFSR_TAG_INLINED, 1, "2", 1) => 0;
|
||||
lfsr_btree_split(&lfs, &btree, 0, "aab", 3,
|
||||
lfsr_btree_split(&lfs, &btree, 0, LFSR_DATA_BUF("aab", 3),
|
||||
LFSR_TAG_INLINED, 1, "0", 1,
|
||||
LFSR_TAG_INLINED, 1, "1", 1) => 0;
|
||||
printf("btree: w%d 0x%x.%x\n",
|
||||
@@ -3229,7 +3229,7 @@ code = '''
|
||||
char name[3] = {
|
||||
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
||||
};
|
||||
int err = lfsr_btree_split(&lfs, &btree, i-1, name, 3,
|
||||
int err = lfsr_btree_split(&lfs, &btree, i-1, LFSR_DATA_BUF(name, 3),
|
||||
LFSR_TAG_INLINED, 1, &nums[(i-1) % 10], 1,
|
||||
LFSR_TAG_INLINED, 1, &nums[(i-0) % 10], 1);
|
||||
// ignore space issues
|
||||
@@ -3331,7 +3331,7 @@ code = '''
|
||||
}
|
||||
|
||||
// split btree
|
||||
int err = lfsr_btree_split(&lfs, &btree, id, name, 3,
|
||||
int err = lfsr_btree_split(&lfs, &btree, id, LFSR_DATA_BUF(name, 3),
|
||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1,
|
||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1);
|
||||
// ignore space issues
|
||||
@@ -3414,7 +3414,8 @@ code = '''
|
||||
char name[3] = {
|
||||
alphas[(i/26/26) % 26], alphas[(i/26) % 26], alphas[i % 26]
|
||||
};
|
||||
int err = lfsr_btree_split(&lfs, &btree, (i-1)*W+W-1, name, 3,
|
||||
int err = lfsr_btree_split(&lfs, &btree,
|
||||
(i-1)*W+W-1, LFSR_DATA_BUF(name, 3),
|
||||
LFSR_TAG_INLINED, W, &nums[(i-1) % 10], 1,
|
||||
LFSR_TAG_INLINED, W, &nums[(i-0) % 10], 1);
|
||||
// ignore space issues
|
||||
@@ -3530,7 +3531,7 @@ code = '''
|
||||
|
||||
// split btree
|
||||
int err = lfsr_btree_split(&lfs, &btree,
|
||||
weighted_id+sim_weights[id]-1, name, 3,
|
||||
weighted_id+sim_weights[id]-1, LFSR_DATA_BUF(name, 3),
|
||||
LFSR_TAG_INLINED, weight1, &nums[i % 10], 1,
|
||||
LFSR_TAG_INLINED, weight2, &nums[i % 10], 1);
|
||||
// ignore space issues
|
||||
@@ -3693,7 +3694,7 @@ code = '''
|
||||
lfsr_data_read(&lfs, split_data, 0, split_buf, 4) => 1;
|
||||
if (split_id > id) {
|
||||
int err = lfsr_btree_split(&lfs, &btree,
|
||||
split_id, sim_names[id+1], 3,
|
||||
split_id, LFSR_DATA_BUF(sim_names[id+1], 3),
|
||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1,
|
||||
LFSR_TAG_INLINED, 1, split_buf, 1);
|
||||
// ignore space issues
|
||||
@@ -3703,7 +3704,7 @@ code = '''
|
||||
assert(err == 0);
|
||||
} else {
|
||||
int err = lfsr_btree_split(&lfs, &btree,
|
||||
split_id, name, 3,
|
||||
split_id, LFSR_DATA_BUF(name, 3),
|
||||
LFSR_TAG_INLINED, 1, split_buf, 1,
|
||||
LFSR_TAG_INLINED, 1, &nums[i % 10], 1);
|
||||
// ignore space issues
|
||||
@@ -3893,7 +3894,7 @@ code = '''
|
||||
lfsr_data_read(&lfs, split_data, 0, split_buf, 4) => 1;
|
||||
if (split_id > weighted_id+sim_weights[id]-1) {
|
||||
int err = lfsr_btree_split(&lfs, &btree,
|
||||
split_id, sim_names[id+1], 3,
|
||||
split_id, LFSR_DATA_BUF(sim_names[id+1], 3),
|
||||
LFSR_TAG_INLINED, weight, &nums[i % 10], 1,
|
||||
LFSR_TAG_INLINED, split_weight, split_buf, 1);
|
||||
// ignore space issues
|
||||
@@ -3903,7 +3904,7 @@ code = '''
|
||||
assert(err == 0);
|
||||
} else {
|
||||
int err = lfsr_btree_split(&lfs, &btree,
|
||||
split_id, name, 3,
|
||||
split_id, LFSR_DATA_BUF(name, 3),
|
||||
LFSR_TAG_INLINED, split_weight, split_buf, 1,
|
||||
LFSR_TAG_INLINED, weight, &nums[i % 10], 1);
|
||||
// ignore space issues
|
||||
|
||||
Reference in New Issue
Block a user