fix the stupid stack issue

thread
Brett 2024-08-04 19:43:59 -04:00
parent 6eea15ae26
commit 3e698b86eb
2 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25)
project(blt-gp VERSION 0.0.113)
project(blt-gp VERSION 0.0.114)
include(CTest)

View File

@ -183,7 +183,8 @@ namespace blt::gp
auto begin_point = static_cast<blt::ptrdiff_t>(program.get_random().get_size_t(0ul, ops_r.size()));
auto end_point = find_endpoint(program, ops_r, begin_point);
const auto& type_info = program.get_operator_info(ops_r[begin_point].id);
auto begin_operator_id = ops_r[begin_point].id;
const auto& type_info = program.get_operator_info(begin_operator_id);
auto begin_itr = ops_r.begin() + begin_point;
auto end_itr = ops_r.begin() + end_point;
@ -194,6 +195,7 @@ namespace blt::gp
auto& new_vals_r = new_tree.get_values();
stack_allocator stack_after;
stack_allocator new_vals_flip; // this is annoying.
transfer_backward(vals_r, stack_after, ops_r.end() - 1, end_itr - 1);
for (auto it = end_itr - 1; it != begin_itr - 1; it--)
{
@ -201,7 +203,8 @@ namespace blt::gp
vals_r.pop_bytes(static_cast<blt::ptrdiff_t>(stack_allocator::aligned_size(it->type_size)));
}
transfer_backward(new_vals_r, vals_r, new_ops_r.end() - 1, new_ops_r.begin() - 1);
transfer_backward(new_vals_r, new_vals_flip, new_ops_r.end() - 1, new_ops_r.begin() - 1);
transfer_forward(new_vals_flip, vals_r, new_ops_r.begin(), new_ops_r.end());
transfer_forward(stack_after, vals_r, end_itr, ops_r.end());
auto before = begin_itr - 1;
@ -235,6 +238,7 @@ namespace blt::gp
std::cout << "This occurred at point " << begin_point << " ending at (old) " << end_point << "\n";
std::cout << "our root type is " << ops_r[begin_point].id << " with size " << stack_allocator::aligned_size(ops_r[begin_point].type_size) << "\n";
std::cout << "now Named: " << (program.get_name(ops_r[begin_point].id) ? *program.get_name(ops_r[begin_point].id) : "Unnamed") << "\n";
std::cout << "Was named: " << (program.get_name(begin_operator_id) ? *program.get_name(begin_operator_id) : "Unnamed") << "\n";
std::cout << "Parent:" << std::endl;
p.print(program, std::cout, false, true);
std::cout << "Child:" << std::endl;
@ -244,7 +248,6 @@ namespace blt::gp
std::cout << std::endl;
throw std::exception();
}
#endif
return c;