bfs: build fix.

I built only the bootloader for sparc when testing, so some code was
disabled because it's guarded by _BOOT_MODE.

Confirmed that the generated assembler is not larger than before (the
disassembly file is the same size, but for some reason functions were in
a different order, making it difficult to compare more closely)
This commit is contained in:
Adrien Destugues 2021-01-06 12:49:08 +01:00
parent 4758408a92
commit cba63b6451
2 changed files with 17 additions and 17 deletions

View File

@ -1157,7 +1157,7 @@ BPlusTree::_FindFreeDuplicateFragment(Transaction& transaction,
const bplustree_node* node, CachedNode& cached,
off_t* _offset, bplustree_node** _fragment, uint32* _index)
{
off_t* values = node->Values();
Unaligned<off_t>* values = node->Values();
for (int32 i = 0; i < node->NumKeys(); i++) {
off_t value = BFS_ENDIAN_TO_HOST_INT64(values[i]);
@ -1199,7 +1199,7 @@ BPlusTree::_InsertDuplicate(Transaction& transaction, CachedNode& cached,
const bplustree_node* node, uint16 index, off_t value)
{
CachedNode cachedDuplicate(this);
off_t* values = node->Values();
Unaligned<off_t>* values = node->Values();
off_t oldValue = BFS_ENDIAN_TO_HOST_INT64(values[index]);
status_t status;
off_t offset;
@ -1369,16 +1369,16 @@ BPlusTree::_InsertKey(bplustree_node* node, uint16 index, uint8* key,
if (index > node->NumKeys())
return;
off_t* values = node->Values();
uint16* keyLengths = node->KeyLengths();
Unaligned<off_t>* values = node->Values();
Unaligned<uint16>* keyLengths = node->KeyLengths();
uint8* keys = node->Keys();
node->all_key_count = HOST_ENDIAN_TO_BFS_INT16(node->NumKeys() + 1);
node->all_key_length = HOST_ENDIAN_TO_BFS_INT16(node->AllKeyLength()
+ keyLength);
off_t* newValues = node->Values();
uint16* newKeyLengths = node->KeyLengths();
Unaligned<off_t>* newValues = node->Values();
Unaligned<uint16>* newKeyLengths = node->KeyLengths();
// move values and copy new value into them
memmove(newValues + index + 1, values + index,
@ -1421,8 +1421,8 @@ BPlusTree::_SplitNode(bplustree_node* node, off_t nodeOffset,
if (*_keyIndex > node->NumKeys() + 1)
return B_BAD_VALUE;
uint16* inKeyLengths = node->KeyLengths();
off_t* inKeyValues = node->Values();
Unaligned<uint16>* inKeyLengths = node->KeyLengths();
Unaligned<off_t>* inKeyValues = node->Values();
uint8* inKeys = node->Keys();
uint8* outKeys = other->Keys();
int32 keyIndex = *_keyIndex; // can become less than zero!
@ -1484,8 +1484,8 @@ BPlusTree::_SplitNode(bplustree_node* node, off_t nodeOffset,
+ bytesAfter);
other->all_key_count = HOST_ENDIAN_TO_BFS_INT16(out);
uint16* outKeyLengths = other->KeyLengths();
off_t* outKeyValues = other->Values();
Unaligned<uint16>* outKeyLengths = other->KeyLengths();
Unaligned<off_t>* outKeyValues = other->Values();
int32 keys = out > keyIndex ? keyIndex : out;
if (bytesBefore) {
@ -1829,7 +1829,7 @@ BPlusTree::_RemoveDuplicate(Transaction& transaction,
const bplustree_node* node, CachedNode& cached, uint16 index,
off_t value)
{
off_t* values = node->Values();
Unaligned<off_t>* values = node->Values();
off_t oldValue = BFS_ENDIAN_TO_HOST_INT64(values[index]);
CachedNode cachedDuplicate(this);
@ -2040,7 +2040,7 @@ BPlusTree::_RemoveKey(bplustree_node* node, uint16 index)
return;
}
off_t* values = node->Values();
Unaligned<off_t>* values = node->Values();
// if we would have to drop the overflow link, drop
// the last key instead and update the overflow link
@ -2058,15 +2058,15 @@ BPlusTree::_RemoveKey(bplustree_node* node, uint16 index)
return;
}
uint16* keyLengths = node->KeyLengths();
Unaligned<uint16>* keyLengths = node->KeyLengths();
uint8* keys = node->Keys();
node->all_key_count = HOST_ENDIAN_TO_BFS_INT16(node->NumKeys() - 1);
node->all_key_length = HOST_ENDIAN_TO_BFS_INT64(
node->AllKeyLength() - length);
off_t* newValues = node->Values();
uint16* newKeyLengths = node->KeyLengths();
Unaligned<off_t>* newValues = node->Values();
Unaligned<uint16>* newKeyLengths = node->KeyLengths();
// move key data
memmove(key, key + length, node->AllKeyLength() - (key - keys));
@ -2357,7 +2357,7 @@ BPlusTree::_ValidateChildren(TreeCheck& check, uint32 level, off_t offset,
check.SetVisited(offset);
uint32 count = parent->NumKeys();
off_t* values = parent->Values();
Unaligned<off_t>* values = parent->Values();
off_t lastOffset = check.PreviousOffset(level);
CachedNode cached(this);

View File

@ -227,7 +227,7 @@ dump_bplustree_node(const bplustree_node* node, const bplustree_header* header,
memcpy(buffer, key, length);
buffer[length] = '\0';
off_t* value = node->Values() + i;
Unaligned<off_t>* value = node->Values() + i;
if ((addr_t)value < (addr_t)node
|| (addr_t)value > (addr_t)node + header->node_size)
kprintf(" %2d. Invalid Offset!!\n", (int)i);