make sure stack is empty after call

thread
Brett 2024-06-06 02:32:19 -04:00
parent a04642237e
commit b314a62c5a
3 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25)
project(blt-gp VERSION 0.0.16)
project(blt-gp VERSION 0.0.17)
option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)

View File

@ -372,6 +372,8 @@ int main()
std::cout << silly_op(alloc) << std::endl;
std::cout << "Is empty? " << alloc.empty() << std::endl;
// std::cout << std::endl;
//
// //auto* pointer = static_cast<void*>(head->metadata.offset);

View File

@ -115,8 +115,7 @@ namespace blt::gp
template<typename CurrentArgument, blt::u64 index>
inline CurrentArgument& getArgument(stack_allocator& allocator) const
{
auto bytes = getByteOffset<index>();
return allocator.from<CurrentArgument>(bytes);
return allocator.from<CurrentArgument>(getByteOffset<index>());
}
template<blt::u64... indices>
@ -128,7 +127,10 @@ namespace blt::gp
[[nodiscard]] inline Return operator()(stack_allocator& allocator) const
{
auto seq = std::make_integer_sequence<blt::u64, sizeof...(Args)>();
return sequence_to_indices(allocator, seq);
Return ret = sequence_to_indices(allocator, seq);
constexpr auto total_bytes = (stack_allocator::aligned_size<Args>() + ...);
allocator.pop_bytes(total_bytes);
return ret;
}
private: