box | ||||||||||
· Operation | Box a value type instance | |||||||||
· Format |
| |||||||||
· Direct Format |
| |||||||||
· Forms | box = 235 (0xEB) | |||||||||
· Stack | ..., value => ..., object | |||||||||
· Description | Pop the managed value from the stack. The size of value is N stack words. Allocate a new object instance of class, copy value into it, and then push object onto the stack. | |||||||||
· Notes | The class value is a native pointer to the class
descriptor, which may 32 or 64 bits in size. There is no unbox instruction. The object layout is defined so that an object reference can also be used as a managed pointer to the contents of the object. | |||||||||
· Exceptions | System.OutOfMemoryException -- Raised if
there is insufficient memory to allocate the new object. |
box_ptr | ||||||||||
· Operation | Box a value type instance at a pointer | |||||||||
· Format |
| |||||||||
· Direct Format |
| |||||||||
· Forms | box_ptr = 236 (0xEC) | |||||||||
· Stack | ..., pointer => ..., object | |||||||||
· Description | Pop pointer from the stack as type ptr .
Allocate a new object of N bytes in size as an instance
of class. Copy the N bytes of memory from pointer
to the object. Push object onto the stack. | |||||||||
· Notes | The class value is a native pointer to the class descriptor, which may 32 or 64 bits in size. | |||||||||
· Exceptions | System.OutOfMemoryException -- Raised if
there is insufficient memory to allocate the new object. |
bread_field | ||||
· Operation | Read int8 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | bread_field = 194 (0xC2) | |||
· Stack | ..., object => ..., value | |||
· Description | Pop object from the stack as type ptr .
Fetch the 8 bit value at object + N, sign-extend it to
int32 , and push it onto the stack. | |||
· Notes | If the offset N is greater than 255, then use the sequence cknull, ldc_i4 N, padd_i4, bread. | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
bwrite_field | ||||
· Operation | Write int8 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | bwrite_field = 200 (0xC8) | |||
· Stack | ..., object, value => ... | |||
· Description | Pop object and value from the stack as
the types ptr and int32 respectively.
Truncate value to 8 bits and store it at object + N.
| |||
· Notes | If the offset N is greater than 255, then use
the sequence cknull_n 1, padd_offset_n 1 N, bwrite.
This instruction can also be used to write values of type
| |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
castclass | ||||
· Operation | Cast an object to a new class | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | castclass = 226 (0xE2) | |||
· Stack | ..., object => ..., object | |||
· Description | Inspect the object on the top of the stack.
If object is null or its class inherits
from class, execution continues with the next instruction.
Otherwise, System.InvalidCastException
is thrown. | |||
· Notes | The class value is a native pointer to the class
descriptor, which may 32 or 64 bits in size. This instruction can only be used to test for normal inheritance. Use castinterface to cast objects to interfaces. | |||
· Exceptions | System.InvalidCastException -- Raised if
object's class does not inherit from class. |
castinterface | ||||
· Operation | Cast an object to a new interface | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | castinterface = 228 (0xE4) | |||
· Stack | ..., object => ..., object | |||
· Description | Inspect the object on the top of the stack.
If object is null or its class implements
interface, execution continues with the next instruction.
Otherwise, System.InvalidCastException
is thrown. | |||
· Notes | The interface value is a native pointer to the class
descriptor, which may 32 or 64 bits in size. This instruction can only be used to test for interface inheritance. Use castclass to cast objects to parent classes. | |||
· Exceptions | System.InvalidCastException -- Raised if
object's class does not implement interface. |
cknull | |||
· Operation | Check pointer for null | ||
· Format |
| ||
· Direct Format |
| ||
· Forms | cknull = 142 (0x8E) | ||
· Stack | ..., pointer => ..., pointer | ||
· Description | Throw System.NullReferenceException if
the ptr value on the top of the stack is null .
Otherwise do nothing. |
cknull_n | ||||||||
· Operation | Check pointer down the stack for null | |||||||
· Format |
| |||||||
· Direct Format |
| |||||||
· Forms | cknull_n = 143 (0x8F) | |||||||
· Stack | ..., pointer, val1, ..., valN => ..., pointer, val1, ..., valN | |||||||
· Description | Throw System.NullReferenceException if
the ptr value N words down the stack is
null . Otherwise do nothing. N == 0 indicates
the top of the stack. | |||||||
· Notes | The cknull instruction is more efficient if N == 0. |
get_static | ||||
· Operation | Get a pointer to the static data area of a class | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | get_static = 230 (0xE6) | |||
· Stack | ... => ..., pointer | |||
· Description | If class currently has a static data area, then push the data area's pointer onto the stack. Otherwise, allocate a new static data area for class and push it onto the stack. | |||
· Notes | The class value is a native pointer to the class
descriptor, which may 32 or 64 bits in size. This instruction is used in combination with the *read and *write instructions to access static fields within a class. | |||
· Exceptions | System.OutOfMemoryException -- Raised if
there is insufficient memory to allocate the static data
area. |
iread_field | ||||
· Operation | Read int32 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | iread_field = 198 (0xC6) | |||
· Stack | ..., object => ..., value | |||
· Description | Pop object from the stack as type ptr .
Fetch the int32 value at object + N, and
push it onto the stack. | |||
· Notes | If the offset N is greater than 255, then use the sequence cknull, ldc_i4 N, padd_i4, iread. | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
iread_this | ||||
· Operation | Read int32 field from
this | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | iread_this = 205 (0xCD) | |||
· Stack | ... => ..., value | |||
· Description | Retrieve offset 0 from the frame as object,
of type ptr . Fetch the int32 value at
object + N, and push it onto the stack. | |||
· Notes | This instruction is used to optimise the sequence pload_0, iread_field N. | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
isinst | ||||
· Operation | Determine if an object is an instance of a class | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | isinst = 227 (0xE3) | |||
· Stack | ..., object => ..., newobject | |||
· Description | Pop object from the stack as type ptr .
If object is null or its class inherits
from class, then set newobject to object.
Otherwise, set newobject to null . Push
newobject onto the stack. | |||
· Notes | The class value is a native pointer to the class
descriptor, which may 32 or 64 bits in size. This instruction can only be used to test for normal inheritance. Use isinterface to test for interface membership. |
isinterface | ||||
· Operation | Determine if an object is an instance of an interface | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | isinterface = 229 (0xE5) | |||
· Stack | ..., object => ..., newobject | |||
· Description | Pop object from the stack as type ptr .
If object is null or its class implements
interface, then set newobject to object.
Otherwise, set newobject to null . Push
newobject onto the stack. | |||
· Notes | The interface value is a native pointer to the class
descriptor, which may 32 or 64 bits in size. This instruction can only be used to test for interface inheritance. Use isinst to test for normal inheritance. |
iwrite_field | ||||
· Operation | Write int32 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | iwrite_field = 202 (0xCA) | |||
· Stack | ..., object, value => ... | |||
· Description | Pop object and value from the stack as
the types ptr and int32 respectively.
Store value at object + N. | |||
· Notes | If the offset N is greater than 255, then use
the sequence cknull_n 1, padd_offset_n 1 N, iwrite.
This instruction can also be used to write values of type
| |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
mkrefany | |||||
· Operation | Make a typedref | ||||
· Format |
| ||||
· Direct Format |
| ||||
· Forms | mkrefany = 255, 31 (0xFF, 0x1F) | ||||
· Stack | ..., pointer => ..., reference | ||||
· Description | Pop pointer from the stack as type
ptr . Make a typedref reference from
pointer and class. Push reference onto
the stack. | ||||
· Notes | The class is a native pointer, which may be either 32 or 64 bits in size, depending upon the platform. |
new | |||
· Operation | Allocate an instance of the current class | ||
· Format |
| ||
· Direct Format |
| ||
· Forms | new = 231 (0xE7) | ||
· Stack | ... => ..., pointer | ||
· Description | Allocates an instance of the class associated with the currently executing method, and pushes a pointer to this instance onto the stack. | ||
· Notes | This instruction is used inside constructors to allocate memory for a new object. The fields of the new object are initialized to zero. | ||
· Exceptions | System.OutOfMemoryException -- Raised if
there is insufficient memory to allocate the object. |
new_value | ||||||||||
· Operation | Allocate a new value type instance and push it down | |||||||||
· Format |
| |||||||||
· Direct Format |
| |||||||||
· Forms | new_value = 232 (0xE8) | |||||||||
· Stack | ..., val1, ..., valN => ..., value, pointer, val1, ..., valN | |||||||||
· Description | Creates a new value type instance of M stack words in size and places it, and a pointer to it, N positions down the stack. The fields of the new instance are initialized to zero. N == 0 to place the new instance at the top of the stack. | |||||||||
· Notes | This instruction is used inside value type constructors to
insert the return value and the this pointer into the
stack prior to running the main constructor code. |
pread_field | ||||
· Operation | Read ptr field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | pread_field = 199 (0xC7) | |||
· Stack | ..., object => ..., value | |||
· Description | Pop object from the stack as type ptr .
Fetch the ptr value at object + N, and
push it onto the stack. | |||
· Notes | If the offset N is greater than 255, then use
the sequence cknull, ldc_i4 N, padd_i4, pread.
This instruction must not be confused with iread_field.
Values of type | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
pread_this | ||||
· Operation | Read ptr field from this | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | pread_this = 204 (0xCC) | |||
· Stack | ... => ..., value | |||
· Description | Retrieve offset 0 from the frame as object,
of type ptr . Fetch the ptr value at
object + N, and push it onto the stack. | |||
· Notes | This instruction is used to optimise the sequence pload_0, pread_field N. | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
pwrite_field | ||||
· Operation | Write int32 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | pwrite_field = 203 (0xCB) | |||
· Stack | ..., object, value => ... | |||
· Description | Pop object and value from the stack
as type ptr . Store value at
object + N. | |||
· Notes | If the offset N is greater than 255, then use
the sequence cknull_n 1, padd_offset_n 1 N, pwrite.
This instruction must not be confused with iwrite_field.
Values of type | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
refanytype | ||||
· Operation | Extract the type from a typedref | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | refanytype = 255, 33 (0xFF, 0x21) | |||
· Stack | ..., reference => ..., type | |||
· Description | Pop reference from the stack as type
typedref . Extract the type from
reference and push it onto the stack. |
refanyval | |||||
· Operation | Extract the value from a typedref | ||||
· Format |
| ||||
· Direct Format |
| ||||
· Forms | refanyval = 255, 32 (0xFF, 0x20) | ||||
· Stack | ..., reference => ..., pointer | ||||
· Description | Pop reference from the stack as type
typedref . If reference refers to an instance
of class, then extract the pointer from the
reference and push it onto the stack. Otherwise, throw
System.InvalidCastException . | ||||
· Notes | The class is a native pointer, which may be either 32 or 64 bits in size, depending upon the platform. | ||||
· Exceptions | System.InvalidCastException -- Raised if
reference does not refer to an instance of class.
|
sread_field | ||||
· Operation | Read int16 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | sread_field = 196 (0xC4) | |||
· Stack | ..., object => ..., value | |||
· Description | Pop object from the stack as type ptr .
Fetch the 16 bit value at object + N, sign-extend it to
int32 , and push it onto the stack. | |||
· Notes | If the offset N is greater than 255, then use the sequence cknull, ldc_i4 N, padd_i4, sread. | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
swrite_field | ||||
· Operation | Write int16 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | swrite_field = 201 (0xC9) | |||
· Stack | ..., object, value => ... | |||
· Description | Pop object and value from the stack as
the types ptr and int32 respectively.
Truncate value to 16 bits and store it at object + N.
| |||
· Notes | If the offset N is greater than 255, then use
the sequence cknull_n 1, padd_offset_n 1 N, swrite.
This instruction can also be used to write values of type
| |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
ubread_field | ||||
· Operation | Read uint8 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | ubread_field = 195 (0xC3) | |||
· Stack | ..., object => ..., value | |||
· Description | Pop object from the stack as type ptr .
Fetch the 8 bit value at object + N, zero-extend it to
int32 , and push it onto the stack. | |||
· Notes | If the offset N is greater than 255, then use the sequence cknull, ldc_i4 N, padd_i4, ubread. | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
usread_field | ||||
· Operation | Read uint16 field | |||
· Format |
| |||
· Direct Format |
| |||
· Forms | usread_field = 197 (0xC5) | |||
· Stack | ..., object => ..., value | |||
· Description | Pop object from the stack as type ptr .
Fetch the 16 bit value at object + N, zero-extend it to
int32 , and push it onto the stack. | |||
· Notes | If the offset N is greater than 255, then use the sequence cknull, ldc_i4 N, padd_i4, usread. | |||
· Exceptions | System.NullReferenceException -- Raised if
object is null . |
Copyright © Southern
Storm Software Pty Ltd 2002
Licensed under GNU FDL