Skip to content

Commit

Permalink
fix Issue #61
Browse files Browse the repository at this point in the history
  • Loading branch information
tebe6502 committed Oct 25, 2021
1 parent 634b5cc commit f1306f3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
25.10.2021
- poprawiona optymalizacja p�tli FOR, https://github.com/tebe6502/Mad-Pascal/issues/61
- alokacja pami�ci na stronie zerowej dla dw�ch wska�nik�w FXPTR, PSPTR uzale�niona od wykorzystania VBXE (FXPTR), rekurencji (PSPTR), wymaga poprawionej wersji MadAssemblera
- nowa procedura SplitString (nie wymaga modu�u StrUtils)

20.10.2021
Expand Down
25 changes: 20 additions & 5 deletions src/mp.pas
Original file line number Diff line number Diff line change
Expand Up @@ -41092,7 +41092,9 @@ function CompileStatement(i: Integer; isAsm: Boolean = false): Integer;

inc(j, 2);

StartOptimization(j);
StartOptimization(j);

IdentTemp := -1;


{$IFDEF OPTIMIZECODE}
Expand All @@ -41103,9 +41105,21 @@ function CompileStatement(i: Integer; isAsm: Boolean = false): Integer;

if ConstVal > 0 then forBPL:=forBPL or 2;
end else begin
j := CompileExpression(j, ExpressionType, Ident[IdentIndex].DataType);
ExpandParam(Ident[IdentIndex].DataType, ExpressionType);
DefineIdent(j, '@FORTMP_'+IntToHex(CodeSize, 4), VARIABLE, Ident[IdentIndex].DataType, 0, 0, 1);

if ((Tok[j].Kind = IDENTTOK) and (Tok[j + 1].Kind = DOTOK)) or
((Tok[j].Kind = OPARTOK) and (Tok[j + 1].Kind = IDENTTOK) and (Tok[j + 2].Kind = CPARTOK) and (Tok[j + 3].Kind = DOTOK)) then begin

IdentTemp := GetIdent(Tok[j].Name^);

j := CompileExpression(j, ExpressionType, Ident[IdentIndex].DataType);
ExpandParam(Ident[IdentIndex].DataType, ExpressionType);

end else begin
j := CompileExpression(j, ExpressionType, Ident[IdentIndex].DataType);
ExpandParam(Ident[IdentIndex].DataType, ExpressionType);
DefineIdent(j, '@FORTMP_'+IntToHex(CodeSize, 4), VARIABLE, Ident[IdentIndex].DataType, 0, 0, 1);
end;

end;

{$ELSE}
Expand All @@ -41131,7 +41145,8 @@ function CompileStatement(i: Integer; isAsm: Boolean = false): Integer;
ActualParamType := Ident[IdentIndex].DataType;


IdentTemp := GetIdent('@FORTMP_'+IntToHex(CodeSize, 4));
if IdentTemp < 0 then IdentTemp := GetIdent('@FORTMP_'+IntToHex(CodeSize, 4));

GenerateAssignment(ASPOINTER, DataSize[Ident[IdentTemp].DataType], IdentTemp);

asm65; // ; --- To
Expand Down

0 comments on commit f1306f3

Please sign in to comment.