| Linderdaum Engine: clCodePatch Class Reference | ![]() |
Code fragment within LinderScript virtual machine. More...
#include <Script.h>
Public Member Functions | |
| clCodePatch () | |
| virtual | ~clCodePatch () |
| virtual bool | BeginSave () |
| Custom preparation for the saving process. | |
| virtual bool | EndSave () |
| Custom termination of the saving process. | |
| virtual bool | BeginLoad () |
| Custom preparation for the loading process. | |
| virtual bool | EndLoad () |
| Custom termination of the loading process. | |
| scriptmethod bool | Reassemble () |
| Convert FSource<> to binary representation. | |
| scriptmethod bool | Disassemble () |
| Convert instructions and operands to symbolic representation. | |
| LString | InstructionToString (const sInstruction &Instr) const |
| bool | AssembleInstruction (const LString &Line, LString &ErrorCode) |
| scriptmethod bool | AssembleLine (const LString &InstrName, const LString &Args, LString &ErrorCode) |
| scriptmethod bool | AssembleCode (const std::vector< LString > &ACode, LString &ResultType, LString &ErrorCode) |
| scriptmethod int | GetLabelLink (const LString &String) |
| scriptmethod LString | FindLabelByIP (int IP) const |
| scriptmethod LString | GetString (int Index) const |
| noexport LString * | GetStringPtr (int Index) |
| scriptmethod int | GetStringsCount () const |
| virtual clInstructions & | GetInstructions () |
| scriptmethod bool | Link (LString &ErrorCode) |
| virtual LString | GetSourceLine (int i) const |
| FIXME : the following two methods are 'virtual' to make them exportable to .NET, but they are really only 'scriptmethod'. | |
| virtual void | SetSourceLine (int i, const LString &S) |
Public Attributes | |
| std::vector< LString > | FSource |
| Assembler source code. | |
Private Types | |
| typedef std::map< LString, int > | clLabelsTable |
Private Member Functions | |
| int | EmitString (const LString &String) |
| bool | Optimize () |
| run peephole optimizer for this code patch | |
| bool | IsDeadInstruction (const sInstruction &Instr) |
| return 'true' if instruction can be removed with no side effects | |
| bool | PeepholeOptimizePair (const sInstruction &Instr1, const sInstruction &Instr2, sInstruction *OutInstruction) |
| return 'true' if two instructions can be replaced by a single one | |
| bool | PeepholeOptimizeTriplet (const sInstruction &Instr1, const sInstruction &Instr2, const sInstruction &Instr3, sInstruction *OutInstruction) |
| return 'true' if three instructions can be replaced by a single one | |
| void | CollapseInstructions (int FromIP, int Skip) |
| remove Skip instructions starting from FromIP and update label tables | |
Private Attributes | |
| clInstructions | FInstructions |
| LStr::clStringsVector | FStringTable |
| LStr::clStringsVector | FLabelLinks |
| clLabelsTable | FLabelsTable |
| map label names to IP jump offsets | |
Code fragment within LinderScript virtual machine.
typedef std::map<LString, int> clCodePatch::clLabelsTable [private] |
| clCodePatch::clCodePatch | ( | ) |
| virtual clCodePatch::~clCodePatch | ( | ) | [inline, virtual] |
| bool clCodePatch::AssembleCode | ( | const std::vector< LString > & | ACode, |
| LString & | ResultType, | ||
| LString & | ErrorCode | ||
| ) |
| bool clCodePatch::AssembleInstruction | ( | const LString & | Line, |
| LString & | ErrorCode | ||
| ) |
| bool clCodePatch::AssembleLine | ( | const LString & | InstrName, |
| const LString & | Args, | ||
| LString & | ErrorCode | ||
| ) |
| virtual bool clCodePatch::BeginLoad | ( | ) | [inline, virtual] |
Custom preparation for the loading process.
Reimplemented from iObject.
| virtual bool clCodePatch::BeginSave | ( | ) | [inline, virtual] |
Custom preparation for the saving process.
Reimplemented from iObject.
remove Skip instructions starting from FromIP and update label tables
| bool clCodePatch::Disassemble | ( | ) |
Convert instructions and operands to symbolic representation.
| int clCodePatch::EmitString | ( | const LString & | String | ) | [private] |
| virtual bool clCodePatch::EndLoad | ( | ) | [inline, virtual] |
Custom termination of the loading process.
Reimplemented from iObject.
| virtual bool clCodePatch::EndSave | ( | ) | [inline, virtual] |
Custom termination of the saving process.
Reimplemented from iObject.
| LString clCodePatch::FindLabelByIP | ( | int | IP | ) | const |
| virtual clInstructions& clCodePatch::GetInstructions | ( | ) | [inline, virtual] |
| int clCodePatch::GetLabelLink | ( | const LString & | String | ) |
| virtual LString clCodePatch::GetSourceLine | ( | int | i | ) | const [inline, virtual] |
FIXME : the following two methods are 'virtual' to make them exportable to .NET, but they are really only 'scriptmethod'.
| LString clCodePatch::GetString | ( | int | Index | ) | const |
| LString * clCodePatch::GetStringPtr | ( | int | Index | ) |
| int clCodePatch::GetStringsCount | ( | ) | const |
| LString clCodePatch::InstructionToString | ( | const sInstruction & | Instr | ) | const |
| bool clCodePatch::IsDeadInstruction | ( | const sInstruction & | Instr | ) | [private] |
return 'true' if instruction can be removed with no side effects
| bool clCodePatch::Link | ( | LString & | ErrorCode | ) |
| bool clCodePatch::Optimize | ( | ) | [private] |
run peephole optimizer for this code patch
| bool clCodePatch::PeepholeOptimizePair | ( | const sInstruction & | Instr1, |
| const sInstruction & | Instr2, | ||
| sInstruction * | OutInstruction | ||
| ) | [private] |
return 'true' if two instructions can be replaced by a single one
| bool clCodePatch::PeepholeOptimizeTriplet | ( | const sInstruction & | Instr1, |
| const sInstruction & | Instr2, | ||
| const sInstruction & | Instr3, | ||
| sInstruction * | OutInstruction | ||
| ) | [private] |
return 'true' if three instructions can be replaced by a single one
| bool clCodePatch::Reassemble | ( | ) |
Convert FSource<> to binary representation.
| virtual void clCodePatch::SetSourceLine | ( | int | i, |
| const LString & | S | ||
| ) | [inline, virtual] |
clInstructions clCodePatch::FInstructions [private] |
clLabelsTable clCodePatch::FLabelsTable [private] |
map label names to IP jump offsets
| std::vector<LString> clCodePatch::FSource |
Assembler source code.
Property(Description="Assembler source code", Category="Assembly", Name=Code, Type=string, IndexType=int, FieldName=FSource, NetIndexedSetter=SetSourceLine, NetIndexedGetter=GetSourceLine)