Esempio n. 1
0
Error Compiler::embedConstPool(const Label& label, const ConstPool& pool) noexcept {
  if (label.getId() == kInvalidValue)
    return kErrorInvalidState;

  align(kAlignData, static_cast<uint32_t>(pool.getAlignment()));
  bind(label);

  HLData* embedNode = newDataNode(nullptr, static_cast<uint32_t>(pool.getSize()));
  if (embedNode == nullptr)
    return kErrorNoHeapMemory;

  pool.fill(embedNode->getData());
  addNode(embedNode);

  return kErrorOk;
}
Esempio n. 2
0
Error CodeBuilder::embedConstPool(const Label& label, const ConstPool& pool) {
  if (_lastError) return _lastError;

  if (!isLabelValid(label))
    return setLastError(DebugUtils::errored(kErrorInvalidLabel));

  ASMJIT_PROPAGATE(align(kAlignData, static_cast<uint32_t>(pool.getAlignment())));
  ASMJIT_PROPAGATE(bind(label));

  CBData* node = newDataNode(nullptr, static_cast<uint32_t>(pool.getSize()));
  if (ASMJIT_UNLIKELY(!node))
    return setLastError(DebugUtils::errored(kErrorNoHeapMemory));

  pool.fill(node->getData());
  addNode(node);
  return kErrorOk;
}