compiler/vm/vm_enums

  Source   Edit

Types

AccessViolationReason = enum
  avrNoError,               ## No violation happened
  avrOutOfBounds,           ## Access to an address not owned by the VM
  avrTypeMismatch,          ## Dynamic type is not compatible with static type
  avrNoLocation ## Address points to valid VM memory. but not to the start
                ## of a location
  Source   Edit
TOpcode = enum
  opcEof, opcRet, opcYldYoid, opcYldVal, opcSetEh, opcAsgnInt, opcAsgnFloat,
  opcAsgnComplex, opcCastIntToFloat32, opcCastIntToFloat64, opcCastFloatToInt32,
  opcCastFloatToInt64, opcCastPtrToInt, opcCastIntToPtr, opcFastAsgnComplex,
  opcNodeToReg, opcLdArr, opcLdArrAddr, opcWrArr, opcLdObj, opcLdObjAddr,
  opcWrObj, opcWrLoc, ## ``a = b``; writes the value represented by register `b`
                       ## (either directly or indirectly) to the location identified
                       ## by register `a`. A full copy is performed.
  opcAddr,                  ## a = addr b
  opcLdDeref, opcWrDeref, opcWrStrIdx, opcLdStrIdx, opcInitDisc, opcSetDisc,
  opcWrProc, opcReset,      ## resets the memory location referenced by a
  opcAddInt, opcAddImmInt, opcSubInt, opcSubImmInt, opcLenSeq, opcLenStr,
  opcLenCstring, opcIncl, opcInclRange, opcExcl, opcCard, opcMulInt, opcDivInt,
  opcModInt, opcAddFloat, opcSubFloat, opcMulFloat, opcDivFloat, opcShrInt,
  opcShlInt, opcAshrInt, opcBitandInt, opcBitorInt, opcBitxorInt, opcAddu,
  opcSubu, opcMulu, opcDivu, opcModu, opcEqInt, opcLeInt, opcLtInt, opcEqFloat,
  opcLeFloat, opcLtFloat, opcLeu, opcLtu, opcEqRef, opcEqNimNode,
  opcSameNodeType, opcXor, opcNot, opcUnaryMinusInt, opcUnaryMinusFloat,
  opcBitnotInt, opcEqStr, opcLeStr, opcLtStr, opcEqSet, opcLeSet, opcLtSet,
  opcMulSet, opcPlusSet, opcMinusSet, opcConcatStr, opcContainsSet, opcRepr,
  opcSetLenStr, opcSetLenSeq, opcIsNil, opcOf, opcParseFloat, opcConv,
  opcNumConv, opcObjConv, opcCast, opcQuit, opcInvalidField, opcNarrowS,
  opcNarrowU, opcSignExtend, opcAddStrCh, opcAddStrStr, opcAddSeqElem,
  opcRangeChck, opcIndexChck, ## abort execution if the index is not in bounds
  opcArrCopy, opcNAdd, opcNAddMultiple, opcNKind, opcNSymKind, opcNIntVal,
  opcNFloatVal, opcNGetType, opcNStrVal, opcNSigHash, opcNGetSize,
  opcNSetIntVal, opcNSetFloatVal, opcNSetStrVal, opcNNewNimNode,
  opcNCopyNimNode, opcNCopyNimTree, opcNDel, opcGenSym, opcNccValue, opcNccInc,
  opcNcsAdd, opcNcsIncl, opcNcsLen, opcNcsAt, opcNctPut, opcNctLen, opcNctGet,
  opcNctHasNext, opcNctNext, opcNodeId, opcParseExprToAst, opcParseStmtToAst,
  opcNGetLineInfo, opcNSetLineInfo, opcEqIdent, opcStrToIdent, opcGetImpl,
  opcGetImplTransf, opcDataToAst, ## deserialize data to NimNode AST
  opcExpandToAst, opcEcho, opcIndCall, opcIndCallAsgn, opcRaise, opcNChild,
  opcNSetChild, opcCallSite, opcNewStr, opcTJmp, opcFJmp, opcJmp, opcJmpBack,
  opcBranch, opcFinally, opcFinallyEnd, opcNew, opcNewSeq, opcLdNull,
  opcLdNullReg, opcLdConst, opcLdGlobal, opcLdCmplxConst, opcLdImmInt,
  opcSetType, opcObjChck, opcNSetType, opcTypeTrait, opcSymOwner,
  opcSymIsInstantiationOf
  Source   Edit
TRegisterKind = enum
  rkNone, rkInt, rkFloat, rkAddress, ## Register stores an address and optional type. The address is
                                      ## not required to point to a valid location
  rkLocation, ## Register stores an owning handle to a location. Once the
               ## register transitions to a different kind, the location is
               ## cleaned up and the memory freed
  rkHandle,                 ## Register stores a handle to a location
  rkNimNode
  Source   Edit

Consts

firstABxInstr = opcTJmp
  Source   Edit
largeInstrs = {opcConv, opcObjConv, opcCast, opcNewSeq, opcOf}
  Source   Edit
relativeJumps = {opcTJmp, opcFJmp, opcJmp, opcJmpBack}
  Source   Edit