cleanup
parent
95460e7bf1
commit
ec8153bef0
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
project(blt-gp VERSION 0.1.20)
|
||||
project(blt-gp VERSION 0.1.21)
|
||||
|
||||
include(CTest)
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ int main()
|
|||
// BLT_TRACE("Allocated: %ld", h);
|
||||
// BLT_TRACE("Deallocated: %ld", u);
|
||||
// BLT_TRACE("Ratio: %lf Difference: %ld", static_cast<double>(h) / static_cast<double>(u), std::abs(h - u));
|
||||
// BLT_TRACE("Total Allocated Bytes: %ld", blt::gp::hello_bytes.load());
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -44,6 +44,7 @@ namespace blt::gp
|
|||
}
|
||||
|
||||
// inline std::atomic_uint64_t hello = 0;
|
||||
// inline std::atomic_uint64_t hello_bytes = 0;
|
||||
// inline std::atomic_uint64_t unhello = 0;
|
||||
|
||||
class aligned_allocator
|
||||
|
@ -52,12 +53,16 @@ namespace blt::gp
|
|||
void* allocate(blt::size_t bytes) // NOLINT
|
||||
{
|
||||
// hello.fetch_add(1, std::memory_order_relaxed);
|
||||
// hello_bytes += bytes;
|
||||
// BLT_TRACE("Allocating %ld bytes", bytes);
|
||||
return std::aligned_alloc(8, bytes);
|
||||
}
|
||||
|
||||
void deallocate(void* ptr, blt::size_t) // NOLINT
|
||||
{
|
||||
// if (ptr == nullptr && bytes != 0) {
|
||||
// BLT_ABORT(("Nullptr called with non zero bytes! " + std::to_string(bytes)).c_str());
|
||||
// }
|
||||
// if (ptr == nullptr)
|
||||
// return;
|
||||
// unhello.fetch_add(1, std::memory_order_relaxed);
|
||||
|
@ -116,7 +121,7 @@ namespace blt::gp
|
|||
}
|
||||
|
||||
stack_allocator(stack_allocator&& move) noexcept:
|
||||
data_(std::exchange(move.data_, nullptr)), bytes_stored(move.bytes_stored), size_(move.size_)
|
||||
data_(std::exchange(move.data_, nullptr)), bytes_stored(std::exchange(move.bytes_stored, 0)), size_(std::exchange(move.size_, 0))
|
||||
{}
|
||||
|
||||
stack_allocator& operator=(const stack_allocator& copy) = delete;
|
||||
|
|
30
src/tree.cpp
30
src/tree.cpp
|
@ -247,22 +247,20 @@ namespace blt::gp
|
|||
blt::size_t total_produced = 0;
|
||||
blt::size_t total_consumed = 0;
|
||||
|
||||
// for (const auto& operation : blt::reverse_iterate(operations.begin(), operations.end()))
|
||||
// {
|
||||
// if (operation.is_value)
|
||||
// {
|
||||
// value_stack.transfer_bytes(values_process, operation.type_size);
|
||||
// total_produced += stack_allocator::aligned_size(operation.type_size);
|
||||
// bitfield.push_back(false);
|
||||
// continue;
|
||||
// }
|
||||
// auto& info = program.get_operator_info(operation.id);
|
||||
// for (auto& arg : info.argument_types)
|
||||
// total_consumed += stack_allocator::aligned_size(program.get_typesystem().get_type(arg).size());
|
||||
// operation.func(context, values_process, values_process, &bitfield);
|
||||
// bitfield.push_back(true);
|
||||
// total_produced += stack_allocator::aligned_size(program.get_typesystem().get_type(info.return_type).size());
|
||||
// }
|
||||
for (const auto& operation : blt::reverse_iterate(operations.begin(), operations.end()))
|
||||
{
|
||||
if (operation.is_value)
|
||||
{
|
||||
value_stack.transfer_bytes(values_process, operation.type_size);
|
||||
total_produced += stack_allocator::aligned_size(operation.type_size);
|
||||
continue;
|
||||
}
|
||||
auto& info = program.get_operator_info(operation.id);
|
||||
for (auto& arg : info.argument_types)
|
||||
total_consumed += stack_allocator::aligned_size(program.get_typesystem().get_type(arg).size());
|
||||
program.get_operator_info(operation.id).func(context, values_process, values_process);
|
||||
total_produced += stack_allocator::aligned_size(program.get_typesystem().get_type(info.return_type).size());
|
||||
}
|
||||
|
||||
auto v1 = results.values.bytes_in_head();
|
||||
auto v2 = static_cast<blt::ptrdiff_t>(stack_allocator::aligned_size(operations.front().type_size));
|
||||
|
|
Loading…
Reference in New Issue