aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/vm/VirtualMachine.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/vm/VirtualMachine.hpp')
-rw-r--r--src/openvic-simulation/vm/VirtualMachine.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/openvic-simulation/vm/VirtualMachine.hpp b/src/openvic-simulation/vm/VirtualMachine.hpp
index 4398f91..b92fb6c 100644
--- a/src/openvic-simulation/vm/VirtualMachine.hpp
+++ b/src/openvic-simulation/vm/VirtualMachine.hpp
@@ -1,7 +1,11 @@
#pragma once
+#include <vector>
+
+#include "InstanceManager.hpp"
#include "RuntimeProcess.hpp"
#include "Utility.hpp"
+#include "vm/Builtin.hpp"
#include <lauf/vm.h>
namespace OpenVic::Vm {
@@ -23,4 +27,24 @@ namespace OpenVic::Vm {
return RuntimeProcess(lauf_vm_start_process(*this, program));
}
};
+
+ struct OpenVicVirtualMachine : VirtualMachine {
+ using VirtualMachine::VirtualMachine;
+ using VirtualMachine::operator=;
+
+ OpenVicVirtualMachine(
+ InstanceManager* instance_manager, std::vector<Asm::scope_variant>&& scope_references,
+ lauf_vm_options options = lauf_default_vm_options
+ )
+ : VirtualMachine([&] {
+ options.user_data = &user_data;
+ return options;
+ }()) {
+ user_data.scope_references = std::move(scope_references);
+ user_data.instance_manager = instance_manager;
+ }
+
+ private:
+ VmUserData user_data;
+ };
}