Package org.jruby.internal.runtime.methods.DynamicMethod

Examples of org.jruby.internal.runtime.methods.DynamicMethod.NativeCall


            if (callNode.callAdapter instanceof CachingCallSite) {
                CachingCallSite cacheSite = (CachingCallSite)callNode.callAdapter;
                if (cacheSite.isOptimizable()) {
                    CacheEntry entry = cacheSite.getCache();
                    if (entry.method.getNativeCall() != null) {
                        NativeCall nativeCall = entry.method.getNativeCall();

                        // only do direct calls for specific arity
                        if (argsCallback == null || argsCallback.getArity() >= 0 && argsCallback.getArity() <= 3) {
                            if (compileIntrinsic(context, callNode, cacheSite.methodName, entry.token, entry.method, receiverCallback, argsCallback, closureArg)) {
                                // intrinsic compilation worked, hooray!
View Full Code Here


   
    public static class JavaCallGenerator implements HandleGenerator {

        @Override
        public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) {
            NativeCall nativeCall = method.getNativeCall();
           
            if (nativeCall != null) {
                // has an explicit native call path

                if (nativeCall.isJava()) {
                    if (!Options.INVOKEDYNAMIC_INVOCATION_JAVA.load()) {
                        throw new IndirectBindingException("direct Java dispatch not enabled");
                    }

                    // if Java, must:
                    // * match arity <= 3
                    // * not be passed a block (no coercion yet)
                    // * be a normal wrapper around a class or module (not a Ruby subclass)
                    if (nativeCall.getNativeSignature().length != site.arity()
                            || site.arity() > 3
                            || site.isIterator()
                            || !cls.getJavaProxy()) {
                        throw new IndirectBindingException("Java call arity mismatch or > 3 args");
                    }
View Full Code Here

   
    public static class CoreCallGenerator implements HandleGenerator {

        @Override
        public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) {
            NativeCall nativeCall = method.getNativeCall();
           
            if (nativeCall != null) {
                int nativeArgCount = getNativeArgCount(method, method.getNativeCall());

                // arity must match or both be [] args
View Full Code Here

TOP

Related Classes of org.jruby.internal.runtime.methods.DynamicMethod.NativeCall

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.