// // Thread::loadState // void Thread::loadState(Serial &in) { std::size_t count, countFull; in.readSign(Signature::Thread); module = env->getModule(env->readModuleName(in)); codePtr = &module->codeV[ReadVLN<std::size_t>(in)]; scopeGbl = env->getGlobalScope(ReadVLN<Word>(in)); scopeHub = scopeGbl->getHubScope(ReadVLN<Word>(in)); scopeMap = scopeHub->getMapScope(ReadVLN<Word>(in)); scopeMod = scopeMap->getModuleScope(module); script = env->readScript(in); delay = ReadVLN<Word>(in); result = ReadVLN<Word>(in); count = ReadVLN<std::size_t>(in); callStk.clear(); callStk.reserve(count + CallStkSize); while(count--) callStk.push(readCallFrame(in)); count = ReadVLN<std::size_t>(in); dataStk.clear(); dataStk.reserve(count + DataStkSize); while(count--) dataStk.push(ReadVLN<Word>(in)); countFull = ReadVLN<std::size_t>(in); count = ReadVLN<std::size_t>(in); localArr.allocLoad(countFull, count); for(auto itr = localArr.beginFull(), end = localArr.end(); itr != end; ++itr) itr->loadState(in); countFull = ReadVLN<std::size_t>(in); count = ReadVLN<std::size_t>(in); localReg.allocLoad(countFull, count); for(auto itr = localReg.beginFull(), end = localReg.end(); itr != end; ++itr) *itr = ReadVLN<Word>(in); countFull = ReadVLN<std::size_t>(in); count = ReadVLN<std::size_t>(in); in.in->read(printBuf.getLoadBuf(countFull, count), countFull); state.state = static_cast<ThreadState::State>(ReadVLN<int>(in)); state.data = ReadVLN<Word>(in); state.type = ReadVLN<Word>(in); in.readSign(~Signature::Thread); }