Package soot

Examples of soot.Local


                    // Gap in the links.  The next link has to use an
                    // explicit index.
                    continue;
                }

                Local portLocal = (Local) _portLocalMap.get(port);
                Local relationLocal = (Local) _relationLocalMap.get(relation);

                // call the _insertLink method with the current index.
                body.getUnits().add(
                        Jimple.v().newInvokeStmt(
                                Jimple.v().newVirtualInvokeExpr(
View Full Code Here


            ComponentEntity entity = (ComponentEntity) entities.next();

            for (Iterator ports = entity.portList().iterator(); ports.hasNext();) {
                ComponentPort port = (ComponentPort) ports.next();

                Local portLocal;

                // If we already have a local reference to the port
                if (_portLocalMap.keySet().contains(port)) {
                    // then just get the reference.
                    portLocal = (Local) _portLocalMap.get(port);
                } else {
                    throw new RuntimeException("Found a port: " + port
                            + " that does not have a local variable!");
                }

                Iterator relations = port.linkedRelationList().iterator();
                int index = -1;

                while (relations.hasNext()) {
                    index++;

                    ComponentRelation relation = (ComponentRelation) relations
                            .next();

                    if (relation == null) {
                        // Gap in the links.  The next link has to use an
                        // explicit index.
                        continue;
                    }

                    Local relationLocal = (Local) _relationLocalMap
                            .get(relation);

                    // FIXME: Special case the transparent
                    // hierarchy...  find the right relation that IS
                    // in the relationLocalMap.  I have no idea how to
View Full Code Here

            Relation relation = (Relation) relations.next();
            String className = relation.getClass().getName();
            //String fieldName = getFieldNameForRelation(relation, composite);

            // Create a new local variable.
            Local local = PtolemyUtilities.createNamedObjAndLocal(body,
                    className, thisLocal, relation.getName());
            _relationLocalMap.put(relation, local);

            //             SootUtilities.createAndSetFieldFromLocal(body,
            //                     local, modelClass, PtolemyUtilities.relationType,
View Full Code Here

            JimpleBody body = Jimple.v().newBody(initMethod);
            initMethod.setActiveBody(body);
            body.insertIdentityStmts();

            Chain units = body.getUnits();
            Local thisLocal = body.getThisLocal();

            // Create a new class for each actor in the model.
            _createActorsIn(entity, tempCreatedMap, "modelTransformer",
                    _constAnalysis, options);

            // Create code in the model class to instantiate the ports
            // and parameters of the model.
            createAttributes(body, entity, thisLocal, entity, thisLocal,
                    entityInstanceClass, tempCreatedMap);

            _ports(body, thisLocal, entity, thisLocal, entity,
                    entityInstanceClass, tempCreatedMap, true);

            // Excess initialization, but necessary for -actor???
            Stmt insertPoint = Jimple.v().newNopStmt();
            body.getUnits().add(insertPoint);

            // InitializeAttributes of the ports and parameters.
            initializeAttributesBefore(body, insertPoint, entity, thisLocal,
                    entity, thisLocal, entityInstanceClass);

            // Create code in the model class to instantiate all
            // actors and relations, and connect the relations
            // to the ports.
            _entities(body, thisLocal, entity, thisLocal, entity,
                    entityInstanceClass, tempCreatedMap, options);
            _relations(body, thisLocal, entity, entityInstanceClass);
            _links(body, entity);
            _linksOnPortsContainedByContainedEntities(body, entity);

            // return void
            units.add(Jimple.v().newReturnVoidStmt());
        }

        implementExecutableInterface(entityInstanceClass);

        // Reinitialize the hierarchy, since we've added classes.
        Scene.v().setActiveHierarchy(new Hierarchy());
        Scene.v().setFastHierarchy(new FastHierarchy());

        {
            Set locallyModifiedAttributeSet = _constAnalysis
                    .getVariablesWithChangeContext(entity);

            // Filter out any attribute that is independent (and might
            // be modified).
            for (Iterator i = locallyModifiedAttributeSet.iterator(); i
                    .hasNext();) {
                if (_constAnalysis.isIndependent((Variable) i.next())) {
                    i.remove();
                }
            }

            // Sort according to dependencies.
            List locallyModifiedAttributeList;

            try {
                DirectedGraph graph = _constAnalysis.getDependencyGraph();
                locallyModifiedAttributeList = Arrays.asList(Graph
                        .weightArray(graph.topologicalSort(graph
                                .nodes(locallyModifiedAttributeSet))));
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }

            System.out.println("locallyModifiedAttributeList of " + entity
                    + " = " + locallyModifiedAttributeList);

            // Add code to the beginning of the prefire method that
            // computes the attribute values of anything that is not a
            // constant.
            SootMethod method = entityInstanceClass.getMethodByName("prefire");
            System.out.println("method = " + method);

            JimpleBody body = (JimpleBody) method.getActiveBody();
            Stmt insertPoint = body.getFirstNonIdentityStmt();
            Local containerLocal = Jimple.v().newLocal("entity",
                    PtolemyUtilities.componentEntityType);
            body.getLocals().add(containerLocal);

            // Invoke the method to compute each attribute, in order.
            for (Iterator attributes = locallyModifiedAttributeList.iterator(); attributes
View Full Code Here

            // create the new constructor.
            SootMethod constructor = _createConstructor(this, method);
            JimpleBody body = (JimpleBody) constructor.getActiveBody();
            Chain units = body.getUnits();
            Local thisLocal = body.getThisLocal();

            // Call the __CGInit method.
            units.add(Jimple.v().newInvokeStmt(
                    Jimple.v().newVirtualInvokeExpr(thisLocal,
                            _initMethod.makeRef())));
View Full Code Here

        // Add this and read the parameters into locals
        body.insertIdentityStmts();
        constructor.setActiveBody(body);

        Chain units = body.getUnits();
        Local thisLocal = body.getThisLocal();

        // get a list of the locals that reference the parameters of the
        // constructor.  What a nice hack.
        List parameterList = new ArrayList();
        parameterList.addAll(body.getLocals());
View Full Code Here

            TypedIOPort port) {
        if (expr.getArgCount() != 1) {
            throw new RuntimeException("multirate not supported.");
        }

        Local returnLocal = Jimple.v().newLocal("return",
                PtolemyUtilities.tokenType);
        body.getLocals().add(returnLocal);

        // Refer directly to the buffer in the _model
        int channel = 0;
View Full Code Here

            InvokeExpr expr, TypedIOPort port) {
        if (expr.getArgCount() != 1) {
            throw new RuntimeException("multirate not supported.");
        }

        Local returnLocal = Jimple.v().newLocal("return",
                PtolemyUtilities.tokenType);
        body.getLocals().add(returnLocal);

        Value channelValue = expr.getArg(0);
View Full Code Here

            InvokeExpr expr, TypedIOPort port) {
        if (expr.getArgCount() != 1) {
            throw new RuntimeException("multirate not supported.");
        }

        Local returnLocal = Jimple.v().newLocal("return",
                PtolemyUtilities.tokenType);
        body.getLocals().add(returnLocal);

        Value channelValue = expr.getArg(0);
View Full Code Here

                        .get(types.next());
                RefType tokenType = PtolemyUtilities
                        .getSootTypeForTokenType(type);

                String fieldName = relation.getName() + "_bufferLocal";
                Local arrayLocal = Jimple.v().newLocal(fieldName, tokenType);
                clinitBody.getLocals().add(arrayLocal);

                for (int i = 0; i < relation.getWidth(); i++) {
                    SootField field = new SootField(InlinePortTransformer
                            .getBufferFieldName(relation, i, type), tokenType,
View Full Code Here

TOP

Related Classes of soot.Local

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.