public GuardBuilder collect(int index, Class type) { binder = binder.collect(index, type); return this; }
public static CallSite array(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(type) .collect(1, IRubyObject[].class) .invokeStaticQuiet(MethodHandles.lookup(), Bootstrap.class, "array"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite array(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(type) .collect(1, IRubyObject[].class) .invokeStaticQuiet(MethodHandles.lookup(), Bootstrap.class, "array"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite kwargsHash(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(lookup, type) .collect(2, IRubyObject[].class) .invokeStaticQuiet(LOOKUP, Bootstrap.class, "kwargsHash"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite array(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(type) .collect(1, IRubyObject[].class) .invokeStaticQuiet(LOOKUP, Bootstrap.class, "array"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite kwargsHash(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(lookup, type) .collect(2, IRubyObject[].class) .invokeStaticQuiet(LOOKUP, Bootstrap.class, "kwargsHash"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite hash(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(lookup, type) .collect(1, IRubyObject[].class) .invokeStaticQuiet(LOOKUP, Bootstrap.class, "hash"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite hash(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(lookup, type) .collect(1, IRubyObject[].class) .invokeStaticQuiet(LOOKUP, Bootstrap.class, "hash"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite array(Lookup lookup, String name, MethodType type) { MethodHandle handle = Binder .from(type) .collect(1, IRubyObject[].class) .invokeStaticQuiet(LOOKUP, Bootstrap.class, "array"); CallSite site = new ConstantCallSite(handle); return site; }
private Binder preparePermuteBinder(Permutes permutes) { return Binder.from(source) .permute(permutes.movePermute) .collect(source.parameterCount() - count, arrayType) .permute(permutes.moveBackPermute); }
/** * Collect arguments matching namePattern into an trailing array argument * named outName. * * The namePattern is a standard regular expression. * * @param outName the name of the new array argument * @param namePattern a pattern with which to match arguments for collecting * @return a new SmartBinder with the collect applied */ public SmartBinder collect(String outName, String namePattern) { int index = signature().argOffsets(namePattern); assert index >= 0 : "no arguments matching " + namePattern + " found in signature " + signature(); Signature newSignature = signature().collect(outName, namePattern); return new SmartBinder(this, newSignature, binder.collect(index, signature().argCount() - (newSignature.argCount() - 1), Array.newInstance(signature().argType(index), 0).getClass())); }
public MethodHandle possiblyDebugGuard(Entry entry, int position, MethodHandle input) throws NoSuchMethodException, IllegalAccessException { if (!debug) { return input; } MethodHandle debugMh = MethodHandles.lookup() .findStatic(LinkPlan.class, "debugGuard", MethodType.methodType(boolean.class, LinkPlan.class, LinkPlan.Entry.class, int.class, MethodHandle.class, Object[].class)); debugMh = Binder.from(input.type()) .convert(input.type().erase()) .collect(0, Object[].class) .insert(0, input) .insert(0, position) .insert(0, entry) .insert(0, this) .invoke(debugMh); return debugMh; }
public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type, int unwrap) throws Throwable { YieldSite site = new YieldSite(type, unwrap == 1 ? true : false); MethodHandle handle; switch (name) { case "yield": case "yieldSpecific": handle = Binder.from(type) .prepend(YieldSite.class, site) .invokeVirtual(lookup, name); break; case "yieldValues": handle = Binder.from(type) .collect(2, IRubyObject[].class) .prepend(YieldSite.class, site) .invokeVirtual(lookup, name); break; default: throw new RuntimeException("invalid yield type: " + name); } site.setTarget(handle); return site; }
public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type, int unwrap) throws Throwable { YieldSite site = new YieldSite(type, unwrap == 1 ? true : false); MethodHandle handle; switch (name) { case "yield": case "yieldSpecific": handle = Binder.from(type) .prepend(YieldSite.class, site) .invokeVirtual(lookup, name); break; case "yieldValues": handle = Binder.from(type) .collect(2, IRubyObject[].class) .prepend(YieldSite.class, site) .invokeVirtual(lookup, name); break; default: throw new RuntimeException("invalid yield type: " + name); } site.setTarget(handle); return site; }
public LinkPlan(RephractLinker linker, MutableCallSite callSite, Lookup lookup, String name, MethodType type, Location location) throws NoSuchMethodException, IllegalAccessException { this.linker = linker; this.callSite = callSite; this.lookup = lookup; this.name = name; this.type = type; this.location = location; this.relink = Binder.from(this.type) .convert(this.type.erase()) .collect(0, Object[].class) .convert(Object.class, Object[].class) .insert(0, this) .invoke(LINK_INVOCATION); determineOperations(); replan(null, null, null, null); }