Esempio n. 1
0
Error Compiler::embed(const void* data, uint32_t size) noexcept {
  HLData* node = newDataNode(data, size);
  if (node == nullptr)
    return setLastError(kErrorNoHeapMemory);

  addNode(node);
  return kErrorOk;
}
Esempio n. 2
0
Error CodeBuilder::embed(const void* data, uint32_t size) {
  if (_lastError) return _lastError;

  CBData* node = newDataNode(data, size);
  if (ASMJIT_UNLIKELY(!node))
    return setLastError(DebugUtils::errored(kErrorNoHeapMemory));

  addNode(node);
  return kErrorOk;
}
Esempio n. 3
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. 4
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;
}