From bdd60d9d0805a1ac61eab5893d078a098475291f Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 13 Jan 2018 21:37:28 -0600 Subject: [PATCH] When using varargs stack repair, only disable native-code peephole opt in functions containing varargs calls. There is no need to reduce the optimization in other functions, which will not contain any varargs stack repair code. --- Native.pas | 2 +- Scanner.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Native.pas b/Native.pas index 717e5cf..f0ce15b 100644 --- a/Native.pas +++ b/Native.pas @@ -1762,7 +1762,7 @@ var begin {GenNative} { writeln('GenNative: ',p_opcode:4, ', mode=', ord(p_mode):1, ' operand=', p_operand:1); {debug} -if npeephole then begin +if npeephole and not (strictVararg and hasVarargsCall) then begin if (nnextspot = 1) and not (p_opcode in nleadOpcodes) then begin if p_opcode <> d_end then if registers then diff --git a/Scanner.pas b/Scanner.pas index 8438133..16d0d44 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -2703,7 +2703,7 @@ if ch in ['a','d','e','i','l','p','u','w'] then begin commonSubexpression := odd(val >> 4); loopOptimizations := odd(val >> 5); strictVararg := not odd(val >> 6); - if saveStack or strictVararg then + if saveStack then npeepHole := false; if token.kind <> eolsy then Error(11);