Package soot.jimple

Examples of soot.jimple.Constant


                                "java.lang.String")) {
                            if (_debug) {
                                System.out.println("handling as string type");
                            }

                            Constant constant = StringConstant
                                    .v((String) object);
                            box.setValue(constant);
                            doneSomething = true;
                        }
                    } else if (returnType instanceof PrimType
                            && !(returnType instanceof VoidType)) {
                        if (_debug) {
                            System.out.println("handling as base type");
                        }

                        // Must be a primitive type...
                        Constant constant = SootUtilities
                                .convertArgumentToConstantValue(object);
                        box.setValue(constant);
                        doneSomething = true;
                    } else {
                        throw new RuntimeException("unknown return type = "
View Full Code Here


                            Object object = SootUtilities
                                    .reflectAndInvokeMethod(port,
                                            r.getMethod(), argValues);

                            // System.out.println("method result  = " + constant);
                            Constant constant = SootUtilities
                                    .convertArgumentToConstantValue(object);

                            // replace the method invocation.
                            box.setValue(constant);
                        } else if (r.getMethod().getName().equals("hasToken")) {
View Full Code Here

                            Object object = SootUtilities
                                    .reflectAndInvokeMethod(port,
                                            r.getMethod(), argValues);

                            // System.out.println("method result  = " + constant);
                            Constant constant = SootUtilities
                                    .convertArgumentToConstantValue(object);

                            // replace the method invocation.
                            box.setValue(constant);
                        } else if (r.getMethod().getName().equals("hasToken")) {
View Full Code Here

        Stmt failedStmt = Jimple.v().newNopStmt();
        Stmt satisfiedStmt = Jimple.v().newNopStmt();

        // Determine if we are doing AND or OR
        Constant conditionConstant = node.isLogicalAnd() ? IntConstant.v(1)
                : IntConstant.v(0);
        _units.insertBefore(Jimple.v().newAssignStmt(conditionLocal,
                conditionConstant), _insertPoint);

        for (int i = 0; i < numChildren; i++) {
            _generateChild(node, i);

            Local childLocal = (Local) _nodeToLocal.get(node.jjtGetChild(i));

            // Check the condition
            _units.insertBefore(Jimple.v().newAssignStmt(
                    booleanTokenLocal,
                    Jimple.v().newCastExpr(childLocal,
                            RefType.v(PtolemyUtilities.booleanTokenClass))),
                    _insertPoint);
            _units.insertBefore(Jimple.v().newAssignStmt(
                    flagLocal,
                    Jimple.v().newVirtualInvokeExpr(booleanTokenLocal,
                            PtolemyUtilities.booleanValueMethod.makeRef())),
                    _insertPoint);

            // If condition is true then skip to start of true branch.
            _units.insertBefore(Jimple.v().newIfStmt(
                    Jimple.v().newNeExpr(flagLocal, conditionConstant),
                    failedStmt), _insertPoint);
        }

        // If we fall through, then must be satisfied.
        _units
                .insertBefore(Jimple.v().newGotoStmt(satisfiedStmt),
                        _insertPoint);
        _units.insertBefore(failedStmt, _insertPoint);

        Constant notConditionConstant = node.isLogicalAnd() ? IntConstant.v(0)
                : IntConstant.v(1);
        _units.insertBefore(Jimple.v().newAssignStmt(conditionLocal,
                notConditionConstant), _insertPoint);

        _units.insertBefore(satisfiedStmt, _insertPoint);
View Full Code Here

TOP

Related Classes of soot.jimple.Constant

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.