Changeset 80


Ignore:
Timestamp:
Jan 1, 2017, 11:34:52 AM (7 years ago)
Author:
chronos
Message:
  • Fixed: Exception if optimization for empty code was used.
  • Fixed: Correctly show used memory cells.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Target/UTargetInterpretter.pas

    r79 r80  
    228228  if MemoryPosition < MemorySize then Inc(MemoryPosition, FProgram[FProgramIndex].Parameter)
    229229    else raise Exception.Create(SProgramUpperLimit);
    230   if MemoryPosition > MemoryMaxUsed then
    231     MemoryMaxUsed := MemoryPosition;
     230  if (MemoryPosition + 1) > MemoryMaxUsed then
     231    MemoryMaxUsed := MemoryPosition + 1;
    232232end;
    233233
     
    255255  OutputPosition := 1;
    256256  MemoryPosition := 0;
    257   MemoryMaxUsed := 0;
     257  MemoryMaxUsed := 1;
    258258  //FillChar(Pointer(Memory)^, Length(Memory), 0);
    259259  for I := 0 to Length(Memory) - 1 do
  • trunk/UBFTarget.pas

    r78 r80  
    110110  // Replace old program by new program
    111111  SetLength(FProgram, Length(NewProgram));
    112   Move(NewProgram[0], FProgram[0], SizeOf(TMachineOperation) * Length(NewProgram));
     112  Move(Pointer(NewProgram)^, Pointer(FProgram)^, SizeOf(TMachineOperation) * Length(NewProgram));
    113113end;
    114114
     
    251251  // Replace old program by new program
    252252  SetLength(FProgram, Length(NewProgram));
    253   Move(NewProgram[0], FProgram[0], SizeOf(TMachineOperation) * Length(NewProgram));
     253  Move(Pointer(NewProgram)^, Pointer(FProgram)^, SizeOf(TMachineOperation) * Length(NewProgram));
    254254end;
    255255
Note: See TracChangeset for help on using the changeset viewer.