Created
May 18, 2009 19:19
-
-
Save headius/113687 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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