Package clojure.asm.commons

Examples of clojure.asm.commons.Method


      if(context == C.RETURN)
        {
        FnMethod method = (FnMethod) METHOD.get();
        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


        {
        FnMethod method = (FnMethod) METHOD.get();
        method.emitClearLocals(gen);
        }
      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

        {
        FnMethod method = (FnMethod) METHOD.get();
        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)
      HostExpr.emitBoxReturn(fn, gen, method.getReturnType());
      }
    else
View Full Code Here

      else
        cv.visitField(ACC_PUBLIC + ACC_FINAL, lb.name, OBJECT_TYPE.getDescriptor(), null, null);
      }
    //ctor that takes closed-overs and inits base + fields
//    Method m = new Method("<init>", Type.VOID_TYPE, ARG_TYPES[closes.count()]);
    Method m = new Method("<init>", Type.VOID_TYPE, ctorTypes());
    GeneratorAdapter ctorgen = new GeneratorAdapter(ACC_PUBLIC,
                                                    m,
                                                    null,
                                                    null,
                                                    cv);
View Full Code Here

        fn.emitUnboxedLocal(gen, lb);
      else
        fn.emitLocal(gen, lb);
      }
//    gen.invokeConstructor(fntype, new Method("<init>", Type.VOID_TYPE, ARG_TYPES[closes.count()]));
    gen.invokeConstructor(fntype, new Method("<init>", Type.VOID_TYPE, ctorTypes()));
    if(context == C.STATEMENT)
      {
      gen.pop();
      }
  }
View Full Code Here

      Var.popThreadBindings();
      }
  }

  public void emit(FnExpr fn, ClassVisitor cv){
    Method m = new Method(isVariadic() ? "doInvoke" : "invoke",
                          OBJECT_TYPE, ARG_TYPES[numParams()]);

    GeneratorAdapter gen = new GeneratorAdapter(ACC_PUBLIC,
                                                m,
                                                null,
View Full Code Here

      if(context == C.RETURN)
        {
        FnMethod method = (FnMethod) METHOD.get();
        method.emitClearLocals(gen);
        }
      gen.invokeConstructor(type, new Method("<init>", Type.getConstructorDescriptor(ctor)));
      }
    else
      {
      gen.push(c.getName());
      gen.invokeStatic(RT_TYPE, forNameMethod);
View Full Code Here

      {
      FnMethod method = (FnMethod) METHOD.get();
      method.emitClearLocals(gen);
      }

    gen.invokeInterface(IFN_TYPE, new Method("invoke", OBJECT_TYPE, ARG_TYPES[Math.min(MAX_POSITIONAL_ARITY + 1,
                                                                                       args.count())]));
    if(context == C.STATEMENT)
      gen.pop();
  }
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);
        }
      }
    catch(Exception e)
      {
      throw Util.sneakyThrow(e);
      }
    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

    gen.endMethod();

  }

  public void doEmitPrim(ObjExpr fn, ClassVisitor cv){
    Method ms = new Method("invokePrim", getReturnType(), 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);
        }
      }
    catch(Exception e)
      {
      throw Util.sneakyThrow(e);
      }
    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

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.