C# Class Mosa.Compiler.Framework.BaseCodeEmitter

Base code emitter.
Inheritance: IDisposable, ICodeEmitter
Show file Open project: tgiphil/MOSA-Project Class Usage Examples

Protected Properties

Property Type Description
codeStream Stream
linker Mosa.Compiler.Linker.BaseLinker
patches List

Public Methods

Method Description
Emit ( OpcodeEncoder opcode ) : void

Emits the specified opcode.

Emit ( OpcodeEncoder opcode, Operand symbolOperand, int patchOffset, int referenceOffset ) : void
GetPosition ( int label ) : int

Gets the position.

Initialize ( string methodName, BaseLinker linker, Stream codeStream ) : void

Initializes a new instance of BaseCodeEmitter.

Label ( int label ) : void

Emits a label into the code stream.

ResolvePatches ( ) : void
Write ( byte buffer, int offset, int count ) : void

Writes the byte.

WriteByte ( byte data ) : void

Writes the byte.

Protected Methods

Method Description
AddPatch ( int label, int position ) : void
TryGetLabel ( int label, int &position ) : bool

Method Details

AddPatch() protected method

protected AddPatch ( int label, int position ) : void
label int
position int
return void

Emit() public method

Emits the specified opcode.
public Emit ( OpcodeEncoder opcode ) : void
opcode OpcodeEncoder The opcode.
return void

Emit() public method

public Emit ( OpcodeEncoder opcode, Operand symbolOperand, int patchOffset, int referenceOffset ) : void
opcode OpcodeEncoder
symbolOperand Operand
patchOffset int
referenceOffset int
return void

GetPosition() public method

Gets the position.
public GetPosition ( int label ) : int
label int The label.
return int

Initialize() public method

Initializes a new instance of BaseCodeEmitter.
public Initialize ( string methodName, BaseLinker linker, Stream codeStream ) : void
methodName string Name of the method.
linker Mosa.Compiler.Linker.BaseLinker The linker.
codeStream Stream The stream the machine code is written to.
return void

Label() public method

Emits a label into the code stream.
public Label ( int label ) : void
label int The label name to emit.
return void

ResolvePatches() public abstract method

public abstract ResolvePatches ( ) : void
return void

TryGetLabel() protected method

protected TryGetLabel ( int label, int &position ) : bool
label int
position int
return bool

Write() public method

Writes the byte.
public Write ( byte buffer, int offset, int count ) : void
buffer byte The buffer.
offset int The offset.
count int The count.
return void

WriteByte() public method

Writes the byte.
public WriteByte ( byte data ) : void
data byte The data.
return void

Property Details

codeStream protected property

The stream used to write machine code bytes to.
protected Stream codeStream
return Stream

linker protected property

Holds the linker used to resolve externals.
protected BaseLinker,Mosa.Compiler.Linker linker
return Mosa.Compiler.Linker.BaseLinker

patches protected property

Patches we need to perform.
protected List patches
return List