Package java.lang.invoke

Examples of java.lang.invoke.MethodHandle.bindTo()


            handle = lookup.findStatic(InvokeDynamicSupport.class, "getGlobalFallback", methodType(IRubyObject.class, GlobalSite.class, ThreadContext.class));
        } else {
            throw new RuntimeException("invalid variable access type");
        }
       
        handle = handle.bindTo(site);
        site.setTarget(handle);
       
        return site;
    }
View Full Code Here


            handle = lookup.findStatic(InvokeDynamicSupport.class, "getGlobalBooleanFallback", methodType(boolean.class, GlobalSite.class, ThreadContext.class));
        } else {
            throw new RuntimeException("invalid variable access type");
        }
       
        handle = handle.bindTo(site);
        site.setTarget(handle);
       
        return site;
    }
View Full Code Here

           
            // use uncached logic forever
            if (Options.INVOKEDYNAMIC_LOG_GLOBALS.load()) LOG.info("global " + site.name() + " (" + site.file() + ":" + site.line() + ") rebound > " + Options.INVOKEDYNAMIC_GLOBAL_MAXFAIL.load() + " times, reverting to simple lookup");
           
            MethodHandle uncached = lookup().findStatic(InvokeDynamicSupport.class, "getGlobalUncached", methodType(IRubyObject.class, GlobalVariable.class));
            uncached = uncached.bindTo(variable);
            uncached = dropArguments(uncached, 0, ThreadContext.class);
            site.setTarget(uncached);
            return (IRubyObject)uncached.invokeWithArguments(context);
        }
       
View Full Code Here

        IRubyObject value = variable.getAccessor().getValue();
       
        MethodHandle target = constant(IRubyObject.class, value);
        target = dropArguments(target, 0, ThreadContext.class);
        MethodHandle fallback = lookup().findStatic(InvokeDynamicSupport.class, "getGlobalFallback", methodType(IRubyObject.class, GlobalSite.class, ThreadContext.class));
        fallback = fallback.bindTo(site);
       
        target = ((SwitchPoint)invalidator.getData()).guardWithTest(target, fallback);
       
        site.setTarget(target);
       
View Full Code Here

        boolean value = variable.getAccessor().getValue().isTrue();
       
        MethodHandle target = constant(boolean.class, value);
        target = dropArguments(target, 0, ThreadContext.class);
        MethodHandle fallback = lookup().findStatic(InvokeDynamicSupport.class, "getGlobalBooleanFallback", methodType(boolean.class, GlobalSite.class, ThreadContext.class));
        fallback = fallback.bindTo(site);
       
        target = ((SwitchPoint)invalidator.getData()).guardWithTest(target, fallback);
       
        site.setTarget(target);
       
View Full Code Here

    public static CallSite checkpointBootstrap(Lookup lookup, String name, MethodType type) throws Throwable {
        MutableCallSite site = new MutableCallSite(type);
        MethodHandle handle = lookup.findStatic(InvokeDynamicSupport.class, "checkpointFallback", methodType(void.class, MutableCallSite.class, ThreadContext.class));
       
        handle = handle.bindTo(site);
        site.setTarget(handle);
       
        return site;
    }
   
View Full Code Here

       
        MethodHandle target = Binder
                .from(void.class, ThreadContext.class)
                .nop();
        MethodHandle fallback = lookup().findStatic(InvokeDynamicSupport.class, "checkpointFallback", methodType(void.class, MutableCallSite.class, ThreadContext.class));
        fallback = fallback.bindTo(site);
       
        target = ((SwitchPoint)invalidator.getData()).guardWithTest(target, fallback);
       
        site.setTarget(target);
    }
View Full Code Here

        }

        nativeTarget = Binder.from(site.type())
                .drop(1, 1)
                .insert(2, method.getImplementationClass(), site.name())
                .invoke(nativeTarget.bindTo(method));

        method.setHandle(nativeTarget);
        if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) LOG.info(site.name() + "\tbound to ffi method "
                + logMethod(method) + ": "
                + IRubyObject.class.getSimpleName() + " "
View Full Code Here

    public static CallSite performBootstrap(MethodHandles.Lookup lookup, String name, MethodType methodType) throws Throwable {
        SmalltalkCallSite site = new SmalltalkCallSite(methodType, lookup);

        MethodHandle target = lookup.findStatic(IndyBootstrap.class, name, methodType.insertParameterTypes(0, SmalltalkCallSite.class));
        target = target.bindTo(site);
        site.setTarget(target);

        return site;
    }
View Full Code Here

            if (optimize && !function.isDeterministic()) {
                return new FunctionCall(node.getName(), node.getWindow().orNull(), node.isDistinct(), toExpressions(argumentValues));
            }
            MethodHandle handle = function.getScalarFunction();
            if (handle.type().parameterCount() > 0 && handle.type().parameterType(0) == Session.class) {
                handle = handle.bindTo(session);
            }
            try {
                return handle.invokeWithArguments(argumentValues);
            }
            catch (Throwable throwable) {
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.