Exemplo n.º 1
0
static bool
DecodeCall(FunctionDecoder& f, ExprType* type)
{
    uint32_t funcIndex;
    if (!f.d().readVarU32(&funcIndex))
        return f.fail("unable to read import index");

    if (funcIndex >= f.mg().numFuncSigs())
        return f.fail("callee index out of range");

    return DecodeCallWithSig(f, f.mg().funcSig(funcIndex), type);
}
Exemplo n.º 2
0
static bool
DecodeCallImport(FunctionDecoder& f, ExprType* type)
{
    uint32_t importIndex;
    if (!f.d().readVarU32(&importIndex))
        return f.fail("unable to read import index");

    if (importIndex >= f.mg().numImports())
        return f.fail("import index out of range");

    return DecodeCallWithSig(f, *f.mg().import(importIndex).sig, type);
}
Exemplo n.º 3
0
static bool
DecodeCallIndirect(FunctionDecoder& f, ExprType expected)
{
    uint32_t sigIndex;
    if (!f.d().readVarU32(&sigIndex))
        return f.fail("unable to read indirect call signature index");

    if (sigIndex >= f.mg().numSigs())
        return f.fail("signature index out of range");

    if (!DecodeExpr(f, ExprType::I32))
        return false;

    return DecodeCallWithSig(f, f.mg().sig(sigIndex), expected);
}
Exemplo n.º 4
0
static bool
DecodeCallImport(FunctionDecoder& f, ExprType expected)
{
    uint32_t importIndex;
    if (!f.d().readU32(&importIndex))
        return f.fail("unable to read import index");

    if (importIndex >= f.mg().numImports())
        return f.fail("import index out of range");

    const DeclaredSig& sig = *f.mg().import(importIndex).sig;

    for (ValType argType : sig.args()) {
        if (!DecodeExpr(f, ToExprType(argType)))
            return false;
    }

    return CheckType(f, sig.ret(), expected);
}
Exemplo n.º 5
0
static bool
DecodeCall(FunctionDecoder& f, ExprType expected)
{
    uint32_t funcIndex;
    if (!f.d().readU32(&funcIndex))
        return f.fail("unable to read import index");

    if (funcIndex >= f.mg().numFuncSigs())
        return f.fail("callee index out of range");

    const DeclaredSig& sig = f.mg().funcSig(funcIndex);

    for (ValType argType : sig.args()) {
        if (!DecodeExpr(f, ToExprType(argType)))
            return false;
    }

    return CheckType(f, sig.ret(), expected);
}