Array handling



      array_len      bread_elem      bwrite_elem      ckarray_load_i4
      ckarray_load_i8      ckarray_store_i8      dread_elem      dwrite_elem
      fread_elem      fwrite_elem      get2d      iread_elem
      iwrite_elem      lread_elem      lwrite_elem      pread_elem
      pwrite_elem      set2d      sread_elem      swrite_elem
      ubread_elem      usread_elem  


 array_len 
  ·  OperationGet the length of an array
  ·  Format
array_len
  ·  Direct Format
{array_len}
  ·  Forms array_len = 193 (0xC1)
  ·  Stack..., array => ..., length
   · Description Pop array from the stack as type ptr. Fetch the length of this array and push it onto the stack as type native int.
   · Exceptions System.NullReferenceException -- Raised if array is null.


 bread_elem 
  ·  OperationRead int8 value from array
  ·  Format
bread_elem
  ·  Direct Format
{bread_elem}
  ·  Forms bread_elem = 180 (0xB4)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the 8 bit value from position index in array, sign-extend it to int32, and push it onto the stack.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 bwrite_elem 
  ·  OperationWrite int8 value to array
  ·  Format
bwrite_elem
  ·  Direct Format
{bwrite_elem}
  ·  Forms bwrite_elem = 186 (0xBA)
  ·  Stack..., array, index, value => ...
   · Description Pop array, index, and value from the stack as the types ptr, int32, and int32 respectively. The value is truncated to 8 bits and written at position index in array.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 ckarray_load_i4 
  ·  OperationCheck an array load with an int32 index
  ·  Format
ckarray_load_i4
  ·  Direct Format
{ckarray_load_i4}
  ·  Forms ckarray_load_i4 = 190 (0xBE)
  ·  Stack..., array, index => ..., pointer, index
   · Description Retrieve array and index from the stack (without popping them) as the types ptr and int32 respectively. Throw a System.IndexOutOfRangeException if index is out of range. Otherwise set pointer to the address of the first element in the array.
   · Notes This instruction is used to assist in obtaining the address of an array element. The program will normally follow this instruction with an imul operation to adjust the index for the size of the elements, followed by padd_i4 to compute the final element address. This instruction sequence can also be used in combination with mread to fetch odd-sized array elements by pointer.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 ckarray_load_i8 
  ·  OperationCheck an array load with an int64 index
  ·  Format
ckarray_load_i8
  ·  Direct Format
{ckarray_load_i8}
  ·  Forms ckarray_load_i8 = 191 (0xBF)
  ·  Stack..., array, index => ..., pointer, index
   · Description Retrieve array and index from the stack (without popping them) as the types ptr and int64 respectively. Throw a System.IndexOutOfRangeException if index is out of range. Otherwise set pointer to the address of the first element in the array.
   · Notes This instruction is used to assist in obtaining the address of an array element. The program will normally follow this instruction with an lmul operation to adjust the index for the size of the elements, followed by padd_i8 to compute the final element address. This instruction sequence can also be used in combination with mread to fetch odd-sized array elements by pointer.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 ckarray_store_i8 
  ·  OperationCheck an array store that uses an int64 index
  ·  Format
ckarray_store_i8
N[1]
M[1]
  ·  Direct Format
{ckarray_store_i8}
N
M
  ·  Forms ckarray_store_i8 = 192 (0xC0)
  ·  Stack..., array, index, value => ..., pointer, value
   · Description Pop array, index, and value from the stack as the types ptr, int64, and word[N] respectively (where word is the type of a stack word). Throw a System.IndexOutOfRangeException if index is out of range. Otherwise set pointer to the address of the index'th element in the array. The size of each array element is M bytes. The pointer and value are pushed onto the stack.
   · Notes This instruction is used to assist in storing an element to an array when the CIL index had the type I on a 64-bit platform. This instruction sequence is typically followed by a *write instruction to store value at pointer.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 dread_elem 
  ·  OperationRead float64 value from array
  ·  Format
prefix
dread_elem
  ·  Direct Format
{dread_elem}
  ·  Forms dread_elem = 255, 16 (0xFF, 0x10)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the float64 value from position index in array, extend it to native float, and push it onto the stack.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 dwrite_elem 
  ·  OperationWrite float64 value to array
  ·  Format
prefix
dwrite_elem
  ·  Direct Format
{dwrite_elem}
  ·  Forms dwrite_elem = 255, 19 (0xFF, 0x13)
  ·  Stack..., array, index, value => ...
   · Description Pop array, index, and value from the stack as the types ptr, int32, and native float respectively. The value is truncated to float64 and written at position index in array.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 fread_elem 
  ·  OperationRead float32 value from array
  ·  Format
prefix
fread_elem
  ·  Direct Format
{fread_elem}
  ·  Forms fread_elem = 255, 15 (0xFF, 0x0F)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the float32 value from position index in array, extend it to native float, and push it onto the stack.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 fwrite_elem 
  ·  OperationWrite float32 value to array
  ·  Format
prefix
fwrite_elem
  ·  Direct Format
{fwrite_elem}
  ·  Forms fwrite_elem = 255, 18 (0xFF, 0x12)
  ·  Stack..., array, index, value => ...
   · Description Pop array, index, and value from the stack as the types ptr, int32, and native float respectively. The value is truncated to float32 and written at position index in array.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 get2d 
  ·  OperationPrepare for a two-dimensional array get operation
  ·  Format
