CodeStream

Engine/source/console/compiler.h

Utility class to emit and patch bytecode.

More...

Code fixing stacks

}

{

emit(U32 code)
patch(U32 addr, U32 code)
emitSTE(const char * code)
bool
pushFixScope(bool isLoop)
fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint)
addBreakLine(U32 lineNumber, U32 ip)
emitCodeStream(U32 * size, U32 ** stream, U32 ** lineBreaks)

Public Types

enum
Constants {  BlockSize = 16384
}
enum
FixType {
  FIXTYPE_LOOPBLOCKSTART 
  FIXTYPE_BREAK 
  FIXTYPE_CONTINUE 
}

Detailed Description

Utility class to emit and patch bytecode.

Emitted code

{

CodeData * mCode 
CodeData * mCodeHead 
U32 mCodePos 

Code fixing stacks

}

{

CodeStream()

~CodeStream()

allocCode(U32 sz)

emit(U32 code)

patch(U32 addr, U32 code)

emitSTE(const char * code)

tell()

inLoop()

emitFix(FixType type)

pushFixScope(bool isLoop)

popFixScope()

fixLoop(U32 loopBlockStart, U32 breakPoint, U32 continuePoint)

addBreakLine(U32 lineNumber, U32 ip)

getNumLineBreaks()

emitCodeStream(U32 * size, U32 ** stream, U32 ** lineBreaks)

reset()

Vector< U32 > mFixList 
Vector< U32 > mFixStack 
Vector< bool > mFixLoopStack 
Vector< PatchEntry > mPatchList 
Vector< U32 > mBreakLines 

}

Line numbers

Public Types

Constants

Enumerator

BlockSize = 16384
FixType

Enumerator

FIXTYPE_LOOPBLOCKSTART
FIXTYPE_BREAK
FIXTYPE_CONTINUE