Package gov.nasa.jpf.jvm

Examples of gov.nasa.jpf.jvm.CodeBuilder


   * See JVM spec for Java 6 at 3.11.8 , Table 4.2
   * and chapter 6
   */
  public static MethodInfo implement(MethodInfo method) {
    String returnType = method.getReturnType();
    CodeBuilder cb = method.createCodeBuilder();
    // TODO don't know if it's safe to pass a null class file.
    cb.initialize(null, method);
 
    if ("V".equals(returnType)) {         // void
      cb.return_();
    } else if ("B".equals(returnType) ||  // byte
               "C".equals(returnType) ||  // char
               "I".equals(returnType) ||  // int
               "S".equals(returnType) ||  // short
               "Z".equals(returnType) ) { // boolean
      cb.iconst_0();
      cb.ireturn();
    } else if ("J".equals(returnType)) {  // long
      cb.lconst_0();
      cb.lreturn();
    } else if ("F".equals(returnType)) {  // float
      cb.fconst_0();
      cb.freturn();
    } else if ("D".equals(returnType)) {  // double
      cb.dconst_0();
      cb.dreturn();
    } else if ('L' == returnType.charAt(0) ||
               '[' == returnType.charAt(0)) {  // references
      cb.aconst_null();
      cb.areturn();
    }
    cb.installCode();
    logger.finer("Default implementation for method: "
        + method.getReturnTypeName() + " " + method.getLongName() + "\n\t"
        + Arrays.toString(method.getInstructions()).replace(", ", "\n\t ") + "\n");
    return method;   
  }
View Full Code Here

TOP

Related Classes of gov.nasa.jpf.jvm.CodeBuilder

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.