Skip to content

Commit

Permalink
Add arena start(baseline) parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Aug 20, 2024
1 parent 8d0e4f5 commit 49551e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions include/bitcoin/system/arena.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ class arena
/// Non-linear allocator just returns next address.
/// Linear allocator resets to and returns buffer first address.
/// Detachable linear allocator allocates buffer returns its first address.
virtual void* start() THROWS = 0;
virtual void* start(size_t baseline) THROWS = 0;

/// Non-linear allocator just returns zero.
/// Linear allocator returns current allocation size.
/// Detachable linear allocator detaches allocation and returns its size.
virtual size_t detach() THROWS = 0;

/// Non-linear and linear allocator is a nop.
/// Detachable linear allocator frees the memory associated with ptr.
virtual void release(void* ptr) NOEXCEPT = 0;
/// Detachable linear allocator frees the memory associated with memory.
virtual void release(void* memory) NOEXCEPT = 0;

private:
virtual void* do_allocate(size_t bytes, size_t align) THROWS = 0;
Expand Down Expand Up @@ -93,9 +93,9 @@ class BC_API default_arena final
{
public:
static arena* get() NOEXCEPT;
void* start() THROWS override;
void* start(size_t baseline) THROWS override;
size_t detach() THROWS override;
void release(void* ptr) NOEXCEPT override;
void release(void* address) NOEXCEPT override;

private:
void* do_allocate(size_t bytes, size_t align) THROWS override;
Expand Down
2 changes: 1 addition & 1 deletion src/arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ bool default_arena::do_is_equal(const arena& other) const NOEXCEPT
return &other == this;
}

void* default_arena::start() THROWS
void* default_arena::start(size_t) THROWS
{
return nullptr;
}
Expand Down
4 changes: 2 additions & 2 deletions test/test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class reporting_arena
size_t dec_count{};
size_t dec_bytes{};

void* start() THROWS override
void* start(size_t) THROWS override
{
return nullptr;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ class mock_arena
size_t do_deallocate_align{};
mutable const arena* do_is_equal_address{};

void* start() THROWS override
void* start(size_t) THROWS override
{
return nullptr;
}
Expand Down

0 comments on commit 49551e1

Please sign in to comment.