Package org.objectweb.asm

Examples of org.objectweb.asm.MethodVisitor.visitCode()


  }
 

  private void writeMainMethod(ClassWriter cw) {
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
    mv.visitCode();
    mv.visitMethodInsn(INVOKESTATIC, "org/renjin/eval/Context", "newTopLevelContext", "()Lorg/renjin/Context;");
    mv.visitVarInsn(ASTORE, 1);

   
   
View Full Code Here


    return cw.toByteArray();
  }

  private static void writeInit(ClassWriter cw) {
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, THIS);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
    mv.visitInsn(RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();   
View Full Code Here

  }

  private static void writeLoadMethod(ClassWriter cw, String packageName, Environment rho) {
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "load",
        "(Lorg/renjin/eval/Context;Lorg/renjin/sexp/Environment;)V", null, null);
    mv.visitCode();

    for(Symbol symbol : rho.getSymbolNames()) {
      SEXP value = rho.getVariable(symbol);
      try {
        if(value instanceof Closure) {
View Full Code Here

    }
  }

  private void writeConstructor() {
    MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
    mv.visitInsn(RETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();
View Full Code Here

  }

  private void writeConstructor() {

    MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, "<init>", "(Lorg/renjin/sexp/Environment;)V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitMethodInsn(INVOKESTATIC, generationContext.getClassName(), "createFormals", "()Lorg/renjin/sexp/PairList;");
    mv.visitMethodInsn(INVOKESTATIC, generationContext.getClassName(), "createBody", "()Lorg/renjin/sexp/SEXP;");
    mv.visitMethodInsn(INVOKESPECIAL, "org/renjin/sexp/Closure", "<init>", "(Lorg/renjin/sexp/Environment;Lorg/renjin/sexp/PairList;Lorg/renjin/sexp/SEXP;)V");
View Full Code Here

  }

  private void writeDoEval() {
    MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, "doApply",
        "(Lorg/renjin/eval/Context;)Lorg/renjin/sexp/SEXP;", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 1);
    mv.visitMethodInsn(INVOKEVIRTUAL, "org/renjin/eval/Context", "getEnvironment", "()Lorg/renjin/sexp/Environment;");
    mv.visitVarInsn(ASTORE, 2);

    writeDoEvalBody(mv);
View Full Code Here

 
  private void writeFormals() {
 
    MethodVisitor mv = cv.visitMethod(ACC_PRIVATE + ACC_STATIC,
        "createFormals", "()Lorg/renjin/sexp/PairList;", null, null);
    mv.visitCode();
   
    ConstantGeneratingVisitor cgv = new ConstantGeneratingVisitor(mv);
    closure.getFormals().accept(cgv);
    mv.visitInsn(ARETURN);
    mv.visitMaxs(1, 0);
View Full Code Here

  private void writeBodySexp() {

    MethodVisitor mv = cv.visitMethod(ACC_PRIVATE + ACC_STATIC,
        "createBody", "()Lorg/renjin/sexp/SEXP;", null, null);
    mv.visitCode();
    ConstantGeneratingVisitor cgv = new ConstantGeneratingVisitor(mv);
    closure.getBodyExpression().accept(cgv);
    mv.visitInsn(ARETURN);
    mv.visitMaxs(1, 0);
    mv.visitEnd();
View Full Code Here

  }

  private void writeConstructor() {
    MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "(Lorg/renjin/eval/Context;Lorg/renjin/sexp/Environment;)V", null, null);
    mv.visitCode();
    mv.visitVarInsn(ALOAD, 0);
    mv.visitVarInsn(ALOAD, 1);
    mv.visitVarInsn(ALOAD, 2);
    mv.visitMethodInsn(INVOKESTATIC, generationContext.getClassName(), "createSexp", "()Lorg/renjin/sexp/SEXP;");
    mv.visitMethodInsn(INVOKESPECIAL, "org/renjin/sexp/Promise", "<init>", "(Lorg/renjin/eval/Context;Lorg/renjin/sexp/Environment;Lorg/renjin/sexp/SEXP;)V");
View Full Code Here

    mv.visitEnd();
  }

  private void writeStaticDoEval() { 
    MethodVisitor mv = cv.visitMethod(ACC_PUBLIC + ACC_STATIC, "doEval", "(Lorg/renjin/eval/Context;Lorg/renjin/sexp/Environment;)Lorg/renjin/sexp/SEXP;", null, null);
    mv.visitCode();
    writeDoEvalBody(mv);
    mv.visitInsn(ARETURN);
    mv.visitMaxs(1, 1);
    mv.visitEnd();
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.