• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ASMJIT_ASSERT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ASMJIT_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ ASMJIT_ASSERT函数的具体用法?C++ ASMJIT_ASSERT怎么用?C++ ASMJIT_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ASMJIT_ASSERT函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ASMJIT_ASSERT

HLNode* Compiler::addNode(HLNode* node) noexcept {
  ASMJIT_ASSERT(node != nullptr);
  ASMJIT_ASSERT(node->_prev == nullptr);
  ASMJIT_ASSERT(node->_next == nullptr);

  if (_cursor == nullptr) {
    if (_firstNode == nullptr) {
      _firstNode = node;
      _lastNode = node;
    }
    else {
      node->_next = _firstNode;
      _firstNode->_prev = node;
      _firstNode = node;
    }
  }
  else {
    HLNode* prev = _cursor;
    HLNode* next = _cursor->_next;

    node->_prev = prev;
    node->_next = next;

    prev->_next = node;
    if (next)
      next->_prev = node;
    else
      _lastNode = node;
  }

  _cursor = node;
  return node;
}
开发者ID:AmesianX,项目名称:asmjit,代码行数:33,代码来源:compiler.cpp


示例2: ASMJIT_ASSERT

CBNode* CodeBuilder::addNode(CBNode* node) noexcept {
  ASMJIT_ASSERT(node);
  ASMJIT_ASSERT(node->_prev == nullptr);
  ASMJIT_ASSERT(node->_next == nullptr);

  if (!_cursor) {
    if (!_firstNode) {
      _firstNode = node;
      _lastNode = node;
    }
    else {
      node->_next = _firstNode;
      _firstNode->_prev = node;
      _firstNode = node;
    }
  }
  else {
    CBNode* prev = _cursor;
    CBNode* next = _cursor->_next;

    node->_prev = prev;
    node->_next = next;

    prev->_next = node;
    if (next)
      next->_prev = node;
    else
      _lastNode = node;
  }

  _cursor = node;
  return node;
}
开发者ID:tenerefis,项目名称:WIC-Client,代码行数:33,代码来源:codebuilder.cpp


示例3: ASMJIT_ASSERT

Error X86Compiler::_newVar(Var* var, uint32_t vType, const char* name, va_list ap) {
  ASMJIT_ASSERT(vType < kX86VarTypeCount);
  vType = _targetVarMapping[vType];
  ASMJIT_ASSERT(vType != kInvalidVar);

  // The assertion won't be compiled in release build, however, we want to check
  // this anyway.
  if (vType == kInvalidVar) {
    static_cast<X86Var*>(var)->reset();
    return kErrorInvalidArgument;
  }

  const X86VarInfo& vInfo = _x86VarInfo[vType];
  char buf[64];

  // Format the name if `ap` is given.
  if (ap) {
    vsnprintf(buf, ASMJIT_ARRAY_SIZE(buf), name, ap);
    buf[ASMJIT_ARRAY_SIZE(buf) - 1] = '\0';
    name = buf;
  }

  VarData* vd = _newVd(vType, vInfo.getSize(), vInfo.getClass(), name);
  if (vd == NULL) {
    static_cast<X86Var*>(var)->reset();
    return getLastError();
  }

  var->_init_packed_op_sz_w0_id(kOperandTypeVar, vInfo.getSize(), vInfo.getReg() << 8, vd->getId());
  var->_vreg.vType = vType;
  return kErrorOk;
}
开发者ID:kbugstar,项目名称:asmjit,代码行数:32,代码来源:x86compiler.cpp


示例4: ASMJIT_ASSERT

Node* BaseCompiler::addNode(Node* node) {
  ASMJIT_ASSERT(node != NULL);
  ASMJIT_ASSERT(node->_prev == NULL);
  ASMJIT_ASSERT(node->_next == NULL);

  if (_cursor == NULL) {
    if (_firstNode == NULL) {
      _firstNode = node;
      _lastNode = node;
    }
    else {
      node->_next = _firstNode;
      _firstNode->_prev = node;
      _firstNode = node;
    }
  }
  else {
    Node* prev = _cursor;
    Node* next = _cursor->_next;

    node->_prev = prev;
    node->_next = next;

    prev->_next = node;
    if (next)
      next->_prev = node;
    else
      _lastNode = node;
  }

  _cursor = node;
  return node;
}
开发者ID:RPCS3,项目名称:asmjit,代码行数:33,代码来源:compiler.cpp


示例5: ASMJIT_ASSERT

void X86Compiler::bind(const Label& label)
{
  uint32_t id = label.getId() & kOperandIdValueMask;

  ASMJIT_ASSERT(id != kInvalidValue);
  ASMJIT_ASSERT(id < _targets.getLength());

  addItem(_targets[id]);
}
开发者ID:0ryuO,项目名称:desmume-libretro,代码行数:9,代码来源:x86compiler.cpp


示例6: CodeBuilder_nodeRemoved

