King_DuckZ
eadd25b827
This commit breaks the ARM64 version, I will fix it next. Lots going on here. DynafuncMaker got updated to store strings to back the ModuleAndName objects that get hardcoded in the assembly glue function. ModuleAndName is not a typedef to a tuple anymore, because I discovered that tuples suck. They get always pushed on the stack when passed as parameter, instead the new implementation gets passed into 2 registers being it a standard layout type. dhandy::bt::string got updated so it can be used as a literal value for non-type template parameters, which allowed for a really easy to use `wren::MN<>` helper. Code now fully requires c++20.
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
/* Copyright 2020-2022, Michele Santullo
|
|
* This file is part of wrenpp.
|
|
*
|
|
* Wrenpp is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Wrenpp is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with wrenpp. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "wrenpp/detail/wren_types.hpp"
|
|
#include <vector>
|
|
#include <list>
|
|
#include <cstddef>
|
|
|
|
namespace wren {
|
|
class DynafuncMaker {
|
|
public:
|
|
DynafuncMaker();
|
|
~DynafuncMaker() noexcept;
|
|
|
|
void* make (VM* vm, foreign_method_t cb, const char* mod_name, const char* cls_name);
|
|
void clear() noexcept;
|
|
|
|
std::size_t total_memory() const;
|
|
|
|
private:
|
|
unsigned char* allocate_chunk();
|
|
|
|
std::list<std::vector<char>> m_string_params;
|
|
std::vector<void*> m_pages;
|
|
std::size_t m_page_size;
|
|
std::size_t m_used_bytes;
|
|
};
|
|
} //namespace wren
|