| 194 | #endif |
| 195 | |
| 196 | Error BaseAssembler::embedConstPool(const Label& label, const ConstPool& pool) { |
| 197 | if (ASMJIT_UNLIKELY(!_code)) |
| 198 | return reportError(DebugUtils::errored(kErrorNotInitialized)); |
| 199 | |
| 200 | if (ASMJIT_UNLIKELY(!isLabelValid(label))) |
| 201 | return reportError(DebugUtils::errored(kErrorInvalidLabel)); |
| 202 | |
| 203 | ASMJIT_PROPAGATE(align(AlignMode::kData, uint32_t(pool.alignment()))); |
| 204 | ASMJIT_PROPAGATE(bind(label)); |
| 205 | |
| 206 | size_t size = pool.size(); |
| 207 | if (!size) |
| 208 | return kErrorOk; |
| 209 | |
| 210 | CodeWriter writer(this); |
| 211 | ASMJIT_PROPAGATE(writer.ensureSpace(this, size)); |
| 212 | |
| 213 | #ifndef ASMJIT_NO_LOGGING |
| 214 | uint8_t* data = writer.cursor(); |
| 215 | #endif |
| 216 | |
| 217 | pool.fill(writer.cursor()); |
| 218 | writer.advance(size); |
| 219 | writer.done(this); |
| 220 | |
| 221 | #ifndef ASMJIT_NO_LOGGING |
| 222 | if (_logger) { |
| 223 | uint32_t dataSizeLog2 = Support::min<uint32_t>(Support::ctz(pool.minItemSize()), 3); |
| 224 | uint32_t dataSize = 1 << dataSizeLog2; |
| 225 | |
| 226 | StringTmp<512> sb; |
| 227 | Formatter::formatData(sb, _logger->flags(), arch(), dataTypeIdBySize[dataSize], data, size >> dataSizeLog2); |
| 228 | sb.append('\n'); |
| 229 | _logger->log(sb); |
| 230 | } |
| 231 | #endif |
| 232 | |
| 233 | return kErrorOk; |
| 234 | } |
| 235 | |
| 236 | Error BaseAssembler::embedLabel(const Label& label, size_t dataSize) { |
| 237 | if (ASMJIT_UNLIKELY(!_code)) |
nothing calls this directly
no test coverage detected