static ASMJIT_INLINE void CodeBuilder_nodeRemoved(CodeBuilder* self, CBNode* node_) noexcept {
  if (node_->isJmpOrJcc()) {
    CBJump* node = static_cast<CBJump*>(node_);
    CBLabel* label = node->getTarget();

    if (label) {
      // Disconnect.
      CBJump** pPrev = &label->_from;
      for (;;) {
        ASMJIT_ASSERT(*pPrev != nullptr);

        CBJump* current = *pPrev;
        if (!current) break;

        if (current == node) {
          *pPrev = node->_jumpNext;
          break;
        }

        pPrev = &current->_jumpNext;
      }

      label->subNumRefs();
    }
  }
}
开发者ID:tenerefis,项目名称:WIC-Client,代码行数:26,代码来源:codebuilder.cpp


示例7: BaseCompiler_nodeRemoved

static ASMJIT_INLINE void BaseCompiler_nodeRemoved(BaseCompiler* self, Node* node_) {
  if (node_->isJmpOrJcc()) {
    JumpNode* node = static_cast<JumpNode*>(node_);
    TargetNode* target = node->getTarget();

    // Disconnect.
    JumpNode** pPrev = &target->_from;
    for (;;) {
      ASMJIT_ASSERT(*pPrev != NULL);
      JumpNode* current = *pPrev;

      if (current == NULL)
        break;

      if (current == node) {
        *pPrev = node->_jumpNext;
        break;
      }

      pPrev = &current->_jumpNext;
    }

    target->subNumRefs();
  }
}
开发者ID:RPCS3,项目名称:asmjit,代码行数:25,代码来源:compiler.cpp


示例8: ASMJIT_ASSERT

Error Compiler::bind(const Label& label) {
  uint32_t index = label.getId();
  ASMJIT_ASSERT(index < _targetList.getLength());

  addNode(_targetList[index]);
  return kErrorOk;
}
开发者ID:CauldronDevelopmentLLC,项目名称:openmm,代码行数:7,代码来源:compiler.cpp


示例9: ASMJIT_ASSERT

MemCell* Context::_newVarCell(VarData* vd) {
  ASMJIT_ASSERT(vd->_memCell == NULL);

  MemCell* cell;
  uint32_t size = vd->getSize();

  if (vd->isStack()) {
    cell = _newStackCell(size, vd->getAlignment());

    if (cell == NULL)
      return NULL;
  }
  else {
    cell = static_cast<MemCell*>(_baseZone.alloc(sizeof(MemCell)));
    if (cell == NULL)
      goto _NoMemory;

    cell->_next = _memVarCells;
    _memVarCells = cell;

    cell->_offset = 0;
    cell->_size = size;
    cell->_alignment = size;

    _memMaxAlign = IntUtil::iMax<uint32_t>(_memMaxAlign, size);
    _memVarTotal += size;

    switch (size) {
      case  1: _mem1ByteVarsUsed++ ; break;
      case  2: _mem2ByteVarsUsed++ ; break;
      case  4: _mem4ByteVarsUsed++ ; break;
      case  8: _mem8ByteVarsUsed++ ; break;
      case 16: _mem16ByteVarsUsed++; break;
      case 32: _mem32ByteVarsUsed++; break;
      case 64: _mem64ByteVarsUsed++; break;
      default: ASMJIT_ASSERT(!"Reached");
    }
  }

  vd->_memCell = cell;
  return cell;

_NoMemory:
  _compiler->setError(kErrorNoHeapMemory);
  return NULL;
}
开发者ID:CauldronDevelopmentLLC,项目名称:openmm,代码行数:46,代码来源:context.cpp


示例10: _getVar

void X86Compiler::rename(Var& var, const char* name)
{
  if (var.getId() == kInvalidValue)
    return;

  X86CompilerVar* vdata = _getVar(var.getId());
  ASMJIT_ASSERT(vdata != NULL);

  vdata->_name = _zoneMemory.sdup(name);
}
开发者ID:0ryuO,项目名称:desmume-libretro,代码行数:10,代码来源:x86compiler.cpp


示例11: getAssembler

HLLabel* Compiler::newLabelNode() noexcept {
  Assembler* assembler = getAssembler();
  if (assembler == nullptr) return nullptr;

  uint32_t id = assembler->_newLabelId();
  LabelData* ld = assembler->getLabelData(id);

  HLLabel* node = newNode<HLLabel>(id);
  if (node == nullptr) return nullptr;

  // These have to be zero now.
  ASMJIT_ASSERT(ld->exId == 0);
  ASMJIT_ASSERT(ld->exData == nullptr);

  ld->exId = _exId;
  ld->exData = node;

  return node;
}
开发者ID:AmesianX,项目名称:asmjit,代码行数:19,代码来源:compiler.cpp


示例12: ASMJIT_ARRAY_SIZE

