headius (owner)

Revisions

  • 683e17 headius Mon May 18 12:19:50 -0700 2009
gist: 113687 Download_button fork
public
Public Clone URL: git://gist.github.com/113687.git
Embed All Files: show embed
Java #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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();
    }
}
 
Java #
1
2
3
4
5
    // inside RubyModule, superclass of RubyClass
    public final Object getCacheToken() {
        // generation is final, nonvolatile. token is volatile.
        return generation.token;
    }