public final class InvalidationDatabase extends Object
Currently we only support 2 kinds of dependencies: The set of compiled method id's that depend on a RVMMethod not being overridden. The set of compiled method id's that depend on a RVMClass having no subclasses
Note we track by compiled method ids instead of pointers to compiled methods because we don't have weak pointers. We don't want the invalidaton database to keep code alive! This would be an ideal use of weak references if we had them.
TODO: In the future, we should think about implementing a general dependency mechanism. See Chambers, Dean, Grove in ICSE-17 (1995) for one possible design and pointers to related work.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
InvalidationDatabase.MethodSet
The following defines a set of methods that share a common "key"
|
Modifier and Type | Field and Description |
---|---|
private HashMapRVM<RVMMethod,InvalidationDatabase.MethodSet> |
nonOverriddenHash
A mapping from RVMMethod to MethodSet: holds the set of methods which
depend on a particular method being "final"
|
private HashMapRVM<RVMClass,InvalidationDatabase.MethodSet> |
noSubclassHash
A mapping from RVMClass to MethodSet: holds the set of methods which
depend on a particular class being "final"
|
Constructor and Description |
---|
InvalidationDatabase() |
Modifier and Type | Method and Description |
---|---|
void |
addNoSubclassDependency(RVMClass source,
int dependent_cmid)
Records that if a particular RVMClass ever has a subclass, then
the CompiledMethod encoded by the cmid must be invalidated.
|
void |
addNotOverriddenDependency(RVMMethod source,
int dependent_cmid)
Records that if a particular RVMMethod method is ever overridden, then
the CompiledMethod encoded by the cmid must be invalidated.
|
private <T> InvalidationDatabase.MethodSet |
findOrCreateMethodSet(HashMapRVM<T,InvalidationDatabase.MethodSet> hash,
T key)
Looks up the MethodSet corresponding to a given key in the database.
|
Iterator<Integer> |
invalidatedByOverriddenMethod(RVMMethod m)
Returns an iteration of CMID's (compiled method ids) that are dependent
on the argument RVMMethod not being overridden.
|
Iterator<Integer> |
invalidatedBySubclass(RVMClass m)
Returns an iteration of CMID's (compiled method ids) that are dependent
on the argument RVMMethod not having any subclasses.
|
void |
removeNoSubclassDependency(RVMClass source)
Deletes all NoSubclass dependencies on the argument RVMClass.
|
void |
removeNoSubclassDependency(RVMClass source,
int dependent_cmid)
Delete as NoSubclassDependency.
|
void |
removeNotOverriddenDependency(RVMMethod source)
Delete all NotOverridden dependencies on the argument RVMMethod
|
void |
removeNotOverriddenDependency(RVMMethod source,
int dependent_cmid)
Deletes a NotOverriddenDependency.
|
private final HashMapRVM<RVMMethod,InvalidationDatabase.MethodSet> nonOverriddenHash
private final HashMapRVM<RVMClass,InvalidationDatabase.MethodSet> noSubclassHash
public InvalidationDatabase()
public Iterator<Integer> invalidatedByOverriddenMethod(RVMMethod m)
null
will be returned.
NOTE: null
is used instead of EmptyIterator.getInstance
as part of delicate dance to avoid recursive classloading.
m
- a method that can be overriddennull
public void addNotOverriddenDependency(RVMMethod source, int dependent_cmid)
source
- a methoddependent_cmid
- id of the method that must be invalidatedpublic void removeNotOverriddenDependency(RVMMethod source, int dependent_cmid)
source
- a methoddependent_cmid
- id of the method that must be invalidatedpublic void removeNotOverriddenDependency(RVMMethod source)
source
- a methodpublic Iterator<Integer> invalidatedBySubclass(RVMClass m)
null
will be returned.
NOTE: null
is used instead of EmptyIterator.getInstance
as part of delicate dance to avoid recursive classloading.
m
- a method that can be overriddennull
public void addNoSubclassDependency(RVMClass source, int dependent_cmid)
source
- a classdependent_cmid
- id of the method that must be invalidatedpublic void removeNoSubclassDependency(RVMClass source, int dependent_cmid)
source
- a classdependent_cmid
- id of the method that must be invalidatedpublic void removeNoSubclassDependency(RVMClass source)
source
- class whose dependencies are to be removedprivate <T> InvalidationDatabase.MethodSet findOrCreateMethodSet(HashMapRVM<T,InvalidationDatabase.MethodSet> hash, T key)
T
- type of the key in the databasehash
- the databasekey
- the key