當前位置: 首頁>>代碼示例>>C++>>正文


C++ ASMJIT_ASSERT函數代碼示例

本文整理匯總了C++中ASMJIT_ASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ ASMJIT_ASSERT函數的具體用法?C++ ASMJIT_ASSERT怎麽用?C++ ASMJIT_ASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ASMJIT_ASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的ASMJIT_ASSERT函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。