7#include "plugify/global.h"
8#include "plugify/mem_addr.hpp"
9#include "plugify/method.hpp"
10#include "plugify/property.hpp"
11#include "plugify/signarure.hpp"
12#include "plugify/value_type.hpp"
13#include "plg/inplace_vector.hpp"
129 std::string_view GetError() noexcept;
148 PLUGIFY_ACCESS : struct Impl;
149 PLUGIFY_NO_DLL_EXPORT_WARNING(std::unique_ptr<Impl> _impl;)
155 template <typename T>
156 concept
SlotStorable = std::is_trivially_copyable_v<T> && sizeof(T) <= sizeof(uint64_t);
168 using slot_type = uint64_t;
186 template <
typename T>
188 T
Get(
size_t index)
const noexcept {
189 assert(index < _count &&
"Index out of bounds");
191 std::memcpy(&result, &_data[index],
sizeof(T));
201 template <
typename T>
203 void Set(
size_t index,
const T& value)
noexcept {
204 assert(index < _count &&
"Index out of bounds");
205 std::memcpy(&_data[index], &value,
sizeof(T));
210 [[maybe_unused]]
size_t _count;
240 template <
typename T>
241 requires std::is_trivially_copyable_v<T>
242 void Set(
const T& value)
noexcept {
243 assert(
sizeof(T) <= _size &&
"Return value too large");
244 std::memcpy(_data, &value,
sizeof(T));
252 template <
typename T>
253 requires std::is_trivially_copyable_v<T>
255 assert(
sizeof(T) <= _size &&
"Return type too large");
257 std::memcpy(&result, _data,
sizeof(T));
267 template <
typename T,
typename... Args>
269 void Construct(Args&&... args)
noexcept(
noexcept(T(std::forward<Args>(args)...))) {
270 assert(
sizeof(T) <= _size &&
"Type too large");
271 std::construct_at(
reinterpret_cast<T*
>(_data), std::forward<Args>(args)...);
276 [[maybe_unused]]
size_t _size;
Class to create callback objects, that can be passed to functions as callback function pointers....
MemAddr GetFunction() const noexcept
Get a dynamically created function.
MemAddr GetJitFunc(const Method &method, CallbackHandler callback, MemAddr data=nullptr, HiddenParam hidden=&ValueUtils::IsHiddenParam)
Generates a callback function matching the specified method signature.
MemAddr GetJitFunc(const Signature &signature, const Method *method, CallbackHandler callback, MemAddr data, bool hidden)
Generates a JIT-compiled callback function based on the provided raw signature.
JitCallback()
Constructor.
~JitCallback()
Destructor.
JitCallback(JitCallback &&other) noexcept
Move constructor.
JitCallback(const JitCallback &other)=delete
Copy constructor.
void(*)(const Method *method, MemAddr data, uint64_t *params, size_t count, void *ret) CallbackHandler
CallbackHandler is a function pointer type for generic callback invocation. The params argument can b...
bool(*)(ValueType) HiddenParam
HiddenParam is a predicate function pointer to determine if a ValueType should be passed as a hidden ...
A wrapper class for memory addresses, providing utility functions for pointer manipulation.
Provides a storage area for return values in JIT/ABI contexts.
ReturnSlot(type *data, size_t size) noexcept
Construct from byte storage.
T Get() const noexcept
Get the return value.
void Set(const T &value) noexcept
Set the return value.
void Construct(Args &&... args) noexcept(noexcept(T(std::forward< Args >(args)...)))
Construct an object in-place.
Concept for types that can be stored directly in a register slot.
Replacement for asmjit::FuncSignature using ValueType.