public static CallSite string(Lookup lookup, String name, MethodType type, String value, int encoding) { MethodHandle handle = Binder .from(IRubyObject.class, ThreadContext.class) .insert(0, new Class[]{String.class, int.class}, value, encoding) .invokeStaticQuiet(MethodHandles.lookup(), Bootstrap.class, "string"); CallSite site = new ConstantCallSite(handle); return site; }
public static CallSite inheritanceSearchConst(Lookup lookup, String name, MethodType type) { MutableCallSite site = new MutableCallSite(type); String[] bits = name.split(":"); String constName = bits[1]; MethodHandle handle = Binder .from(type) .insert(0, site, constName) .invokeStaticQuiet(MethodHandles.lookup(), Bootstrap.class, "inheritanceSearchConst"); site.setTarget(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; }
/** * Process the incoming arguments by calling the given static method on the * given class, inserting the result as the first argument. * * @param lookup the java.lang.invoke.MethodHandles.Lookup to use * @param target the class on which the method is defined * @param method the method to invoke on the first argument * @return a new Binder */ public Binder foldStatic(MethodHandles.Lookup lookup, Class<?> target, String method) { return fold(Binder.from(type()).invokeStaticQuiet(lookup, target, method)); }
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 symbol(Lookup lookup, String name, MethodType type, String sym) { MutableCallSite site = new MutableCallSite(type); MethodHandle handle = Binder .from(IRubyObject.class, ThreadContext.class) .insert(0, site, sym) .invokeStaticQuiet(MethodHandles.lookup(), Bootstrap.class, "symbol"); site.setTarget(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; }
public static CallSite fixnum(Lookup lookup, String name, MethodType type, long value) { MutableCallSite site = new MutableCallSite(type); MethodHandle handle = Binder .from(IRubyObject.class, ThreadContext.class) .insert(0, site, value) .cast(IRubyObject.class, MutableCallSite.class, long.class, ThreadContext.class) .invokeStaticQuiet(MethodHandles.lookup(), Bootstrap.class, "fixnum"); site.setTarget(handle); return site; }
public static CallSite flote(Lookup lookup, String name, MethodType type, double value) { MutableCallSite site = new MutableCallSite(type); MethodHandle handle = Binder .from(IRubyObject.class, ThreadContext.class) .insert(0, site, value) .cast(IRubyObject.class, MutableCallSite.class, double.class, ThreadContext.class) .invokeStaticQuiet(MethodHandles.lookup(), Bootstrap.class, "flote"); site.setTarget(handle); return site; }
public static CallSite contextValue(Lookup lookup, String name, MethodType type) { MutableCallSite site = new MutableCallSite(type); site.setTarget(Binder.from(type).append(site).invokeStaticQuiet(lookup, Bootstrap.class, name)); return site; }
public static CallSite contextValueString(Lookup lookup, String name, MethodType type, String str) { MutableCallSite site = new MutableCallSite(type); site.setTarget(Binder.from(type).append(site, str).invokeStaticQuiet(lookup, Bootstrap.class, name)); return site; }
public static CallSite contextValueString(Lookup lookup, String name, MethodType type, String str) { MutableCallSite site = new MutableCallSite(type); site.setTarget(Binder.from(type).append(site, str).invokeStaticQuiet(lookup, Bootstrap.class, name)); return site; }
public boolean init(IRubyObject obj) { IRubyObject nil = obj.getRuntime().getNil(); setTarget( Binder.from(type()) .insert(0, RubyNil.class, nil) .invokeStaticQuiet(LOOKUP, IsNilSite.class, "isNil") ); return nil == obj; }
public static CallSite fstring(Lookup lookup, String name, MethodType type, String value, String encodingName, int cr, String file, int line) { MutableCallSite site = new MutableCallSite(type); Binder binder = Binder .from(RubyString.class, ThreadContext.class) .insert(0, arrayOf(MutableCallSite.class, ByteList.class, int.class, String.class, int.class), site, bytelist(value, encodingName), cr, file, line); site.setTarget(binder.invokeStaticQuiet(lookup, Bootstrap.class, "frozenString")); return site; }
public static CallSite string(Lookup lookup, String name, MethodType type, String value, String encodingName, int cr) { MutableCallSite site = new MutableCallSite(type); Binder binder = Binder .from(RubyString.class, ThreadContext.class) .insert(0, arrayOf(MutableCallSite.class, ByteList.class, int.class), site, bytelist(value, encodingName), cr); site.setTarget(binder.invokeStaticQuiet(lookup, Bootstrap.class, "string")); return site; }
public static CallSite string(Lookup lookup, String name, MethodType type, String value, String encodingName, int cr) { MutableCallSite site = new MutableCallSite(type); Binder binder = Binder .from(RubyString.class, ThreadContext.class) .insert(0, arrayOf(MutableCallSite.class, ByteList.class, int.class), site, bytelist(value, encodingName), cr); site.setTarget(binder.invokeStaticQuiet(lookup, Bootstrap.class, "string")); return site; }
public static CallSite fstring(Lookup lookup, String name, MethodType type, String value, String encodingName, int cr, String file, int line) { MutableCallSite site = new MutableCallSite(type); Binder binder = Binder .from(RubyString.class, ThreadContext.class) .insert(0, arrayOf(MutableCallSite.class, ByteList.class, int.class, String.class, int.class), site, bytelist(value, encodingName), cr, file, line); site.setTarget(binder.invokeStaticQuiet(lookup, Bootstrap.class, "frozenString")); return site; }
public boolean init(IRubyObject obj) { Ruby runtime = obj.getRuntime(); IRubyObject nil = runtime.getNil(); IRubyObject fals = runtime.getFalse(); setTarget( Binder.from(type()) .insert(0, RubyBoolean.False.class, fals) .insert(0, RubyNil.class, nil) .invokeStaticQuiet(LOOKUP, IsTrueSite.class, "isTruthy") ); return nil != obj && fals != obj; }