Package java.lang.invoke

Examples of java.lang.invoke.ConstantCallSite


            } else {
                return null;
            }

            MethodHandle methodHandle = lookup.unreflect(m);
            CallSite callSite = new ConstantCallSite(methodHandle);
            return callSite.dynamicInvoker();

        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here


        @Override
        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<ByteCodeNode> arguments)
        {
            MethodHandle methodHandle = inMethod.bindTo(constantValues);
            methodHandle = methodHandle.asType(MethodType.methodType(boolean.class, valueType));
            return new FunctionBinding(bindingId, name, new ConstantCallSite(methodHandle), arguments, false);
        }
View Full Code Here

    }

    public FunctionBinding bindConstant(Object constant, Class<?> type)
    {
        long bindingId = NEXT_BINDING_ID.getAndIncrement();
        ConstantCallSite callsite = new ConstantCallSite(MethodHandles.constant(type, constant));
        bindings.put(bindingId, callsite);
        return new FunctionBinding(bindingId, "constant_" + bindingId, callsite, ImmutableList.<ByteCodeNode>of(), true);
    }
View Full Code Here

    public static CallSite getByteListBootstrap(Lookup lookup, String name, MethodType type, String asString, String encodingName) {
        byte[] bytes = Helpers.stringToRawBytes(asString);
        Encoding encoding = EncodingDB.getEncodings().get(encodingName.getBytes()).getEncoding();
        ByteList byteList = new ByteList(bytes, encoding);
       
        return new ConstantCallSite(constant(ByteList.class, byteList));
    }
View Full Code Here

            case 'S':
                callSite = MethodIndex.getSuperCallSite();
                break;
        }
       
        return new ConstantCallSite(constant(org.jruby.runtime.CallSite.class, callSite));
    }
View Full Code Here

    }

    public static CallSite getBigIntegerBootstrap(Lookup lookup, String name, MethodType type, String asString) {
        BigInteger byteList = new BigInteger(asString, 16);
       
        return new ConstantCallSite(constant(BigInteger.class, byteList));
    }
View Full Code Here

    private SliceLiteralBootstrap() {}

    public static CallSite bootstrap(Lookup lookup, String name, MethodType type, String value)
    {
        return new ConstantCallSite(constant(Slice.class, Slices.copiedBuffer(value, Charsets.UTF_8)));
    }
View Full Code Here

            if (escapeNode == null) {
                methodHandle = MethodHandles.insertArguments(methodHandle, 2, (Object) null);
            }
        }

        CallSite callSite = new ConstantCallSite(methodHandle);
        return new FunctionBinding(bindingId, name, callSite, arguments, false);
    }
View Full Code Here

                unboundArguments.add(argument);
                argIndex++;
            }
        }

        CallSite callSite = new ConstantCallSite(methodHandle);
        return new FunctionBinding(bindingId, name, callSite, unboundArguments.build(), nullable);
    }
View Full Code Here

        @Override
        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<ByteCodeNode> arguments)
        {
            MethodHandle methodHandle = inMethod.bindTo(constantValues);
            methodHandle = methodHandle.asType(MethodType.methodType(boolean.class, valueType));
            return new FunctionBinding(bindingId, name, new ConstantCallSite(methodHandle), arguments, false);
        }
View Full Code Here

TOP

Related Classes of java.lang.invoke.ConstantCallSite

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.