Attempt to correct INC/DEC access
This commit is contained in:
parent
c0cf50c6f7
commit
820b98b4a9
4 changed files with 22 additions and 2 deletions
|
@ -189,7 +189,7 @@ namespace arookas {
|
|||
|
||||
public override void Compile(sunCompiler compiler, sunStorableSymbol symbol) {
|
||||
symbol.CompileInc(compiler);
|
||||
symbol.CompileSet(compiler);
|
||||
symbol.CompilePop(compiler);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ namespace arookas {
|
|||
|
||||
public override void Compile(sunCompiler compiler, sunStorableSymbol symbol) {
|
||||
symbol.CompileDec(compiler);
|
||||
symbol.CompileSet(compiler);
|
||||
symbol.CompilePop(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,6 +184,7 @@ namespace arookas {
|
|||
TraceInstruction("inc {0} {1}", display, index);
|
||||
#endif
|
||||
mText.Writer.Write8(0x06);
|
||||
mText.Writer.Write8(0x04);
|
||||
mText.Writer.WriteS32(display);
|
||||
mText.Writer.WriteS32(index);
|
||||
}
|
||||
|
@ -192,6 +193,7 @@ namespace arookas {
|
|||
TraceInstruction("dec {0} {1}", display, index);
|
||||
#endif
|
||||
mText.Writer.Write8(0x07);
|
||||
mText.Writer.Write8(0x04);
|
||||
mText.Writer.WriteS32(display);
|
||||
mText.Writer.WriteS32(index);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,20 @@ namespace arookas {
|
|||
}
|
||||
}
|
||||
|
||||
class sunVariablePopSite : sunSymbolRelocation<sunVariableSymbol> {
|
||||
public sunVariablePopSite(sunBinary binary, sunVariableSymbol symbol)
|
||||
: base(binary, symbol) {
|
||||
mBinary.WritePOP();
|
||||
}
|
||||
|
||||
public override void Relocate() {
|
||||
mBinary.Keep();
|
||||
mBinary.Goto(mPoint);
|
||||
mBinary.WritePOP();
|
||||
mBinary.Back();
|
||||
}
|
||||
}
|
||||
|
||||
class sunVariableIncSite : sunSymbolRelocation<sunVariableSymbol> {
|
||||
public sunVariableIncSite(sunBinary binary, sunVariableSymbol symbol)
|
||||
: base(binary, symbol) {
|
||||
|
|
|
@ -255,6 +255,7 @@ namespace arookas {
|
|||
}
|
||||
public abstract void CompileGet(sunCompiler compiler);
|
||||
public abstract void CompileSet(sunCompiler compiler);
|
||||
public abstract void CompilePop(sunCompiler compiler);
|
||||
public virtual void CompileInc(sunCompiler compiler) {
|
||||
CompileGet(compiler);
|
||||
compiler.Binary.WriteINT(1);
|
||||
|
@ -305,6 +306,9 @@ namespace arookas {
|
|||
public override void CompileDec(sunCompiler compiler) {
|
||||
OpenRelocation(new sunVariableDecSite(compiler.Binary, this));
|
||||
}
|
||||
public override void CompilePop(sunCompiler compiler) {
|
||||
OpenRelocation(new sunVariablePopSite(compiler.Binary, this));
|
||||
}
|
||||
}
|
||||
|
||||
class sunConstantSymbol : sunStorableSymbol {
|
||||
|
|
Loading…
Reference in a new issue