mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 23:06:32 +00:00
35 lines
724 B
C++
35 lines
724 B
C++
#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,
|
|
.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 {};
|
|
}
|
|
}
|