本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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]);
}
示例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 = ¤t->_jumpNext;
}
label->subNumRefs();
}
}
}
示例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 = ¤t->_jumpNext;
}
target->subNumRefs();
}
}
示例8: ASMJIT_ASSERT
Error Compiler::bind(const Label& label) {
uint32_t index = label.getId();
ASMJIT_ASSERT(index < _targetList.getLength());
addNode(_targetList[index]);
return kErrorOk;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}