diff --git a/compiler/ppu.pas b/compiler/ppu.pas index 89ed8a1734..6f1effbd68 100644 --- a/compiler/ppu.pas +++ b/compiler/ppu.pas @@ -43,7 +43,7 @@ type {$endif Test_Double_checksum} const - CurrentPPUVersion=66; + CurrentPPUVersion=67; { buffer sizes } maxentrysize = 1024; diff --git a/compiler/symsym.pas b/compiler/symsym.pas index 1c8ea212ec..2ef892e6d2 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -1553,6 +1553,13 @@ implementation begin inherited ppuload(paravarsym,ppufile); paranr:=ppufile.getword; + + { The var state of parameter symbols is fixed after writing them so + we write them to the unit file. + This enables constant folding for inline procedures loaded from units + } + varstate:=tvarstate(ppufile.getbyte); + paraloc[calleeside].init; paraloc[callerside].init; if vo_has_explicit_paraloc in varoptions then @@ -1571,6 +1578,12 @@ implementation begin inherited ppuwrite(ppufile); ppufile.putword(paranr); + + { The var state of parameter symbols is fixed after writing them so + we write them to the unit file. + This enables constant folding for inline procedures loaded from units + } + ppufile.putbyte(ord(varstate)); if vo_has_explicit_paraloc in varoptions then begin paraloc[callerside].check_simple_location; diff --git a/compiler/utils/ppudump.pp b/compiler/utils/ppudump.pp index 89009d412b..c9f2d8f9c0 100644 --- a/compiler/utils/ppudump.pp +++ b/compiler/utils/ppudump.pp @@ -1497,6 +1497,7 @@ begin write (space,' DefaultConst : '); readderef; writeln(space,' ParaNr : ',getword); + writeln(space,' VarState : ',getbyte); if (vo_has_explicit_paraloc in varoptions) then begin i:=getbyte;