ASMJIT_FAVOR_SIZE void ArchInfo::init(uint32_t type, uint32_t subType) noexcept {
  uint32_t index = type < ASMJIT_ARRAY_SIZE(archInfoTable) ? type : uint32_t(0);

  // Make sure the `archInfoTable` array is correctly indexed.
  _signature = archInfoTable[index];
  ASMJIT_ASSERT(_type == index);

  // Even if the architecture is not known we setup its type and sub-type,
  // however, such architecture is not really useful.
  _type = type;
  _subType = subType;
}
开发者ID:alexey-lysiuk,项目名称:gzdoom,代码行数:12,代码来源:arch.cpp


示例13: getFunc

X86CompilerFuncDecl* X86Compiler::endFunc()
{
  X86CompilerFuncDecl* func = getFunc();
  ASMJIT_ASSERT(func != NULL);

  bind(func->_exitLabel);
  addItem(func->_end);

  func->setFuncFlag(kFuncFlagIsFinished);
  _func = NULL;

  return func;
}
开发者ID:0ryuO,项目名称:desmume-libretro,代码行数:13,代码来源:x86compiler.cpp


示例14: ASMJIT_ASSERT

Error X86Compiler::_newVar(Var* var, uint32_t vType, const char* name) noexcept {
  ASMJIT_ASSERT(vType < kX86VarTypeCount);
  vType = _targetVarMapping[vType];
  ASMJIT_ASSERT(vType != kInvalidVar);

  // The assertion won't be compiled in release build, however, we want to check
  // this anyway.
  if (vType == kInvalidVar) {
    static_cast<X86Var*>(var)->reset();
    return kErrorInvalidArgument;
  }

  const VarInfo& vInfo = _x86VarInfo[vType];
  VarData* vd = _newVd(vInfo, name);

  if (vd == nullptr) {
    static_cast<X86Var*>(var)->reset();
    return getLastError();
  }

  var->_init_packed_op_sz_w0_id(Operand::kTypeVar, vInfo.getSize(), vInfo.getRegType() << 8, vd->getId());
  var->_vreg.vType = vType;
  return kErrorOk;
}
开发者ID:zyantific,项目名称:asmjit,代码行数:24,代码来源:x86compiler.cpp


示例15: vm

void* VMem::allocProcessMemory(HANDLE hProcess, size_t length, size_t* allocated, bool canExecute) {
  // VirtualAlloc rounds allocated size to page size automatically.
  size_t msize = IntUtil::roundUp(length, vm().pageSize);

  // Windows XP SP2 / Vista allow Data Excution Prevention (DEP).
  WORD protect = canExecute ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE;
  LPVOID mbase = VirtualAllocEx(hProcess, NULL, msize, MEM_COMMIT | MEM_RESERVE, protect);
  if (mbase == NULL) return NULL;

  ASMJIT_ASSERT(IntUtil::isAligned<size_t>(reinterpret_cast<size_t>(mbase), vm().alignment));

  if (allocated != NULL)
    *allocated = msize;
  return mbase;
}
开发者ID:sharwell,项目名称:asmjit,代码行数:15,代码来源:vmem.cpp


示例16: ASMJIT_ASSERT

void* Zone::_alloc(size_t size) noexcept {
  Block* curBlock = _block;
  size_t blockSize = Utils::iMax<size_t>(_blockSize, size);

  // The `_alloc()` method can only be called if there is not enough space
  // in the current block, see `alloc()` implementation for more details.
  ASMJIT_ASSERT(curBlock == &Zone_zeroBlock || curBlock->getRemainingSize() < size);

  // If the `Zone` has been reset the current block doesn't have to be the
  // last one. Check if there is a block that can be used instead of allocating
  // a new one. If there is a `next` block it's completely unused, we don't have
  // to check for remaining bytes.
  Block* next = curBlock->next;
  if (next != nullptr && next->getBlockSize() >= size) {
    next->pos = next->data + size;
    _block = next;
    return static_cast<void*>(next->data);
  }

  // Prevent arithmetic overflow.
  if (blockSize > ~static_cast<size_t>(0) - sizeof(Block))
    return nullptr;

  Block* newBlock = static_cast<Block*>(ASMJIT_ALLOC(sizeof(Block) - sizeof(void*) + blockSize));
  if (newBlock == nullptr)
    return nullptr;

  newBlock->pos = newBlock->data + size;
  newBlock->end = newBlock->data + blockSize;
  newBlock->prev = nullptr;
  newBlock->next = nullptr;

  if (curBlock != &Zone_zeroBlock) {
    newBlock->prev = curBlock;
    curBlock->next = newBlock;

    // Does only happen if there is a next block, but the requested memory
    // can't fit into it. In this case a new buffer is allocated and inserted
    // between the current block and the next one.
    if (next != nullptr) {
      newBlock->next = next;
      next->prev = newBlock;
    }
  }

  _block = newBlock;
  return static_cast<void*>(newBlock->data);
}
开发者ID:InsZVA,项目名称:asmjit,代码行数:48,代码来源:zone.cpp



注:本文中的ASMJIT_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASN1_INTEGER_new函数代码示例发布时间:2022-05-30
下一篇:
C++ ASMAtomicWriteU32函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap