public abstract class MemberReference extends Object
Modifier and Type | Field and Description |
---|---|
protected Atom |
descriptor
The descriptor
|
private static ImmutableEntryHashSetRVM<MemberReference> |
dictionary
Used to canonicalize memberReferences
|
protected int |
id
Unique id for the member reference (ignored in .equals comparison)
|
private static int |
LOG_ROW_SIZE
2^LOG_ROW_SIZE is the number of elements per row
|
private static MemberReference[][] |
members
Dictionary of all MemberReference instances.
|
protected Atom |
name
The member name
|
private static int |
nextId
Used to assign ids.
|
private static int |
ROW_MASK
Mask to ascertain row from id number
|
protected TypeReference |
type
The type reference
|
Modifier | Constructor and Description |
---|---|
protected |
MemberReference(TypeReference tRef,
Atom mn,
Atom d,
int id) |
Modifier and Type | Method and Description |
---|---|
FieldReference |
asFieldReference() |
MethodReference |
asMethodReference() |
boolean |
equals(Object other) |
static MemberReference |
findOrCreate(TypeReference tRef,
Atom mn,
Atom md)
Find or create the canonical MemberReference instance for
the given tuple.
|
Atom |
getDescriptor() |
static FieldReference |
getFieldRef(int id) |
int |
getId() |
static MemberReference |
getMemberRef(int id) |
static MethodReference |
getMethodRef(int id) |
Atom |
getName() |
static int |
getNextId() |
TypeReference |
getType() |
int |
hashCode() |
boolean |
isFieldReference() |
boolean |
isMethodReference() |
boolean |
needsDynamicLink(RVMMethod that)
Is dynamic linking code required to access "this" member when
referenced from "that" method?
|
static MemberReference |
parse(StringTokenizer parser)
Given a StringTokenizer currently pointing to the start of a
MemberReference (created by doing a toString() on a
MemberReference), parse it and find/create the appropriate
MemberReference. |
static MemberReference |
parse(StringTokenizer parser,
boolean boot) |
RVMMember |
peekResolvedMember() |
RVMMember |
resolveMember()
Forces resolution and returns the resolved member.
|
String |
toString() |
private static final ImmutableEntryHashSetRVM<MemberReference> dictionary
private static final int LOG_ROW_SIZE
private static final int ROW_MASK
private static MemberReference[][] members
private static int nextId
protected final int id
protected final TypeReference type
protected final Atom descriptor
protected MemberReference(TypeReference tRef, Atom mn, Atom d, int id)
tRef
- the type referencemn
- the field or method named
- the field or method descriptorid
- the new ID of the member were a new member required (ignored in
.equals test)public static MemberReference findOrCreate(TypeReference tRef, Atom mn, Atom md)
tRef
- the type referencemn
- the name of the membermd
- the descriptor of the membernull
public static MemberReference parse(StringTokenizer parser)
MemberReference
(created by doing a toString() on a
MemberReference), parse it and find/create the appropriate
MemberReference. Consumes all of the tokens corresponding to the
member reference.parser
- a parser that fulfills the conditions described abovenull
if parsing failspublic static MemberReference parse(StringTokenizer parser, boolean boot)
public static int getNextId()
public static MemberReference getMemberRef(int id)
public static MethodReference getMethodRef(int id)
public static FieldReference getFieldRef(int id)
public final TypeReference getType()
public final Atom getDescriptor()
public final int getId()
public final boolean isFieldReference()
true
if this member references a fieldpublic final boolean isMethodReference()
true
if this member references a methodpublic final FieldReference asFieldReference()
public final MethodReference asMethodReference()
public final RVMMember peekResolvedMember()
null
if it cannot be resolved without risking class loading.public final RVMMember resolveMember()
public final boolean needsDynamicLink(RVMMethod that)
This method is conservative, i.e. it will answer that we need linking if we don't know if it will be necessary.
that
- the method to accesstrue
if dynamic linking could be necessary