Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::vm::fixed_stack_allocator< T > Class Template Reference

#include <allocator.hpp>

Public Member Functions

template<typename U >
void free ()
 
 fixed_stack_allocator (size_t max_size)
 
Tget_base_ptr () const
 
template<typename U >
void free ()
 
 fixed_stack_allocator (size_t max_size)
 
Tget_base_ptr () const
 

Detailed Description

template<typename T>
class sysio::vm::fixed_stack_allocator< T >

Definition at line 391 of file allocator.hpp.

Constructor & Destructor Documentation

◆ fixed_stack_allocator() [1/2]

template<typename T >
sysio::vm::fixed_stack_allocator< T >::fixed_stack_allocator ( size_t max_size)
inline

Definition at line 401 of file allocator.hpp.

401 : max_size(max_size) {
402 raw = (T*)mmap(NULL, max_memory, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
403 SYS_VM_ASSERT( raw != MAP_FAILED, wasm_bad_alloc, "mmap failed to alloca pages" );
404 mprotect(raw, max_size * sizeof(T), PROT_READ | PROT_WRITE);
405 }
#define T(meth, val, expected)
#define SYS_VM_ASSERT(expr, exc_type, msg)
Definition exceptions.hpp:8

◆ fixed_stack_allocator() [2/2]

template<typename T >
sysio::vm::fixed_stack_allocator< T >::fixed_stack_allocator ( size_t max_size)
inline

Definition at line 401 of file allocator.hpp.

401 : max_size(max_size) {
402 raw = (T*)mmap(NULL, max_memory, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
403 SYS_VM_ASSERT( raw != MAP_FAILED, wasm_bad_alloc, "mmap failed to alloca pages" );
404 mprotect(raw, max_size * sizeof(T), PROT_READ | PROT_WRITE);
405 }

Member Function Documentation

◆ free() [1/2]

template<typename T >
template<typename U >
void sysio::vm::fixed_stack_allocator< T >::free ( )
inline

Definition at line 398 of file allocator.hpp.

398 {
399 munmap(raw, max_memory);
400 }

◆ free() [2/2]

template<typename T >
template<typename U >
void sysio::vm::fixed_stack_allocator< T >::free ( )
inline

Definition at line 398 of file allocator.hpp.

398 {
399 munmap(raw, max_memory);
400 }

◆ get_base_ptr() [1/2]

template<typename T >
T * sysio::vm::fixed_stack_allocator< T >::get_base_ptr ( ) const
inline

Definition at line 406 of file allocator.hpp.

406{ return raw; }

◆ get_base_ptr() [2/2]

template<typename T >
T * sysio::vm::fixed_stack_allocator< T >::get_base_ptr ( ) const
inline

Definition at line 406 of file allocator.hpp.

406{ return raw; }

The documentation for this class was generated from the following files: