mirror of
https://github.com/simple64/simple64.git
synced 2026-07-27 17:04:09 +02:00
34 lines
498 B
C++
34 lines
498 B
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <stdint.h>
|
|
|
|
namespace RSP
|
|
{
|
|
namespace JIT
|
|
{
|
|
class Allocator
|
|
{
|
|
public:
|
|
Allocator() = default;
|
|
~Allocator();
|
|
void operator=(const Allocator &) = delete;
|
|
Allocator(const Allocator &) = delete;
|
|
|
|
void *allocate_code(size_t size);
|
|
static bool commit_code(void *code, size_t size);
|
|
|
|
private:
|
|
struct Block
|
|
{
|
|
uint8_t *code = nullptr;
|
|
size_t size = 0;
|
|
size_t offset = 0;
|
|
};
|
|
std::vector<Block> blocks;
|
|
|
|
static Block reserve_block(size_t size);
|
|
};
|
|
}
|
|
}
|