slige/runtime/vm_provider.cpp

35 lines
724 B
C++
Raw Normal View History

#include "vm_provider.hpp"
#include "vm.hpp"
using namespace sliger::rpc::vm_provider;
auto VmProvider::load_and_run(std::vector<uint32_t> instructions) -> void
{
auto vm = VM(instructions,
{
.flame_graph = true,
.code_coverage = true,
2024-12-12 10:17:09 +01:00
.print_stack_debug = false,
});
vm.run_until_done();
this->vm = vm;
}
auto VmProvider::flame_graph_json() -> std::optional<std::string>
{
if (this->vm) {
return this->vm->flame_graph_json();
} else {
return {};
}
}
auto VmProvider::code_coverage_json() -> std::optional<std::string>
{
if (this->vm) {
return this->vm->code_coverage_json();
} else {
return {};
}
}