immutable class Class
Class
objects are used to hold the type information in all Shadow objects. Methods on Class
objects are used for internal functionality such as checking type-casts and performing allocations.
Modifiers | Return Types | Method and Description |
---|---|---|
protected |
() |
create(String name, int flags, int size, immutable nullable Class parent, immutable Class[] interfaces, immutable MethodTable[] interfaceTables) Creates a new |
Modifiers | Return Types | Method and Description |
---|---|---|
public |
() |
destroy() |
Modifiers | Return Types | Method and Description |
---|---|---|
public readonly |
(Class) |
copy(AddressMap addresses) |
public readonly |
(boolean) |
equal(Class other) Compares the current class to another |
protected readonly locked |
(immutable MethodTable) |
interfaceData(Class interfaceClass) Retrieves method table associated with the given interface. |
public readonly locked |
(boolean) |
isArray() Checks whether or not the class is an array type. |
public readonly locked |
(boolean) |
isGeneric() Checks whether or not the class is a generic type. |
public readonly locked |
(boolean) |
isInterface() Checks whether or not the class is an interface type. |
public readonly locked |
(boolean) |
isMethod() Checks whether or not the class is a method type. |
public readonly locked |
(boolean) |
isPrimitive() Checks whether or not the class is a primitive type. |
public readonly locked |
(boolean) |
isSingleton() Checks whether or not the class is a singleton type. |
public readonly locked |
(boolean) |
isSubtype(Class other) Checks to see if the current |
public readonly locked |
(int) |
pointerSize() |
public readonly |
(String) |
toString() Returns the name of the current class. |
Modifiers | Return Types | Method and Description |
---|---|---|
public readonly get |
(immutable int) |
flags() |
public readonly get locked |
(ulong) |
hash() Finds a hash value for the current class, based on its name. |
public readonly get |
(immutable MethodTable[]) |
interfaceTables() |
public readonly get |
(immutable Class[]) |
interfaces() |
public readonly get |
(immutable String) |
name() |
public readonly get |
(immutable nullable Class) |
parent() |
public readonly get locked |
(int) |
size() For normal types, returns the size required for an object whose type is given by this class. |
public readonly get locked |
(int) |
width() Returns the width needed to store an object whose type is given by this class in an array. |
protected create(String name, int flags, int size, immutable nullable Class parent, immutable Class[] interfaces, immutable MethodTable[] interfaceTables) => ()
Creates a new Class
object with the given name, flags, size, parent, interfaces, and interface method tables. This method should only be called by GenericClass
.
name
- name of the class
flags
- flags specifying the kind of type
size
- size required for an object whose type is given by this class
parent
- parent class
interfaces
- interface classes supported by this class
data
- method tables associated with each interface
public destroy() => ()
public readonly copy(AddressMap addresses) => (Class)
public readonly equal(Class other) => (boolean)
Compares the current class to another Class
, returning true
if they are the same.
other
- object to compare to
true
if identical
protected readonly locked interfaceData(Class interfaceClass) => (immutable MethodTable)
Retrieves method table associated with the given interface.
interfaceClass
- interface to look up inside this class
method table associated with the interface
CastException
- if interface cannot be found
public readonly locked isArray() => (boolean)
Checks whether or not the class is an array type.
true
if the class is an array type
public readonly locked isGeneric() => (boolean)
Checks whether or not the class is a generic type.
true
if the class is a generic type
public readonly locked isInterface() => (boolean)
Checks whether or not the class is an interface type.
true
if the class is an interface type
public readonly locked isMethod() => (boolean)
Checks whether or not the class is a method type.
true
if the class is a method type
public readonly locked isPrimitive() => (boolean)
Checks whether or not the class is a primitive type.
true
if the class is a primitive type
public readonly locked isSingleton() => (boolean)
Checks whether or not the class is a singleton type.
true
if the class is a singleton type
public readonly locked isSubtype(Class other) => (boolean)
Checks to see if the current Class
object is the subtype of another Class
object, returning true
if it is.
other
- object to compare to
true
if the current class is its subtype
public readonly locked pointerSize() => (int)
public readonly toString() => (String)
Returns the name of the current class.
name of the class
public readonly get flags() => (immutable int)
public readonly get locked hash() => (ulong)
Finds a hash value for the current class, based on its name.
hash value
public readonly get interfaceTables() => (immutable MethodTable[])
public readonly get interfaces() => (immutable Class[])
public readonly get name() => (immutable String)
public readonly get parent() => (immutable nullable Class)
public readonly get locked size() => (int)
For normal types, returns the size required for an object whose type is given by this class. For array and interface types, it gives the width of the type. For primitive types, it gives the size of the wrapper object, not the raw primitive type.
size of an object
public readonly get locked width() => (int)
Returns the width needed to store an object whose type is given by this class in an array. For normal objects and arrays, this width is the pointer size. For primitive types, it is the size of the raw primitive type. For interface type, the size is twice the pointer size, accounting for the interface class and the method table.
width of an object