void Store::getUnlocked(uint32_t id, char* block) const { if (fill_page_cache_) { fill_page_cache_ = false; // Touch each block to load it into the OS page cache. const auto num_blocks_mapped = mapped_.getNumBlocks(getBlockSize()); for (uint32_t i = 0; i != num_blocks_mapped; ++i) { std::memcpy(block, getAddressOf(i), getBlockSize()); } } std::memcpy(block, getAddressOf(id), getBlockSize()); }
LLValue *put(DValue *v) override { LLValue *address = getAddressOf(v); LLType *abiTy = getAbiType(v->getType()); assert(abiTy && "Why are we rewriting a non-rewritten type?"); return loadFromMemory(address, abiTy, ".X86_64_C_struct_rewrite_putResult"); }
const std::vector<unsigned char> getDataSerialization(T& data) { auto pData = reinterpret_cast<unsigned char*>(getAddressOf(data)); std::vector<unsigned char> result; result.resize(sizeof(T)); for (std::vector<unsigned char>::size_type i = 0; i < result.size(); i++) { result[i] = pData[i]; } return result; }
LLValue *put(DValue *v) override { return getAddressOf(v); }
LLValue* put(Type* dty, DValue* v) { assert(dty == v->getType()); return getAddressOf(v); }
LLValue* put(DValue* v) { return getAddressOf(v); }
void Store::replaceUnlocked(uint32_t id, const char* block) { MT_REQUIRE_NOT_NULL(block); std::memcpy(getAddressOf(id), block, getBlockSize()); }