prefix
get2d
  ·  Direct Format
{get2d}
  ·  Forms get2d = 255, 20 (0xFF, 0x14)
  ·  Stack..., array, index1, index2 => ..., address
   · Description Pop array, index1, and index2 from the stack as the types ptr, int32, and int32 respectively. The address of array[index1, index2] is pushed onto the stack as type ptr.
   · Notes This instruction is normally followed by a *read instruction to read the contents of the array element.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index1 or index2 is not within the array's bounds.


 iread_elem 
  ·  OperationRead int32 value from array
  ·  Format
iread_elem
  ·  Direct Format
{iread_elem}
  ·  Forms iread_elem = 184 (0xB8)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the int32 value from position index and push it onto the stack.
   · Notes This instruction can also be used to read values of type uint32 from an array.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 iwrite_elem 
  ·  OperationWrite int32 value to array
  ·  Format
iwrite_elem
  ·  Direct Format
{iwrite_elem}
  ·  Forms iwrite_elem = 188 (0xBC)
  ·  Stack..., array, index, value => ...
   · Description Pop array, index, and value from the stack as the types ptr, int32, and int32 respectively. The value is written at position index in array.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 lread_elem 
  ·  OperationRead int64 value from array
  ·  Format
prefix
lread_elem
  ·  Direct Format
{lread_elem}
  ·  Forms lread_elem = 255, 14 (0xFF, 0x0E)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the int64 value from position index in array, and push it onto the stack.
   · Notes This instruction can also be used to read values of type uint64.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 lwrite_elem 
  ·  OperationWrite int64 value to array
  ·  Format
prefix
lwrite_elem
  ·  Direct Format
{lwrite_elem}
  ·  Forms lwrite_elem = 255, 17 (0xFF, 0x11)
  ·  Stack..., array, index, value => ...
   · Description Pop array, index, and value from the stack as the types ptr, int32, and int64 respectively. The value is written at position index in array.
   · Notes This instruction can also be used to write values of type uint64.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 pread_elem 
  ·  OperationRead ptr value from array
  ·  Format
pread_elem
  ·  Direct Format
{pread_elem}
  ·  Forms pread_elem = 185 (0xB9)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the ptr value from position index and push it onto the stack.
   · Notes This instruction must not be confused with iread_elem. Values of type int32 and ptr do not necessarily occupy the same amount of memory space on all platforms.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 pwrite_elem 
  ·  OperationWrite ptr value to array
  ·  Format
pwrite_elem
  ·  Direct Format
{pwrite_elem}
  ·  Forms pwrite_elem = 189 (0xBD)
  ·  Stack..., array, index, value => ...
   · Description Pop array, index, and value from the stack as the types ptr, int32, and ptr respectively. The value is written at position index in array.
   · Notes This instruction must not be confused with iwrite_elem. Values of type int32 and ptr do not necessarily occupy the same amount of memory space on all platforms.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 set2d 
  ·  OperationPrepare for a two-dimensional array set operation
  ·  Format
prefix
set2d
N[4]
  ·  Direct Format
{set2d}
N
  ·  Forms set2d = 255, 21 (0xFF, 0x15)
  ·  Stack..., array, index1, index2, value => ..., address, value
   · Description Remove array, index1, and index2 from the stack as the types ptr, int32, and int32 respectively. The address of array[index1, index2] is pushed into the stack as type ptr just below value. The operand N indicates the number of stack words that are occupied by value.
   · Notes This instruction is normally followed by a *write instruction to write the contents of the array element.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index1 or index2 is not within the array's bounds.


 sread_elem 
  ·  OperationRead int16 value from array
  ·  Format
sread_elem
  ·  Direct Format
{sread_elem}
  ·  Forms sread_elem = 182 (0xB6)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the 16 bit value from position index in array, sign-extend it to int32, and push it onto the stack.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 swrite_elem 
  ·  OperationWrite int16 value to array
  ·  Format
swrite_elem
  ·  Direct Format
{swrite_elem}
  ·  Forms swrite_elem = 187 (0xBB)
  ·  Stack..., array, index, value => ...
   · Description Pop array, index, and value from the stack as the types ptr, int32, and int32 respectively. The value is truncated to 16 bits and written at position index in array.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 ubread_elem 
  ·  OperationRead uint8 value from array
  ·  Format
ubread_elem
  ·  Direct Format
{ubread_elem}
  ·  Forms ubread_elem = 181 (0xB5)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the 8 bit value from position index in array, zero-extend it to int32, and push it onto the stack.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


 usread_elem 
  ·  OperationRead uint16 value from array
  ·  Format
usread_elem
  ·  Direct Format
{usread_elem}
  ·  Forms usread_elem = 183 (0xB7)
  ·  Stack..., array, index => ..., value
   · Description Pop array and index from the stack as the types ptr and int32 respectively. Load the 16 bit value from position index in array, zero-extend it to int32, and push it onto the stack.
   · Exceptions System.NullReferenceException -- Raised if array is null.
System.IndexOutOfRangeException -- Raised if index is not within the array's bounds.


Copyright © Southern Storm Software Pty Ltd 2002
Licensed under GNU FDL