Esempio n. 1
0
void Registry::setBinary(StringRange valueName, ArrayRange<const unsigned char> value, Registry::ValueKind kind) {
	assert("Empty Registry" && *this);
	assert("Invalid Registry::ValueKind" && ValueKind::_validate(kind));

	checkResult(RegSetValueExW(_handle, valueName.c_str(), 0, kind
		, value.empty() ? nullptr : value.begin(), value.size()));
}
Esempio n. 2
0
void SCCP::analyzeSSA(Instr* instr) {
    if (numDefs(instr) == 0) {
        if (isBlockEnd(instr))
            analyzeBranch((BlockEndInstr*)instr);
        return;
    }
    // dev: save current types for later check
    int i = 0;
    for (ArrayRange<Def> d = defRange(instr); !d.empty(); d.popFront(), ++i)
        old_types[i] = type(d.front());
    // compute types
    eval_counts[instr->id]++;
    analyzer.computeTypes(instr);
    // dev: check computation result
    bool changed2 = false;
    i = 0;
    for (ArrayRange<Def> d = defRange(instr); !d.empty(); d.popFront(), ++i) {
        AvmAssert(subtypeof(old_types[i], type(d.front())) && "illegal type narrowing");
        changed2 |= *type(d.front()) != *old_types[i];
    }
    if (changed2) {
        if (enable_typecheck) {
            printInstr(instr);
        }
        addInstrUsers(instr);
    }
}
Esempio n. 3
0
void SCCP::analyzeBranch(BlockEndInstr* end) {
    switch (kind(end)) {
    case HR_goto:
        addBlock(cast<GotoInstr>(end)->target);
        break;
    case HR_if:
    case HR_switch: {
        CondInstr* cond = (CondInstr*)end;
        ArmInstr* arm = getConstArm(cond);
        if (arm)
            addBlock(arm);
        else
            for (ArrayRange<ArmInstr*> a = armRange(cond); !a.empty();)
                addBlock(a.popFront());
        break;
    }
    }
    if (end->catch_blocks != NULL) {
        for (CatchBlockRange r(end); !r.empty();)
            addBlock(r.popFront());
    }
}
Esempio n. 4
0
 /** Returns if there is any overlap with the other range. */
 bool    overlaps(const ArrayRange& other) const {
   // Case 1: contains(other.begin) or contains(other.end)
   // Case 2: not case 1, but other.contains(begin)
   return contains(other.begin_) || contains(other.end_) || other.contains(begin_);
 }