Package ptolemy.data.expr

Examples of ptolemy.data.expr.CachedMethod$MatrixMapCachedMethod


        for (int i = 0; i < argCount; i++) {
            argTypes[i] = ((ASTPtRootNode) node.jjtGetChild(i + 1)).getType();
        }

        // Find the method...
        CachedMethod cachedMethod = CachedMethod.findMethod(node
                .getFunctionName(), argTypes, CachedMethod.FUNCTION);

        if (!cachedMethod.isValid()) {
            throw new IllegalActionException("Function " + cachedMethod
                    + " not found.");
        }

        if (cachedMethod instanceof CachedMethod.BaseConvertCachedMethod
                || cachedMethod instanceof CachedMethod.ArrayMapCachedMethod
                || cachedMethod instanceof CachedMethod.MatrixMapCachedMethod) {
            throw new IllegalActionException(
                    "CodeGeneration not supported for "
                            + cachedMethod.getClass());
        }

        Method method = cachedMethod.getMethod();

        // Find the corresponding soot method.
        SootMethod sootMethod = SootUtilities.getSootMethodForMethod(method);

        // The list of locals that are arguments to the function.
        List args = new LinkedList();

        CachedMethod.ArgumentConversion[] conversions = cachedMethod
                .getConversions();

        for (int i = 0; i < argCount; i++) {
            Local tokenLocal = (Local) _nodeToLocal
                    .get(node.jjtGetChild(i + 1));
View Full Code Here


        for (int i = 0; i < node.jjtGetNumChildren(); i++) {
            argTypes[i] = ((ASTPtRootNode) node.jjtGetChild(i)).getType();
        }

        // Find the method...
        CachedMethod cachedMethod = CachedMethod.findMethod(node
                .getMethodName(), argTypes, CachedMethod.METHOD);

        if (!cachedMethod.isValid()) {
            throw new IllegalActionException("Function " + cachedMethod
                    + " not found.");
        }

        if (cachedMethod instanceof CachedMethod.ArrayMapCachedMethod
                || cachedMethod instanceof CachedMethod.MatrixMapCachedMethod) {
            throw new IllegalActionException(
                    "CodeGeneration not supported for "
                            + cachedMethod.getClass());
        }

        Method method = cachedMethod.getMethod();

        // Find the corresponding soot method.
        SootMethod sootMethod = SootUtilities.getSootMethodForMethod(method);

        //     System.out.println("generating code to invoke " + sootMethod);
        Local originalBaseLocal = (Local) _nodeToLocal.get(node.jjtGetChild(0));
        RefType baseType = RefType.v(sootMethod.getDeclaringClass());
        Local baseLocal = Jimple.v().newLocal("base", baseType);
        _body.getLocals().add(baseLocal);

        if (cachedMethod instanceof CachedMethod.BaseConvertCachedMethod) {
            /*RefType tempBaseType =*/PtolemyUtilities
                    .getSootTypeForTokenType(argTypes[0]);
            Local tempBaseLocal = _convertTokenArgToJavaArg(originalBaseLocal,
                    argTypes[0],
                    ((CachedMethod.BaseConvertCachedMethod) cachedMethod)
                            .getBaseConversion());
            _units.insertBefore(Jimple.v().newAssignStmt(baseLocal,
                    Jimple.v().newCastExpr(tempBaseLocal, baseType)),
                    _insertPoint);
        } else {
            _units.insertBefore(Jimple.v().newAssignStmt(baseLocal,
                    Jimple.v().newCastExpr(originalBaseLocal, baseType)),
                    _insertPoint);
        }

        // The list of locals that are arguments to the function.
        List args = new LinkedList();

        CachedMethod.ArgumentConversion[] conversions = cachedMethod
                .getConversions();

        for (int i = 1; i < node.jjtGetNumChildren(); i++) {
            Local tokenLocal = (Local) _nodeToLocal.get(node.jjtGetChild(i));

View Full Code Here

TOP

Related Classes of ptolemy.data.expr.CachedMethod$MatrixMapCachedMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.