Package clojure.asm.commons

Examples of clojure.asm.commons.Method


      if(context == C.RETURN)
        {
        ObjMethod method = (ObjMethod) METHOD.deref();
        method.emitClearLocals(gen);
        }
      Method m = new Method(methodName, Type.getReturnType(method), Type.getArgumentTypes(method));
      if(method.getDeclaringClass().isInterface())
        gen.invokeInterface(type, m);
      else
        gen.invokeVirtual(type, m);
      //if(context != C.STATEMENT || method.getReturnType() == Void.TYPE)
View Full Code Here


          gen.visitInsn((Integer) ops);
        }
      else
        {
        Type type = Type.getType(c);
        Method m = new Method(methodName, Type.getReturnType(method), Type.getArgumentTypes(method));
        gen.invokeStatic(type, m);
        }
      }
    else
      throw new UnsupportedOperationException("Unboxed emit of unknown member");
View Full Code Here

        {
        ObjMethod method = (ObjMethod) METHOD.deref();
        method.emitClearLocals(gen);
        }
      Type type = Type.getType(c);
      Method m = new Method(methodName, Type.getReturnType(method), Type.getArgumentTypes(method));
      gen.invokeStatic(type, m);
      //if(context != C.STATEMENT || method.getReturnType() == Void.TYPE)
      Class retClass = method.getReturnType();
      if(context == C.STATEMENT)
        {
View Full Code Here

  public boolean canEmitPrimitive(){
    return retClass.isPrimitive();
  }

  public void emitUnboxed(C context, ObjExpr objx, GeneratorAdapter gen){
    Method ms = new Method("invokeStatic", getReturnType(), paramtypes);
    if(variadic)
      {
      for(int i = 0; i < paramclasses.length - 1; i++)
        {
        Expr e = (Expr) args.nth(i);
View Full Code Here

      if(context == C.RETURN)
        {
        ObjMethod method = (ObjMethod) METHOD.deref();
        method.emitClearLocals(gen);
        }
      Method m = new Method(onMethod.getName(), Type.getReturnType(onMethod), Type.getArgumentTypes(onMethod));
      gen.invokeInterface(Type.getType(protocolOn), m);
      HostExpr.emitBoxReturn(objx, gen, onMethod.getReturnType());
      }
    gen.mark(endLabel);
  }
View Full Code Here

      {
      ObjMethod method = (ObjMethod) METHOD.deref();
      method.emitClearLocals(gen);
      }

    gen.invokeInterface(IFN_TYPE, new Method("invoke", OBJECT_TYPE, ARG_TYPES[Math.min(MAX_POSITIONAL_ARITY + 1,
                                                                                       args.count())]));
  }
View Full Code Here

        gen.checkCast(CHAR_TYPE);
        gen.invokeVirtual(CHAR_TYPE, charValueMethod);
        }
      else
        {
        Method m = null;
        gen.checkCast(NUMBER_TYPE);
        if(RT.booleanCast(RT.UNCHECKED_MATH.deref()))
          {
          if(paramType == int.class)
            m = Method.getMethod("int uncheckedIntCast(Object)");
View Full Code Here

    else
      doEmit(fn,cv);
  }

  public void doEmitStatic(ObjExpr fn, ClassVisitor cv){
    Method ms = new Method("invokeStatic", getReturnType(), argtypes);

    GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC + ACC_STATIC,
                                                ms,
                                                null,
                                                //todo don't hardwire this
                                                EXCEPTION_TYPES,
                                                cv);
    gen.visitCode();
    Label loopLabel = gen.mark();
    gen.visitLineNumber(line, loopLabel);
    try
      {
      Var.pushThreadBindings(RT.map(LOOP_LABEL, loopLabel, METHOD, this));
      emitBody(objx, gen, retClass, body);

      Label end = gen.mark();
      for(ISeq lbs = argLocals.seq(); lbs != null; lbs = lbs.next())
        {
        LocalBinding lb = (LocalBinding) lbs.first();
        gen.visitLocalVariable(lb.name, argtypes[lb.idx].getDescriptor(), null, loopLabel, end, lb.idx);
        }
      }
    finally
      {
      Var.popThreadBindings();
      }

    gen.returnValue();
    //gen.visitMaxs(1, 1);
    gen.endMethod();

  //generate the regular invoke, calling the static method
    Method m = new Method(getMethodName(), OBJECT_TYPE, getArgTypes());

    gen = new GeneratorAdapter(ACC_PUBLIC,
                               m,
                               null,
                               //todo don't hardwire this
View Full Code Here

  public void doEmitPrim(ObjExpr fn, ClassVisitor cv){
    Type returnType;
    if (retClass == double.class || retClass == long.class)
      returnType = getReturnType();
    else returnType = OBJECT_TYPE;
    Method ms = new Method("invokePrim", returnType, argtypes);

    GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC + ACC_FINAL,
                                                ms,
                                                null,
                                                //todo don't hardwire this
                                                EXCEPTION_TYPES,
                                                cv);
    gen.visitCode();

    Label loopLabel = gen.mark();
    gen.visitLineNumber(line, loopLabel);
    try
      {
      Var.pushThreadBindings(RT.map(LOOP_LABEL, loopLabel, METHOD, this));
      emitBody(objx, gen, retClass, body);

      Label end = gen.mark();
      gen.visitLocalVariable("this", "Ljava/lang/Object;", null, loopLabel, end, 0);
      for(ISeq lbs = argLocals.seq(); lbs != null; lbs = lbs.next())
        {
        LocalBinding lb = (LocalBinding) lbs.first();
        gen.visitLocalVariable(lb.name, argtypes[lb.idx-1].getDescriptor(), null, loopLabel, end, lb.idx);
        }
      }
    finally
      {
      Var.popThreadBindings();
      }

    gen.returnValue();
    //gen.visitMaxs(1, 1);
    gen.endMethod();

  //generate the regular invoke, calling the prim method
    Method m = new Method(getMethodName(), OBJECT_TYPE, getArgTypes());

    gen = new GeneratorAdapter(ACC_PUBLIC,
                               m,
                               null,
                               //todo don't hardwire this
View Full Code Here

    //gen.visitMaxs(1, 1);
    gen.endMethod();

  }
  public void doEmit(ObjExpr fn, ClassVisitor cv){
    Method m = new Method(getMethodName(), getReturnType(), getArgTypes());

    GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC,
                                                m,
                                                null,
                                                //todo don't hardwire this
View Full Code Here

TOP

Related Classes of clojure.asm.commons.Method

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.