bool CObjectDictionarySnapShot::Get()
{
    bool oRetVal(false);

    if (m_pCommunicationModel)
    {
        __int64 value(0);
        BOOL oSuccess(FALSE);
        m_sObjectCount = 0;
        CObjectDictionary* pObjectDictionary(m_pCommunicationModel->GetObjectDictionary());
        CObjectEntryIterator* pIterator(0);
        CObjectEntry* pObjectEntry(0);
        WORD usIndex(0);
        BYTE ucSubIndex(0);
        EAccessType accessType(AT_READ_WRITE);

        //Create object dictionary iterator. This method uses new!!!
        if(pObjectDictionary)
        {
            pIterator = pObjectDictionary->CreateObjectEntryIterator();
            pIterator->First();
            while(!pIterator->IsFinished())
            {
                pObjectEntry = (CObjectEntry*)pIterator->Current();
                if(pObjectEntry)
                {
                    accessType = pObjectEntry->GetAccessType();
                    if((AT_READ_WRITE == accessType) || (AT_READ_WRITE_READ == accessType) || (AT_READ_WRITE_WRITE == accessType))
                    {
                        usIndex = pObjectEntry->GetIndex();
                        if((FIRST_OBJECT_INDEX <= usIndex) && (ODT_DOMAIN != pObjectEntry->GetDataTypeNumber()))
                        {
                            ucSubIndex = pObjectEntry->GetSubIndex();
                            m_pCommunicationModel->GetObject(usIndex, ucSubIndex, &value, 0);
                            m_aObjectDictionary[0][m_sObjectCount] = usIndex;
                            m_aObjectDictionary[1][m_sObjectCount] = ucSubIndex;
                            m_aObjectDictionary[2][m_sObjectCount] = value;
                            m_sObjectCount++;
                        }
                    }
                }
                pIterator->Next();
            }
            //Delete the iterator!!
            delete pIterator;
        }
        if(m_sObjectCount > 0)
        {
            oRetVal = true;
        }
    }
    return oRetVal;
}
Beispiel #2
0
AtomicValue::AtomicValue(AtomicValue::AtomicValueCAS, Kind kind, Origin origin, Width width, Value* expectedValue, Value* newValue, Value* pointer, MemoryValue::OffsetType offset, HeapRange range, HeapRange fenceRange)
    : MemoryValue(CheckedOpcode, kind, kind.opcode() == AtomicWeakCAS ? Int32 : expectedValue->type(), origin, offset, range, fenceRange, expectedValue, newValue, pointer)
    , m_width(width)
{
    ASSERT(bestType(GP, accessWidth()) == accessType());

    switch (kind.opcode()) {
    case AtomicWeakCAS:
    case AtomicStrongCAS:
        break;
    default:
        ASSERT_NOT_REACHED();
    }
}
Beispiel #3
0
AtomicValue::AtomicValue(AtomicValue::AtomicValueRMW, Kind kind, Origin origin, Width width, Value* operand, Value* pointer, MemoryValue::OffsetType offset, HeapRange range, HeapRange fenceRange)
    : MemoryValue(CheckedOpcode, kind, operand->type(), origin, offset, range, fenceRange, operand, pointer)
    , m_width(width)
{
    ASSERT(bestType(GP, accessWidth()) == accessType());

    switch (kind.opcode()) {
    case AtomicXchgAdd:
    case AtomicXchgAnd:
    case AtomicXchgOr:
    case AtomicXchgSub:
    case AtomicXchgXor:
    case AtomicXchg:
        break;
    default:
        ASSERT_NOT_REACHED();
    }
}
Beispiel #4
0
void DataflowAnalyzer::execute(const Statement *statement, ReachingDefinitions &definitions) {
    switch (statement->kind()) {
        case Statement::INLINE_ASSEMBLY:
            /*
             * To be completely correct, one should clear reaching definitions.
             * However, not doing this usually leads to better code.
             */
            break;
        case Statement::ASSIGNMENT: {
            auto assignment = statement->asAssignment();
            computeValue(assignment->right(), definitions);
            handleWrite(assignment->left(), computeMemoryLocation(assignment->left(), definitions), definitions);
            break;
        }
        case Statement::JUMP: {
            auto jump = statement->asJump();

            if (jump->condition()) {
                computeValue(jump->condition(), definitions);
            }
            if (jump->thenTarget().address()) {
                computeValue(jump->thenTarget().address(), definitions);
            }
            if (jump->elseTarget().address()) {
                computeValue(jump->elseTarget().address(), definitions);
            }
            break;
        }
        case Statement::CALL: {
            auto call = statement->asCall();
            computeValue(call->target(), definitions);
            break;
        }
        case Statement::HALT: {
            break;
        }
        case Statement::TOUCH: {
            auto touch = statement->asTouch();
            switch (touch->accessType()) {
                case Term::READ:
                    computeValue(touch->term(), definitions);
                    break;
                case Term::WRITE:
                    handleWrite(touch->term(), computeMemoryLocation(touch->term(), definitions), definitions);
                    break;
                case Term::KILL:
                    handleKill(computeMemoryLocation(touch->term(), definitions), definitions);
                    break;
                default:
                    unreachable();
            }
            break;
        }
        case Statement::CALLBACK: {
            statement->asCallback()->function()();
            break;
        }
        case Statement::REMEMBER_REACHING_DEFINITIONS: {
            dataflow_.getDefinitions(statement) = definitions;
            break;
        }
        default:
            log_.warning(tr("%1: Unknown statement kind: %2.").arg(Q_FUNC_INFO).arg(statement->kind()));
            break;
    }
}