Example usage for org.objectweb.asm.commons Method getMethod

List of usage examples for org.objectweb.asm.commons Method getMethod

Introduction

In this page you can find the example usage for org.objectweb.asm.commons Method getMethod.

Prototype

public static Method getMethod(final String method) 

Source Link

Document

Returns a Method corresponding to the given Java method declaration.

Usage

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyBlock_invokeNoArg(boolean is_in_block) {
    invokeVirtual(Types.RUBY_BLOCK_TYPE,
            Method.getMethod("com.xruby.runtime.lang.RubyValue invoke(com.xruby.runtime.lang.RubyValue)"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyBlock_invokeOneArg(boolean is_in_block) {
    invokeVirtual(Types.RUBY_BLOCK_TYPE, Method.getMethod(
            "com.xruby.runtime.lang.RubyValue invoke(com.xruby.runtime.lang.RubyValue, com.xruby.runtime.lang.RubyValue)"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyBlock_invoke(boolean is_in_block) {
    invokeVirtual(Types.RUBY_BLOCK_TYPE, Method.getMethod(
            "com.xruby.runtime.lang.RubyValue invoke(com.xruby.runtime.lang.RubyValue, com.xruby.runtime.builtin.RubyArray)"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyValue_getRubyClass() {
    invokeVirtual(Types.RUBY_VALUE_TYPE, Method.getMethod("com.xruby.runtime.lang.RubyClass getRubyClass()"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyValue_getSingletonClass() {
    invokeVirtual(Types.RUBY_VALUE_TYPE, Method.getMethod(
            "com.xruby.runtime.lang.RubyClass getSingletonClass(com.xruby.runtime.lang.RubyModule)"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyValue_getInstanceVariable(String name) {
    //push(name);
    RubyIDClassGenerator.getField(this, name);
    invokeVirtual(Types.RUBY_VALUE_TYPE, Method
            .getMethod("com.xruby.runtime.lang.RubyValue getInstanceVariable(com.xruby.runtime.lang.RubyID)"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyValue_setInstanceVariable(String name) {
    RubyIDClassGenerator.getField(this, name);
    //push(name);
    invokeVirtual(Types.RUBY_VALUE_TYPE, Method.getMethod(
            "com.xruby.runtime.lang.RubyValue setInstanceVariable(com.xruby.runtime.lang.RubyValue, com.xruby.runtime.lang.RubyID)"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void MethodBlockBase_getScope() {
    invokeVirtual(Types.METHOD_BLOCK_BASE_TYPE,
            Method.getMethod("com.xruby.runtime.lang.RubyModule getScope()"));
}

From source file:com.xruby.compiler.codegen.MethodGenerator.java

License:BSD License

public void RubyProc_isDefinedInAnotherBlock() {
    invokeVirtual(Types.RUBY_PROC_TYPE, Method.getMethod("boolean isDefinedInAnotherBlock()"));
}

From source file:com.xruby.compiler.codegen.RubyIDClassGenerator.java

License:BSD License

private static byte[] visitEnd() {
    ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
    cw.visit(Opcodes.V1_1, Opcodes.ACC_PUBLIC, RubyIDClassName, null, "java/lang/Object", null);
    Method staticBlock = Method.getMethod("void <clinit> ()V");
    GeneratorAdapter staticBlockMg = new GeneratorAdapter(Opcodes.ACC_STATIC, staticBlock, null, null, cw);

    for (Map.Entry<String, String> e : idMap.entrySet()) {
        cw.visitField(Opcodes.ACC_PUBLIC + Opcodes.ACC_STATIC, e.getValue(), Types.RUBY_ID_TYPE.getDescriptor(),
                null, null);//from   w  w  w  .j a  v a  2 s.  com

        staticBlockMg.push(e.getKey());
        staticBlockMg.invokeStatic(Type.getType(RubyID.class),
                Method.getMethod("com.xruby.runtime.lang.RubyID intern(String)"));
        staticBlockMg.putStatic(Type.getType("L" + RubyIDClassName + ";"), e.getValue(), Types.RUBY_ID_TYPE);
    }

    staticBlockMg.returnValue();
    staticBlockMg.endMethod();
    cw.visitEnd();

    clear();

    return cw.toByteArray();
}