blob: be183e6ec727774390427d610878659e5783deba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#pragma once
#include "vm/RuntimeFiber.hpp"
#include "vm/Stacktrace.hpp"
#include <lauf/runtime/memory.h>
#include <lauf/runtime/process.h>
#include <lauf/runtime/stacktrace.h>
namespace OpenVic::Vm {
struct VirtualMachine;
struct RuntimeProcess {
RuntimeProcess(RuntimeProcess&&) = default;
RuntimeProcess& operator=(RuntimeProcess&&) = default;
RuntimeProcess(RuntimeProcess const&) = delete;
RuntimeProcess& operator=(RuntimeProcess const&) = delete;
~RuntimeProcess() {
lauf_runtime_destroy_process(_handle);
}
lauf_runtime_process* handle() {
return _handle;
}
const lauf_runtime_process* handle() const {
return _handle;
}
operator lauf_runtime_process*() {
return _handle;
}
operator const lauf_runtime_process*() const {
return _handle;
}
RuntimeFiber create_fiber(const lauf_asm_function* fn) {
return RuntimeFiber(this, lauf_runtime_create_fiber(*this, fn));
}
RuntimeFiberRef get_current_fiber() {
return lauf_runtime_get_current_fiber(_handle);
}
RuntimeFiberRef get_fiber_ptr(lauf_runtime_address addr) {
return lauf_runtime_get_fiber_ptr(_handle, addr);
}
private:
friend struct VirtualMachine;
RuntimeProcess(lauf_runtime_process* process) : _handle(process) {}
lauf_runtime_process* _handle;
};
}
|