Skip to content

Instantly share code, notes, and snippets.

@headius
Created May 18, 2009 19:19
Show Gist options
  • Save headius/113687 to your computer and use it in GitHub Desktop.
Save headius/113687 to your computer and use it in GitHub Desktop.
public class CacheEntry {
public static final CacheEntry NULL_CACHE = new CacheEntry(UndefinedMethod.INSTANCE, new Object());
public final DynamicMethod method;
public final Object token;
public CacheEntry(DynamicMethod method, Object token) {
this.method = method;
this.token = token;
}
public final boolean typeOk(RubyClass incomingType) {
return token == incomingType.getCacheToken();
}
}
// inside RubyModule, superclass of RubyClass
public final Object getCacheToken() {
// generation is final, nonvolatile. token is volatile.
return generation.token;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment