mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-11 02:31:22 +00:00
Fixed some opcodes
This commit is contained in:
parent
631ca9e2f2
commit
9536bc8a6c
2 changed files with 13 additions and 9 deletions
|
|
@ -31,11 +31,15 @@ namespace Indy.IL2CPU.IL.X86 {
|
|||
}
|
||||
|
||||
public override void DoAssemble() {
|
||||
new CPUx86.Pushd("0x" + (ObjectImpl.FieldDataOffset + mTheSize + (4 - (mTheSize % 4))).ToString("X").ToUpper());
|
||||
int xSize = mTheSize;
|
||||
if (mTheSize % 4 != 0) {
|
||||
xSize += 4 - (mTheSize % 4);
|
||||
}
|
||||
new CPUx86.Pushd("0x" + (ObjectImpl.FieldDataOffset + xSize).ToString("X").ToUpper());
|
||||
new CPUx86.Call(CPU.Label.GenerateLabelName(RuntimeEngineRefs.Heap_AllocNewObjectRef));
|
||||
new CPUx86.Move("dword", CPUx86.Registers.AtEAX, "0x" + mTypeId.ToString("X"));
|
||||
new CPUx86.Move("dword", "[eax + 4]", "0x" + InstanceTypeEnum.BoxedValueType.ToString("X"));
|
||||
for (int i = 0; i < ((mTheSize + (4 - (mTheSize % 4))) / 4); i++) {
|
||||
for (int i = 0; i < (xSize / 4); i++) {
|
||||
new CPUx86.Pop(CPUx86.Registers.EDX);
|
||||
new CPUx86.Move("dword", "[eax + 0x" + (ObjectImpl.FieldDataOffset + (i * 4)).ToString("X") + "]", "edx");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,24 +29,24 @@ namespace Indy.IL2CPU.IL.X86 {
|
|||
|
||||
public override void DoAssemble() {
|
||||
string mReturnNullLabel = mThisLabel + "_ReturnNull";
|
||||
new CPUx86.Pop(CPUx86.Registers.EAX);
|
||||
new CPUx86.Move(CPUx86.Registers.EAX, CPUx86.Registers.AtESP);
|
||||
new CPUx86.Compare(CPUx86.Registers.EAX, "0");
|
||||
new CPUx86.JumpIfZero(mReturnNullLabel);
|
||||
new CPUx86.Pushd(CPUx86.Registers.AtEAX, "0" + mTypeId + "h");
|
||||
new CPUx86.Pushd(CPUx86.Registers.AtEAX);
|
||||
new CPUx86.Pushd("0" + mTypeId + "h");
|
||||
Assembler.StackContents.Push(new StackContent(4, typeof(object)));
|
||||
Assembler.StackContents.Push(new StackContent(4, typeof(object)));
|
||||
MethodBase xMethodIsInstance = Engine.GetMethodBase(typeof(VTablesImpl), "IsInstance", "System.Int32", "System.Int32");
|
||||
Engine.QueueMethod(xMethodIsInstance);
|
||||
Op xOp = new Call(xMethodIsInstance, mCurrentILOffset);
|
||||
xOp.Assembler = Assembler;
|
||||
xOp.Assemble();
|
||||
new CPUx86.Pop(CPUx86.Registers.EAX);
|
||||
Assembler.StackContents.Pop();
|
||||
new CPUx86.Pop(CPUx86.Registers.EAX);
|
||||
new CPUx86.Compare(CPUx86.Registers.EAX, "0");
|
||||
new CPUx86.JumpIfEquals(mReturnNullLabel);
|
||||
new CPUx86.Pushd(CPUx86.Registers.EAX);
|
||||
new CPUx86.JumpAlways(mNextOpLabel);
|
||||
new CPUx86.JumpIfNotEquals(mNextOpLabel);
|
||||
new CPU.Label(mReturnNullLabel);
|
||||
Assembler.StackContents.Push(new StackContent(1, typeof(bool)));
|
||||
new CPUx86.Add("esp", "4");
|
||||
new CPUx86.Pushd("0");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue