@@ -65,6 +65,7 @@ public override List<InstructionSetIndependentInstruction> GetIsilFromMethod(Met
65
65
private void ConvertInstructionStatement ( Instruction instruction , IsilBuilder builder , MethodAnalysisContext context )
66
66
{
67
67
var callNoReturn = false ;
68
+ int operandSize ;
68
69
69
70
switch ( instruction . Mnemonic )
70
71
{
@@ -238,14 +239,14 @@ private void ConvertInstructionStatement(Instruction instruction, IsilBuilder bu
238
239
builder . Return ( instruction . IP , InstructionSetIndependentOperand . MakeRegister ( "rax" ) ) ;
239
240
break ;
240
241
case Mnemonic . Push :
241
- //var operandSize = instruction.Op0Kind == OpKind.Register ? instruction.Op0Register.GetSize() : instruction.MemorySize.GetSize();
242
- builder . Push ( instruction . IP , InstructionSetIndependentOperand . MakeRegister ( "rsp" ) , ConvertOperand ( instruction , 0 ) ) ;
243
- // builder.ShiftStack (instruction.IP, -operandSize );
242
+ operandSize = instruction . Op0Kind == OpKind . Register ? instruction . Op0Register . GetSize ( ) : instruction . MemorySize . GetSize ( ) ;
243
+ builder . ShiftStack ( instruction . IP , - operandSize ) ;
244
+ builder . Move ( instruction . IP , InstructionSetIndependentOperand . MakeStack ( 0 ) , ConvertOperand ( instruction , 0 ) ) ;
244
245
break ;
245
246
case Mnemonic . Pop :
246
- //var operandSize = instruction.Op0Kind == OpKind.Register ? instruction.Op0Register.GetSize() : instruction.MemorySize.GetSize();
247
- // builder.ShiftStack (instruction.IP, operandSize );
248
- builder . Pop ( instruction . IP , InstructionSetIndependentOperand . MakeRegister ( "rsp" ) , ConvertOperand ( instruction , 0 ) ) ;
247
+ operandSize = instruction . Op0Kind == OpKind . Register ? instruction . Op0Register . GetSize ( ) : instruction . MemorySize . GetSize ( ) ;
248
+ builder . Move ( instruction . IP , ConvertOperand ( instruction , 0 ) , InstructionSetIndependentOperand . MakeStack ( 0 ) ) ;
249
+ builder . ShiftStack ( instruction . IP , operandSize ) ;
249
250
break ;
250
251
case Mnemonic . Sub :
251
252
case Mnemonic . Add :
0 commit comments