@Override public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) { if (method instanceof AttrWriterMethod) { // attr writer if (!RubyInstanceConfig.INVOKEDYNAMIC_ATTR) { throw new IndirectBindingException("direct attribute dispatch not enabled"); } if (site.arity() != 1) { throw new IndirectBindingException("attr writer with > 1 args"); } return true; } return false; }
public static Handle getSymbolHandle() { return getBootstrapHandle("getSymbolBootstrap", BOOTSTRAP_STRING_SIG); }
private static MethodHandle tryDispatchDirect(JRubyCallSite site, RubyClass cls, DynamicMethod method) { String[] realName = {site.name()}; method = unwrapMethod(method, realName); for (HandleGenerator generator : HANDLE_GENERATORS) { if (generator.canGenerate(site, cls, method)) { return generator.generate(site, cls, method, realName[0]); } } throw new IndirectBindingException("no direct path available for " + method.getClass().getName()); }
public static IRubyObject getVariableFail(VariableSite site, IRubyObject self) throws Throwable { return site.getVariable(self); }
public static void checkArity(int required, int optional, boolean rest, ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject[] args, Block block) { checkArity(required, optional, rest, context, caller, self, args); }
private static MethodHandle tryDispatchDirect(JRubyCallSite site, RubyClass cls, DynamicMethod method) { String[] realName = {site.name()}; method = unwrapMethod(method, realName); for (HandleGenerator generator : HANDLE_GENERATORS) { if (generator.canGenerate(site, cls, method)) { return generator.generate(site, cls, method, realName[0]); } } throw new IndirectBindingException("no direct path available for " + method.getClass().getName()); }
@Override public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) { if (method instanceof AttrReaderMethod) { // attr reader if (!RubyInstanceConfig.INVOKEDYNAMIC_ATTR) { throw new IndirectBindingException("direct attribute dispatch not enabled"); } if (site.arity() != 0) { throw new IndirectBindingException("attr reader with > 0 args"); } return true; } return false; }
public static Handle getStaticScopeHandle() { return getBootstrapHandle("getStaticScopeBootstrap", BOOTSTRAP_STRING_INT_SIG); }
@Override public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) { if (method instanceof AttrReaderMethod) { // attr reader if (!RubyInstanceConfig.INVOKEDYNAMIC_ATTR) { throw new IndirectBindingException("direct attribute dispatch not enabled"); } if (site.arity() != 0) { throw new IndirectBindingException("attr reader with > 0 args"); } return true; } return false; }
public static Handle checkpointHandle() { return getBootstrapHandle("checkpointBootstrap", BOOTSTRAP_BARE_SIG); }
@Override public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) { if (method instanceof AttrWriterMethod) { // attr writer if (!RubyInstanceConfig.INVOKEDYNAMIC_ATTR) { throw new IndirectBindingException("direct attribute dispatch not enabled"); } if (site.arity() != 1) { throw new IndirectBindingException("attr writer with > 1 args"); } return true; } return false; }
public static Handle getLoadBooleanHandle() { return getBootstrapHandle("loadBooleanBootstrap", BOOTSTRAP_BARE_SIG); }
@Override public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) { NativeCall nativeCall = method.getNativeCall(); if (nativeCall != null) { int nativeArgCount = getNativeArgCount(method, method.getNativeCall()); // arity must match or both be [] args if (nativeArgCount != site.arity()) { throw new IndirectBindingException("arity mismatch or varargs at call site: " + nativeArgCount + " != " + site.arity()); } return true; } return false; }
public static Handle getEncodingHandle() { return getBootstrapHandle("getEncodingBootstrap", BOOTSTRAP_STRING_SIG); }
@Override public boolean canGenerate(JRubyCallSite site, RubyClass cls, DynamicMethod method) { NativeCall nativeCall = method.getNativeCall(); if (nativeCall != null) { int nativeArgCount = getNativeArgCount(method, method.getNativeCall()); // arity must match or both be [] args if (nativeArgCount != site.arity()) { throw new IndirectBindingException("arity mismatch or varargs at call site: " + nativeArgCount + " != " + site.arity()); } return true; } return false; }
public static Handle getGlobalHandle() { return getBootstrapHandle("globalBootstrap", BOOTSTRAP_STRING_INT_SIG); }