ClassData6.java

  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package org.jruby.ir.targets;

  6. import com.headius.invokebinder.Signature;
  7. import org.jruby.compiler.impl.SkinnyMethodAdapter;
  8. import org.jruby.ir.IRScope;
  9. import org.jruby.ir.runtime.IRRuntimeHelpers;
  10. import org.jruby.util.CodegenUtils;
  11. import org.objectweb.asm.ClassVisitor;
  12. import org.objectweb.asm.Opcodes;
  13. import org.objectweb.asm.Type;
  14. import org.objectweb.asm.commons.Method;

  15. import java.util.HashSet;
  16. import java.util.Set;
  17. import java.util.Stack;

  18. /**
  19.  *
  20.  * @author headius
  21.  */
  22. class ClassData6 extends ClassData {
  23.     public ClassData6(String clsName, ClassVisitor cls) {
  24.         super(clsName, cls);
  25.     }

  26.     public void pushmethod(String name, IRScope scope, Signature signature, boolean specificArity) {
  27.         Method m = new Method(name, Type.getType(signature.type().returnType()), IRRuntimeHelpers.typesFromSignature(signature));
  28.         SkinnyMethodAdapter adapter = new SkinnyMethodAdapter(cls, Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC, m.getName(), m.getDescriptor(), null, null);
  29.         methodStack.push(
  30.                 new MethodData(
  31.                         new IRBytecodeAdapter6(adapter, signature, this),
  32.                         scope,
  33.                         signature,
  34.                         specificArity ? scope.getStaticScope().getRequiredArgs() : -1)
  35.         );
  36.     }
  37. }