Skip to content

Instantly share code, notes, and snippets.

@headius
Created October 24, 2014 15:25
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save headius/230fec022c8db7d49833 to your computer and use it in GitHub Desktop.
public class FixnumObjectSite extends LazyObjectSite {
private final long value;
public FixnumObjectSite(MethodType type, long value) {
super(type);
this.value = value;
}
public static final Handle BOOTSTRAP = new Handle(Opcodes.H_INVOKESTATIC, p(FixnumObjectSite.class), "bootstrap", sig(CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class, long.class));
public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type, long value) {
return new FixnumObjectSite(type, value).bootstrap(lookup);
}
public IRubyObject construct(ThreadContext context) {
return context.runtime.newFixnum(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment