@@ -13,7 +13,7 @@
|
||||
|
||||
namespace furvm {
|
||||
|
||||
void executor::push_frame(const mod_p& mod, function_handle function) {
|
||||
void executor::push_frame(const mod_p& mod, function_id function) {
|
||||
const auto& func = mod->function_at(function);
|
||||
if (func->type() != function_t::Normal) throw std::runtime_error("unexpected function type");
|
||||
m_frames.emplace((struct executor::frame){ mod, func->position(), m_stack.size() });
|
||||
@@ -168,9 +168,9 @@ void executor::step() {
|
||||
store_thing(variable, std::move(pop_thing()));
|
||||
} break;
|
||||
case instruction_t::Call: {
|
||||
function_handle funcId = static_cast<std::uint16_t>(frame.mod->byte(frame.position)) |
|
||||
(static_cast<std::uint16_t>(frame.mod->byte(frame.position + 1)) << 8);
|
||||
frame.position += 2;
|
||||
function_id funcId = static_cast<std::uint16_t>(frame.mod->byte(frame.position)) |
|
||||
(static_cast<std::uint16_t>(frame.mod->byte(frame.position + 1)) << 8);
|
||||
frame.position += 2;
|
||||
|
||||
const function_p& function = frame.mod->function_at(funcId);
|
||||
switch (function->type()) {
|
||||
|
||||
@@ -75,7 +75,7 @@ bool serializer::serialize_module(std::ostream& os, const mod_p& mod) {
|
||||
write_u32(os, VERSION);
|
||||
|
||||
write_u32(os, mod->m_functions.size());
|
||||
for (function_handle id = 0; id < static_cast<function_handle>(mod->m_functions.size()); ++id) {
|
||||
for (function_id id = 0; id < static_cast<function_id>(mod->m_functions.size()); ++id) {
|
||||
const auto& func = mod->m_functions[id];
|
||||
write_u16(os, id);
|
||||
write_u8(os, static_cast<std::uint8_t>(func->type()));
|
||||
|
||||
+2
-2
@@ -201,13 +201,13 @@ thing_p operator>=(const thing_p& lhs, const thing_p& rhs) {
|
||||
}
|
||||
|
||||
thing_p thing::clone(const thing_p& thing) {
|
||||
thing_handle id = thing->m_context->m_things.size();
|
||||
thing_id id = thing->m_context->m_things.size();
|
||||
if (!thing->m_context->m_deadThings.empty()) {
|
||||
id = thing->m_context->m_deadThings.front();
|
||||
thing->m_context->m_deadThings.pop();
|
||||
id += 1 << GENERATION_SIZE;
|
||||
}
|
||||
thing_handle idx = id & ((1ULL << ((sizeof(id) * 8) - GENERATION_SIZE)) - 1);
|
||||
thing_id idx = id & ((1ULL << ((sizeof(id) * 8) - GENERATION_SIZE)) - 1);
|
||||
|
||||
auto th = std::make_shared<class thing>(thing->m_context, thing->m_type);
|
||||
switch (thing->m_type) {
|
||||
|
||||
Reference in New Issue
Block a user