Package java.lang.invoke

Examples of java.lang.invoke.ConstantCallSite


            Map<Long, MethodHandle> bindings = (Map<Long, MethodHandle>) handle.invokeExact();
            checkNotNull(bindings, "'callSites' field in %s is null", callerLookup.lookupClass().getName());

            MethodHandle method = bindings.get(bindingId);
            checkArgument(method != null, "Binding %s for function %s%s not found", bindingId, name, type.parameterList());
            return new ConstantCallSite(method);
        }
        catch (Throwable e) {
            if (e instanceof InterruptedException) {
                Thread.currentThread().interrupt();
            }
View Full Code Here


    public static CallSite bootstrap(MethodHandles.Lookup callerLookup, String name, MethodType type, String prefix)
            throws Exception
    {
        MethodHandle methodHandle = callerLookup.findVirtual(String.class, "concat", MethodType.methodType(String.class, String.class));
        methodHandle = methodHandle.bindTo(name + "-" + prefix + "-");
        return new ConstantCallSite(methodHandle);
    }
View Full Code Here

            DynamicClassLoader dynamicClassLoader = (DynamicClassLoader) classLoader;
            MethodHandle target = dynamicClassLoader.getCallsiteBindings().get(bindingId);
            checkArgument(target != null, "Binding %s for function %s%s not found", bindingId, name, type.parameterList());

            return new ConstantCallSite(target);
        }
        catch (Throwable e) {
            if (e instanceof InterruptedException) {
                Thread.currentThread().interrupt();
            }
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

        @Override
        public FunctionBinding bindFunction(long bindingId, String name, ByteCodeNode getSessionByteCode, List<TypedByteCodeNode> 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 static java.lang.invoke.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

      Object arg) {
    System.out.println("construct the BigDecimal constant " + arg);

    // return a trivial constant callsite, with a constant method handle as its
    // target
    return new ConstantCallSite(MethodHandles.constant(BigDecimal.class,
        new BigDecimal(arg.toString())));
  }
View Full Code Here

              parameters.size() + 1, method.isVarArgs());
        }
        if (method.getReturnType() == Void.class) {
          newType = newType.changeReturnType(void.class);
        }
        methodHandle = new ConstantCallSite(MethodHandles.lookup()
            .unreflect(method).asType(newType)
            .asSpreader(Object[].class, newType.parameterCount()))
            .dynamicInvoker();
      }
    }
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.