MCPcopy Create free account
hub / github.com/Chemiculs/qengine / embedDataArray

Method embedDataArray

src/qengine/extern/asmjit/core/assembler.cpp:143–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143Error BaseAssembler::embedDataArray(TypeId typeId, const void* data, size_t itemCount, size_t repeatCount) {
144 uint32_t deabstractDelta = TypeUtils::deabstractDeltaOfSize(registerSize());
145 TypeId finalTypeId = TypeUtils::deabstract(typeId, deabstractDelta);
146
147 if (ASMJIT_UNLIKELY(!TypeUtils::isValid(finalTypeId)))
148 return reportError(DebugUtils::errored(kErrorInvalidArgument));
149
150 if (itemCount == 0 || repeatCount == 0)
151 return kErrorOk;
152
153 uint32_t typeSize = TypeUtils::sizeOf(finalTypeId);
154 Support::FastUInt8 of = 0;
155
156 size_t dataSize = Support::mulOverflow(itemCount, size_t(typeSize), &of);
157 size_t totalSize = Support::mulOverflow(dataSize, repeatCount, &of);
158
159 if (ASMJIT_UNLIKELY(of))
160 return reportError(DebugUtils::errored(kErrorOutOfMemory));
161
162 CodeWriter writer(this);
163 ASMJIT_PROPAGATE(writer.ensureSpace(this, totalSize));
164
165 for (size_t i = 0; i < repeatCount; i++)
166 writer.emitData(data, dataSize);
167
168 writer.done(this);
169
170#ifndef ASMJIT_NO_LOGGING
171 if (_logger) {
172 StringTmp<512> sb;
173 Formatter::formatData(sb, _logger->flags(), arch(), typeId, data, itemCount, repeatCount);
174 sb.append('\n');
175 _logger->log(sb);
176 }
177#endif
178
179 return kErrorOk;
180}
181
182#ifndef ASMJIT_NO_LOGGING
183static const TypeId dataTypeIdBySize[9] = {

Callers

nothing calls this directly

Calls 14

deabstractDeltaOfSizeFunction · 0.85
registerSizeFunction · 0.85
deabstractFunction · 0.85
isValidFunction · 0.85
erroredFunction · 0.85
sizeOfFunction · 0.85
mulOverflowFunction · 0.85
formatDataFunction · 0.85
ensureSpaceMethod · 0.80
emitDataMethod · 0.80
doneMethod · 0.80
archFunction · 0.70

Tested by

no test coverage detected