make sure stack is empty after call
parent
a04642237e
commit
b314a62c5a
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
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_ADDRSAN "Enable the address sanitizer" OFF)
|
||||||
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
option(ENABLE_UBSAN "Enable the ub sanitizer" OFF)
|
||||||
|
|
|
@ -371,6 +371,8 @@ int main()
|
||||||
blt::gp::operation<float, float, int, bool> silly_op(nyah);
|
blt::gp::operation<float, float, int, bool> silly_op(nyah);
|
||||||
|
|
||||||
std::cout << silly_op(alloc) << std::endl;
|
std::cout << silly_op(alloc) << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Is empty? " << alloc.empty() << std::endl;
|
||||||
|
|
||||||
// std::cout << std::endl;
|
// std::cout << std::endl;
|
||||||
//
|
//
|
||||||
|
|
|
@ -115,8 +115,7 @@ namespace blt::gp
|
||||||
template<typename CurrentArgument, blt::u64 index>
|
template<typename CurrentArgument, blt::u64 index>
|
||||||
inline CurrentArgument& getArgument(stack_allocator& allocator) const
|
inline CurrentArgument& getArgument(stack_allocator& allocator) const
|
||||||
{
|
{
|
||||||
auto bytes = getByteOffset<index>();
|
return allocator.from<CurrentArgument>(getByteOffset<index>());
|
||||||
return allocator.from<CurrentArgument>(bytes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<blt::u64... indices>
|
template<blt::u64... indices>
|
||||||
|
@ -128,7 +127,10 @@ namespace blt::gp
|
||||||
[[nodiscard]] inline Return operator()(stack_allocator& allocator) const
|
[[nodiscard]] inline Return operator()(stack_allocator& allocator) const
|
||||||
{
|
{
|
||||||
auto seq = std::make_integer_sequence<blt::u64, sizeof...(Args)>();
|
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:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue