public class TableBasedDynamicLinker extends Object
The main idea for dynamic linking is that we maintain arrays of member offsets indexed by the member's dynamic linking id. The generated code at a dynamically linked site will load the appropriate value from the offset table and check to see if the value is valid. If it is, then no dynamic linking is required. If the value is invalid, then resolveDynamicLink is invoked to perform any required dynamic class loading. After member resolution and class loading completes, we can store the offset value in the offset table. Thus when resolve method returns, execution can be restarted by reloading/indexing the offset table.
NOTE: We believe that only use of invokespecial that could possibly require dynamic linking is that of invoking an object initializer.
Modifier and Type | Field and Description |
---|---|
private static int[] |
memberOffsets
Linking table keyed by member reference IDs.
|
Constructor and Description |
---|
TableBasedDynamicLinker() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
ensureCapacity(int id)
Method invoked from MemberReference to
ensure that there is space in the dynamic linking table for
the given member reference.
|
static int |
resolveMember(int memberId)
Cause dynamic linking of the RVMMember whose member reference id is given.
|
static int |
resolveMember(MemberReference ref)
Cause dynamic linking of the argument MemberReference
|
private static int[] memberOffsets
public TableBasedDynamicLinker()
public static int resolveMember(int memberId) throws NoClassDefFoundError
memberId
- the dynamicLinkingId of the method to link.NoClassDefFoundError
public static int resolveMember(MemberReference ref) throws NoClassDefFoundError
ref
- reference to the member to linkNoClassDefFoundError
static void ensureCapacity(int id)
id
- id of the member reference