public static CallSite variableBootstrap(Lookup lookup, String name, MethodType type, String file, int line) throws Throwable { String[] names = name.split(":"); String operation = names[0]; String varName = names[1]; VariableSite site = new VariableSite(type, varName, file, line); MethodHandle handle; if (operation.equals("get")) { handle = lookup.findStatic(InvokeDynamicSupport.class, "getVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class)); } else if (operation.equals("set")) { handle = lookup.findStatic(InvokeDynamicSupport.class, "setVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class, IRubyObject.class)); } else { throw new RuntimeException("invalid variable access type"); } handle = handle.bindTo(site); site.setTarget(handle); return site; }
public static CallSite variableBootstrap(Lookup lookup, String name, MethodType type, String file, int line) throws Throwable { String[] names = name.split(":"); String operation = names[0]; String varName = names[1]; VariableSite site = new VariableSite(type, varName, file, line); MethodHandle handle; if (operation.equals("get")) { handle = lookup.findStatic(InvokeDynamicSupport.class, "getVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class)); } else if (operation.equals("set")) { handle = lookup.findStatic(InvokeDynamicSupport.class, "setVariableFallback", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class, IRubyObject.class)); } else { throw new RuntimeException("invalid variable access type"); } handle = handle.bindTo(site); site.setTarget(handle); return site; }
public static CallSite ivar(MethodHandles.Lookup lookup, String name, MethodType type) throws Throwable { String[] names = name.split(":"); String operation = names[0]; String varName = names[1]; VariableSite site = new VariableSite(type, varName, "noname", 0); MethodHandle handle; handle = lookup.findVirtual(VariableSite.class, operation, type); handle = handle.bindTo(site); site.setTarget(handle.asType(site.type())); return site; }
public static CallSite ivar(MethodHandles.Lookup lookup, String name, MethodType type) throws Throwable { String[] names = name.split(":"); String operation = names[0]; String varName = names[1]; VariableSite site = new VariableSite(type, varName, "noname", 0); MethodHandle handle; handle = lookup.findVirtual(VariableSite.class, operation, type); handle = handle.bindTo(site); site.setTarget(handle.asType(site.type())); return site; }
public static CallSite ivar(Lookup lookup, String name, MethodType type) throws Throwable { String[] names = name.split(":"); String operation = names[0]; String varName = names[1]; VariableSite site = new VariableSite(type, varName, "noname", 0); MethodHandle handle; handle = lookup.findStatic(Bootstrap.class, operation, type.insertParameterTypes(0, VariableSite.class)); handle = handle.bindTo(site); site.setTarget(handle.asType(site.type())); return site; }
public static CallSite ivar(Lookup lookup, String name, MethodType type) throws Throwable { String[] names = name.split(":"); String operation = names[0]; String varName = names[1]; VariableSite site = new VariableSite(type, varName, "noname", 0); MethodHandle handle; handle = lookup.findStatic(Bootstrap.class, operation, type.insertParameterTypes(0, VariableSite.class)); handle = handle.bindTo(site); site.setTarget(handle.asType(site.type())); return site; }
site.setTarget(setValue);
fallback = findStatic(InvokeDynamicSupport.class, "setVariableFail", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class, IRubyObject.class)); fallback = fallback.bindTo(site); site.setTarget(fallback); return (IRubyObject)fallback.invokeWithArguments(self, value); } else { site.setTarget(setValue);
site.setTarget(getValue);
fallback = findStatic(InvokeDynamicSupport.class, "setVariableFail", methodType(IRubyObject.class, VariableSite.class, IRubyObject.class, IRubyObject.class)); fallback = fallback.bindTo(site); site.setTarget(fallback); return (IRubyObject)fallback.invokeWithArguments(self, value); } else { site.setTarget(setValue);