thread
Brett 2024-07-21 13:45:00 -04:00
parent f62494d7d8
commit 0ae2dd84e8
3 changed files with 15 additions and 8 deletions

View File

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

View File

@ -306,12 +306,12 @@ namespace blt::gp
if (empty())
throw std::runtime_error("This stack is empty!");
if (head->used_bytes_in_block() < static_cast<blt::ptrdiff_t>(bytes))
auto type_size = aligned_size(bytes);
if (head->used_bytes_in_block() < static_cast<blt::ptrdiff_t>(type_size))
BLT_ABORT(("This stack doesn't contain enough data for this type! " + std::to_string(head->used_bytes_in_block()) + " / " +
std::to_string(bytes) + " This is an invalid runtime state!").c_str());
auto type_size = aligned_size(bytes);
auto ptr = to.allocate_bytes(bytes);
auto ptr = to.allocate_bytes(type_size);
to.head->metadata.offset = static_cast<blt::u8*>(ptr) + type_size;
std::memcpy(ptr, head->metadata.offset - type_size, type_size);
head->metadata.offset -= type_size;

View File

@ -165,7 +165,14 @@ namespace blt::gp
stack_allocator after_stack;
transfer_backward(vals, after_stack, ops.end() - 1, end_p - 1);
for (auto it = ops.end() - 1; it != end_p - 1; it--)
{
if (it->is_value)
{
vals.transfer_bytes(after_stack, it->type_size);
//after_ops.push_back(*it);
}
}
for (auto it = end_p - 1; it != begin_p - 1; it--)
{
@ -184,10 +191,10 @@ namespace blt::gp
ops.insert(++before, new_ops.begin(), new_ops.end());
for (const auto& op : new_ops)
for (auto it = new_ops.end() - 1; it != new_ops.begin() - 1; it--)
{
if (op.is_value)
new_vals.transfer_bytes(vals, op.type_size);
if (it->is_value)
new_vals.transfer_bytes(vals, it->type_size);
}
auto new_end_point = point + new_ops.size();