Package java.lang.invoke

Examples of java.lang.invoke.MethodType


    public static CallSite getConstantBooleanBootstrap(Lookup lookup, String name, MethodType type, int scopeIndex) throws NoSuchMethodException, IllegalAccessException {
        RubyConstantCallSite site;

        site = new RubyConstantCallSite(type, name);
       
        MethodType fallbackType = methodType(boolean.class, RubyConstantCallSite.class, AbstractScript.class, ThreadContext.class, int.class);
        MethodHandle myFallback = insertArguments(
                lookup.findStatic(InvokeDynamicSupport.class, "constantBooleanFallback",
                fallbackType),
                0,
                site);
View Full Code Here


    public static CallSite getConstantBootstrap(Lookup lookup, String name, MethodType type, int scopeIndex) throws NoSuchMethodException, IllegalAccessException {
        RubyConstantCallSite site;

        site = new RubyConstantCallSite(type, name);
       
        MethodType fallbackType = methodType(IRubyObject.class, RubyConstantCallSite.class, AbstractScript.class, ThreadContext.class, int.class);
        MethodHandle myFallback = insertArguments(
                lookup.findStatic(InvokeDynamicSupport.class, "constantFallback",
                fallbackType),
                0,
                site);
View Full Code Here

    public static CallSite getConstantBooleanBootstrap(Lookup lookup, String name, MethodType type, int scopeIndex) throws NoSuchMethodException, IllegalAccessException {
        RubyConstantCallSite site;

        site = new RubyConstantCallSite(type, name);
       
        MethodType fallbackType = methodType(boolean.class, RubyConstantCallSite.class, AbstractScript.class, ThreadContext.class, int.class);
        MethodHandle myFallback = insertArguments(
                lookup.findStatic(InvokeDynamicSupport.class, "constantBooleanFallback",
                fallbackType),
                0,
                site);
View Full Code Here

   
    public static IRubyObject fixnumOperator(ThreadContext context, IRubyObject caller, IRubyObject self, JRubyCallSite site, long value) throws Throwable {
        String operator = site.name();
        String opMethod = MethodIndex.getFastFixnumOpsMethod(operator);
        String name = "fixnum_" + opMethod;
        MethodType type = methodType(IRubyObject.class, ThreadContext.class, IRubyObject.class, IRubyObject.class);
        MethodHandle target = null;
       
        if (operator.equals("+") || operator.equals("-")) {
            if (value == 1) {
                name += "_one";
                target = lookup().findStatic(MathLinker.class, name, type);
            } else if (value == 2) {
                name += "_two";
                target = lookup().findStatic(MathLinker.class, name, type);
            }
        }
       
        if (target == null) {
            type = type.insertParameterTypes(3, long.class);
            target = lookup().findStatic(MathLinker.class, name, type);
            target = insertArguments(target, 3, value);
        }

        MethodHandle fallback = lookup().findStatic(MathLinker.class, "fixnumOperatorFail",
View Full Code Here

   
    public static boolean fixnumBoolean(ThreadContext context, IRubyObject caller, IRubyObject self, JRubyCallSite site, long value) throws Throwable {
        String operator = site.name();
        String opMethod = MethodIndex.getFastFixnumOpsMethod(operator);
        String name = "fixnum_boolean_" + opMethod;
        MethodType type = methodType(boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class);
        MethodHandle target = null;
       
        if (target == null) {
            type = type.insertParameterTypes(3, long.class);
            target = lookup().findStatic(MathLinker.class, name, type);
            target = insertArguments(target, 3, value);
        }

        MethodHandle fallback = lookup().findStatic(MathLinker.class, "fixnumBooleanFail",
View Full Code Here

   
    public static IRubyObject floatOperator(ThreadContext context, IRubyObject caller, IRubyObject self, JRubyCallSite site, double value) throws Throwable {
        String operator = site.name();
        String opMethod = MethodIndex.getFastFixnumOpsMethod(operator);
        String name = "float_" + opMethod;
        MethodType type = methodType(IRubyObject.class, ThreadContext.class, IRubyObject.class, IRubyObject.class);
        MethodHandle target = null;
       
        if (target == null) {
            type = type.insertParameterTypes(3, double.class);
            target = lookup().findStatic(MathLinker.class, name, type);
            target = insertArguments(target, 3, value);
        }

        MethodHandle fallback = lookup().findStatic(MathLinker.class, "floatOperatorFail",
View Full Code Here

   
    public static IRubyObject fixnumOperator(ThreadContext context, IRubyObject caller, IRubyObject self, JRubyCallSite site, long value) throws Throwable {
        String operator = site.name();
        String opMethod = MethodIndex.getFastFixnumOpsMethod(operator);
        String name = "fixnum_" + opMethod;
        MethodType type = methodType(IRubyObject.class, ThreadContext.class, IRubyObject.class, IRubyObject.class);
        MethodHandle target = null;
       
        if (operator.equals("+") || operator.equals("-")) {
            if (value == 1) {
                name += "_one";
                target = lookup().findStatic(MathLinker.class, name, type);
            } else if (value == 2) {
                name += "_two";
                target = lookup().findStatic(MathLinker.class, name, type);
            }
        }
       
        if (target == null) {
            type = type.insertParameterTypes(3, long.class);
            target = lookup().findStatic(MathLinker.class, name, type);
            target = insertArguments(target, 3, value);
        }

        MethodHandle fallback = lookup().findStatic(MathLinker.class, "fixnumOperatorFail",
View Full Code Here

   
    public static boolean fixnumBoolean(ThreadContext context, IRubyObject caller, IRubyObject self, JRubyCallSite site, long value) throws Throwable {
        String operator = site.name();
        String opMethod = MethodIndex.getFastFixnumOpsMethod(operator);
        String name = "fixnum_boolean_" + opMethod;
        MethodType type = methodType(boolean.class, ThreadContext.class, IRubyObject.class, IRubyObject.class);
        MethodHandle target = null;
       
        if (target == null) {
            type = type.insertParameterTypes(3, long.class);
            target = lookup().findStatic(MathLinker.class, name, type);
            target = insertArguments(target, 3, value);
        }

        MethodHandle fallback = lookup().findStatic(MathLinker.class, "fixnumBooleanFail",
View Full Code Here

   
    public static IRubyObject floatOperator(ThreadContext context, IRubyObject caller, IRubyObject self, JRubyCallSite site, double value) throws Throwable {
        String operator = site.name();
        String opMethod = MethodIndex.getFastFixnumOpsMethod(operator);
        String name = "float_" + opMethod;
        MethodType type = methodType(IRubyObject.class, ThreadContext.class, IRubyObject.class, IRubyObject.class);
        MethodHandle target = null;
       
        if (target == null) {
            type = type.insertParameterTypes(3, double.class);
            target = lookup().findStatic(MathLinker.class, name, type);
            target = insertArguments(target, 3, value);
        }

        MethodHandle fallback = lookup().findStatic(MathLinker.class, "floatOperatorFail",
View Full Code Here

        if (mh == null) {
//            System.out.println(site.type());

            // use DynamicMethod binding
            MethodType type2 = site.type()
                    .insertParameterTypes(2, RubyModule.class, String.class)
                    .insertParameterTypes(0, DynamicMethod.class);
            mh = Binder.from(site.type())
                    .insert(2, selfClass, site.name)
//                    .printType()
View Full Code Here

TOP

Related Classes of java.lang.invoke.MethodType

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.