Miscellaneous instructions



      break      ldtoken      memcpy      memmove
      memset      memzero      nop      prefix
      unroll_method      wide  


 break 
  ·  OperationMark the position of a breakpoint
  ·  Format
break
subcode
  ·  Direct Format
{break}
subcode
  ·  Forms break = 254 (0xFE)
   · Description This instruction marks a position in the CVM bytecode that may be used as a breakpoint in debug versions of the runtime engine.

Every potentional position for a breakpoint is marked, even if those positions will never have active breakpoints set on them. The runtime engine keeps a list of active breakpoints, which is inspected at each potentional breakpoint.



 ldtoken 
  ·  OperationLoad a token pointer onto the stack
  ·  Format
ldtoken
pointer
  ·  Direct Format
{ldtoken}
pointer
  ·  Forms ldtoken = 234 (0xEA)
  ·  Stack... => ..., pointer
   · Description Push pointer onto the stack as a ptr value.
   · Notes The pointer value is a native pointer to the token descriptor, which may 32 or 64 bits in size.

This instruction is used to load type, field, and method descriptors onto the stack as handle instances.



 memcpy 
  ·  OperationCopy a fixed-size block of non-overlapping memory
  ·  Format
memcpy
N[1]
wide
memcpy
N[4]
  ·  Direct Format
{memcpy}
N
  ·  Forms memcpy = 237 (0xED)
  ·  Stack..., dest, src => ...
   · Description Pop dest and src from the stack as type ptr. Copy N bytes of memory from src to dest.
   · Notes It is assumed that the source and destination regions do not overlap.

This instruction is typically used to copy value type instances from one location to another.

Use memmove for overlapping memory regions, and for regions that do not have a fixed size.



 memmove 
  ·  OperationMove a block of memory
  ·  Format
memmove
  ·  Direct Format
{memmove}
  ·  Forms memmove = 238 (0xEE)
  ·  Stack..., dest, src, length => ...
   · Description Pop dest, src, and length from the stack as the types ptr, ptr, and uint32 respectively. Move length bytes of memory from src to dest.
   · Notes If the source and destination regions overlap, this instruction will guarantee to produce the correct result.


 memset 
  ·  OperationFill a block of memory with a byte value
  ·  Format
memset
  ·  Direct Format
{memset}
  ·  Forms memset = 240 (0xF0)
  ·  Stack..., dest, value, length => ...
   · Description Pop dest, value, and length from the stack as the types ptr, int32, and uint32. Fill length bytes of memory at dest with value.


 memzero 
  ·  OperationFill a fixed-size block of memory with zeroes
  ·  Format
memzero
N[1]
wide
memzero
N[4]
  ·  Direct Format
{memzero}
N
  ·  Forms memzero = 239 (0xEF)
  ·  Stack..., dest => ...
   · Description Pop dest from the stack as type ptr. Fill N bytes of memory at dest with zero bytes.
   · Notes This instruction is typically used to initialize value type instances.

Use memset if the region does not have a fixed size, or the fill value is something other than zero.



 nop 
  ·  OperationDo nothing
  ·  Format
nop
  ·  Direct Format
{nop}
  ·  Forms nop = 0 (0x00)
   · Description Do nothing.


 prefix 
  ·  OperationPrefix an alternative instruction
  ·  Format
prefix
opcode
...
  ·  Forms prefix = 255, 255 (0xFF, 0xFF)
   · Description The prefix instruction is used to switch the runtime engine into an alternative instruction set. The alternative instruction is opcode. Prefixing is necessary because the VM has more than 256 distinct instructions.
   · Notes There is no direct format for this instruction, because prefix is not required for the direct encoding.


 unroll_method 
  ·  OperationMark a method for unrolling
  ·  Direct Format
{unroll_method}
  ·  Forms unroll_method = 255, 83 (0xFF, 0x53)
   · Description The unroll_method instruction is used in direct code to trigger native code unrolling.

Unrolling converts fragments of the method into native code for the underlying CPU, to speed up execution.

   · Notes There is no bytecode format for this instruction, because unrolling is not possible with the bytecode encoding.

In a method that can support unrolling, the nop instruction is used to mark a label, so that the unroller can process labels in a single translation pass. The prefix instruction is used to mark the end of the method's code, so that the unroller knows where to stop.



 wide 
  ·  OperationModify an instruction to its wide form
  ·  Format
wide
opcode
...
  ·  Forms wide = 253 (0xFD)
   · Description The wide instruction modifies another instruction to take longer operands. The format of the operands depends upon the opcode.
   · Notes The documentation for other instructions includes information on their wide forms where appropriate.

There is no direct format for this instruction, because wide is not required for the direct encoding.



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