Package com.android.dx.rop.type

Examples of com.android.dx.rop.type.Prototype


   * corresponding element.
   */
  private Element processParameterList(CstBaseMethodRef methodRef, List<RegisterSpec> registers)
  {
    Element result= new Element("parameters", NS_DEX);
    Prototype prototype= methodRef.getPrototype();
    StdTypeList parameters= prototype.getParameterTypes();

    // Sanity check.
    if (parameters.size() != registers.size())
    {
      Log.error(TAG, "DEXmlvmOutputProcess.processParameterList: Size mismatch: " + "registers vs parameters");
      System.exit(-1);
    }

    for (int i= 0; i < parameters.size(); ++i)
    {
      Element parameterElement= new Element("parameter", NS_DEX);
      String parameterType= parameters.get(i).toHuman();
      parameterElement.setAttribute("type", parameterType);
      if (isRedType(parameterType))
      {
        parameterElement.setAttribute("isRedType", "true");
      }
      parameterElement.setAttribute("register", String.valueOf(registerNumber(registers.get(i).regString())));
      result.addContent(parameterElement);
    }
    Element returnElement= new Element("return", NS_DEX);
    String returnType= prototype.getReturnType().getType().toHuman();
    if (isRedType(returnType))
    {
      returnType= JLO;
    }
    returnElement.setAttribute("type", returnType);
View Full Code Here


   * types are added to the list of referenced types because they will be
   * needed for the reflection API.
   */
  private Element processSignature(CstMethodRef methodRef, Map<String, ReferenceKind> referencedTypes)
  {
    Prototype prototype= methodRef.getPrototype();
    StdTypeList parameters= prototype.getParameterTypes();

    Element result= new Element("signature", NS_XMLVM);
    for (int i= 0; i < parameters.size(); ++i)
    {
      Element parameterElement= new Element("parameter", NS_XMLVM);
      String parameterType= parameters.get(i).toHuman();
      parameterElement.setAttribute("type", parameterType);
      if (isRedType(parameterType))
      {
        parameterElement.setAttribute("isRedType", "true");
      }
      else
      {
        addReference(referencedTypes, parameterType, ReferenceKind.USAGE);
      }
      result.addContent(parameterElement);
    }
    Element returnElement= new Element("return", NS_XMLVM);
    String returnType= prototype.getReturnType().getType().toHuman();
    if (isRedType(returnType))
    {
      returnType= JLO;
    }
    else
View Full Code Here

                case ByteOps.INVOKESPECIAL: {
                    /*
                     * Get the instance prototype, and use it to direct
                     * the machine.
                     */
                    Prototype prototype =
                        ((CstBaseMethodRef) cst).getPrototype(false);
                    machine.popArgs(frame, prototype);
                    break;
                }
                case ByteOps.INVOKESTATIC: {
                    /*
                     * Get the static prototype, and use it to direct
                     * the machine.
                     */
                    Prototype prototype =
                        ((CstBaseMethodRef) cst).getPrototype(true);
                    machine.popArgs(frame, prototype);
                    break;
                }
                case ByteOps.MULTIANEWARRAY: {
                    /*
                     * The "value" here is the count of dimensions to
                     * create. Make a prototype of that many "int"
                     * types, and tell the machine to pop them. This
                     * isn't the most efficient way in the world to do
                     * this, but then again, multianewarray is pretty
                     * darn rare and so not worth much effort
                     * optimizing for.
                     */
                    Prototype prototype =
                        Prototype.internInts(Type.VOID, value);
                    machine.popArgs(frame, prototype);
                    break;
                }
                default: {
View Full Code Here

  /**
   * Extracts all types from the method signature.
   */
  private static void processSignature(CstMethodRef methodRef, Set<String> dependencies)
  {
    Prototype prototype= methodRef.getPrototype();

    // Parameter types.
    StdTypeList parameters= prototype.getParameterTypes();
    for (int i= 0; i < parameters.size(); ++i)
    {
      String parameterType= parameters.get(i).toHuman();
      dependencies.add(parameterType);
    }

    // Return type.
    dependencies.add(prototype.getReturnType().getType().toHuman());
  }
View Full Code Here

    /**
     * Sets up the first frame to contain all the incoming parameters in
     * locals.
     */
    private void setFirstFrame() {
        Prototype desc = method.getEffectiveDescriptor();
        startFrames[0].initializeWithParameters(desc.getParameterTypes());
        startFrames[0].setImmutable();
    }
View Full Code Here

     * a possible second block which deals with synchronization.
     */
    private void addSetupBlocks() {
        LocalVariableList localVariables = method.getLocalVariables();
        SourcePosition pos = method.makeSourcePosistion(0);
        Prototype desc = method.getEffectiveDescriptor();
        StdTypeList params = desc.getParameterTypes();
        int sz = params.size();
        InsnList insns = new InsnList(sz + 1);
        int at = 0;

        for (int i = 0; i < sz; i++) {
View Full Code Here

            case RegOps.INVOKE_STATIC: {
                return opInvokeStatic(((CstBaseMethodRef) cst).getPrototype());
            }
            case RegOps.INVOKE_VIRTUAL: {
                CstBaseMethodRef cstMeth = (CstBaseMethodRef) cst;
                Prototype meth = cstMeth.getPrototype();
                CstType definer = cstMeth.getDefiningClass();
                meth = meth.withFirstParameter(definer.getClassType());
                return opInvokeVirtual(meth);
            }
            case RegOps.INVOKE_SUPER: {
                CstBaseMethodRef cstMeth = (CstBaseMethodRef) cst;
                Prototype meth = cstMeth.getPrototype();
                CstType definer = cstMeth.getDefiningClass();
                meth = meth.withFirstParameter(definer.getClassType());
                return opInvokeSuper(meth);
            }
            case RegOps.INVOKE_DIRECT: {
                CstBaseMethodRef cstMeth = (CstBaseMethodRef) cst;
                Prototype meth = cstMeth.getPrototype();
                CstType definer = cstMeth.getDefiningClass();
                meth = meth.withFirstParameter(definer.getClassType());
                return opInvokeDirect(meth);
            }
            case RegOps.INVOKE_INTERFACE: {
                CstBaseMethodRef cstMeth = (CstBaseMethodRef) cst;
                Prototype meth = cstMeth.getPrototype();
                CstType definer = cstMeth.getDefiningClass();
                meth = meth.withFirstParameter(definer.getClassType());
                return opInvokeInterface(meth);
            }
        }

        throw new RuntimeException("unknown opcode " + RegOps.opName(opcode));
View Full Code Here

TOP

Related Classes of com.android.dx.rop.type.Prototype

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.