114 {
115 auto& [code,
socket] = *current_compile_it;
116 socket.async_wait(local::datagram_protocol::socket::wait_read, [
this, current_compile_it](
auto ec) {
117
118 auto& [code,
socket] = *current_compile_it;
120
121 wasm_compilation_result_message reply{code, compilation_result_unknownfailure{}, _allocator->get_free_memory()};
122
123 void* code_ptr = nullptr;
124 void* mem_ptr = nullptr;
125 try {
126 if(success && std::holds_alternative<code_compilation_result_message>(message) && fds.size() == 2) {
127 code_compilation_result_message& result = std::get<code_compilation_result_message>(message);
128 code_ptr = _allocator->allocate(get_size_of_fd(fds[0]));
129 mem_ptr = _allocator->allocate(get_size_of_fd(fds[1]));
130
131 if(code_ptr == nullptr || mem_ptr == nullptr) {
132 _allocator->deallocate(code_ptr);
133 _allocator->deallocate(mem_ptr);
134 reply.result = compilation_result_toofull();
135 }
136 else {
137 copy_memfd_contents_to_pointer(code_ptr, fds[0]);
138 copy_memfd_contents_to_pointer(mem_ptr, fds[1]);
139
140 reply.result = code_descriptor {
141 code.code_id,
142 code.vm_version,
143 current_codegen_version,
145 result.start,
146 result.apply_offset,
147 result.starting_memory_pages,
149 (unsigned)get_size_of_fd(fds[1]),
150 result.initdata_prologue_size
151 };
152 }
153 }
154 }
155 catch(...) {
156 _allocator->deallocate(code_ptr);
157 _allocator->deallocate(mem_ptr);
158 }
159
161
162
163 _ctx.post([this, current_compile_it]() {
164 current_compiles.erase(current_compile_it);
165 });
166 });
167
168 }
std::tuple< bool, eosvmoc_message, std::vector< wrapped_fd > > read_message_with_fds(boost::asio::local::datagram_protocol::socket &s)
_W64 unsigned int uintptr_t