Package clojure.asm.commons

Examples of clojure.asm.commons.Method


      for(int i = 0; i < params.length; i++)
        {
        argTypes[i] = Type.getType(params[i]);
        }

      Method target = new Method(m.getName(), Type.getType(m.getReturnType()), argTypes);

      for(Class retType : e.getValue())
        {
             Method meth = new Method(m.getName(), Type.getType(retType), argTypes);

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


      }
    return ret;
  }

  public void emit(ObjExpr obj, ClassVisitor cv){
    Method m = new Method(getMethodName(), getReturnType(), getArgTypes());

    Type[] extypes = null;
    if(exclasses.length > 0)
      {
      extypes = new Type[exclasses.length];
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

    //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

  abstract String getMethodName();
  abstract Type getReturnType();
  abstract Type[] getArgTypes();

  public void emit(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

      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

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

      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);
      }
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.