+15
-1
@@ -1,10 +1,24 @@
|
|||||||
#include "furvm/context.hpp"
|
#include "furvm/context.hpp"
|
||||||
|
|
||||||
#include "furvm/thing.hpp" // IWYU pragma: keep
|
#include "furvm/thing.hpp" // IWYU pragma: keep
|
||||||
|
#include "furvm/type.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace furvm {
|
namespace furvm {
|
||||||
|
|
||||||
context::context()
|
context::context()
|
||||||
: m_thingAllocator(m_thingArena) {}
|
: m_thingAllocator(m_thingArena) {
|
||||||
|
mod core;
|
||||||
|
core.emplace_type(std::make_shared<type>(byteType));
|
||||||
|
core.emplace_type(std::make_shared<type>(shortType));
|
||||||
|
core.emplace_type(std::make_shared<type>(intType));
|
||||||
|
core.emplace_type(std::make_shared<type>(longType));
|
||||||
|
static_assert(sizeof(std::uintptr_t) == 8, "Unsupported platform");
|
||||||
|
core.emplace_type(*core.type_at(3));
|
||||||
|
|
||||||
|
emplace("core", std::move(core)).dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace furvm
|
} // namespace furvm
|
||||||
|
|||||||
@@ -91,7 +91,8 @@ void executor::step() {
|
|||||||
switch (instr) {
|
switch (instr) {
|
||||||
case instruction_t::NoOperation: break;
|
case instruction_t::NoOperation: break;
|
||||||
case instruction_t::PushB2I: {
|
case instruction_t::PushB2I: {
|
||||||
push_thing({ intType, m_context, m_context->thing_alloc() })->get<int_t>() = frame.mod->byte(frame.position++);
|
push_thing({ *m_context->at("core")->type_at(2), m_context, m_context->thing_alloc() })->get<int_t>() =
|
||||||
|
frame.mod->byte(frame.position++);
|
||||||
} break;
|
} break;
|
||||||
case instruction_t::Drop: {
|
case instruction_t::Drop: {
|
||||||
pop_thing();
|
pop_thing();
|
||||||
|
|||||||
Reference in New Issue
Block a user