Skip to content

Instantly share code, notes, and snippets.

@headius
Last active August 29, 2015 14:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/a4549a4073dcb36568ef to your computer and use it in GitHub Desktop.
Save headius/a4549a4073dcb36568ef to your computer and use it in GitHub Desktop.
@JRubyMethod(name = "fib_ruby", frame = true, required = 1, optional = 0, rest = false)
public static IRubyObject method__0$RUBY$fib_ruby(
final bench_fib_recursive bench_fib_recursive,
final ThreadContext threadContext,
final IRubyObject rubyObject,
final IRubyObject rubyObject2,
final Block block) {
if (bench_fib_recursive.getCallSite1().call(threadContext, rubyObject, rubyObject2, 2L).isTrue()) {
return rubyObject2
} else {
return bench_fib_recursive.getCallSite2().call(threadContext, rubyObject,
bench_fib_recursive.getCallSite3().call(threadContext, rubyObject, rubyObject,
bench_fib_recursive.getCallSite4().call(threadContext, rubyObject, rubyObject2, 2L)),
bench_fib_recursive.getCallSite5().call(threadContext, rubyObject, rubyObject,
bench_fib_recursive.getCallSite6().call(threadContext, rubyObject, rubyObject2, 1L)));
}
}
def fib_ruby(a)
if a < 2
a
else
fib(a - 1) + fib(a - 2)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment