Bladeren bron

* the right side of a concatenation of multiple ShortString values can directly pass any String[x] to the utility routine, because only the Length() is used, not High() and nothing is modified (also typed pointers must not be used for them); this allows for better code generation for strings with a maximum length < 255

Sven/Sarah Barth 2 jaren geleden
bovenliggende
commit
bb51ac77dd
1 gewijzigde bestanden met toevoegingen van 4 en 3 verwijderingen
  1. 4 3
      compiler/nopt.pas

+ 4 - 3
compiler/nopt.pas

@@ -320,18 +320,19 @@ begin
   while assigned(hp) and (hp.nodetype=addn) do
     begin
       sn:=taddnode(hp).right.getcopy;
-      inserttypeconv(sn,p.resultdef);
+      if not is_shortstr or not is_shortstring(sn.resultdef) then
+        inserttypeconv(sn,p.resultdef);
       if is_shortstr then
         begin
           sn:=caddrnode.create(sn);
-          include(taddrnode(sn).addrnodeflags,anf_typedaddr);
           include(sn.flags,nf_internal);
         end;
       arrp:=carrayconstructornode.create(sn,arrp);
       hp:=taddnode(hp).left;
     end;
   sn:=hp.getcopy;
-  inserttypeconv(sn,p.resultdef);
+  if not is_shortstr or not is_shortstring(sn.resultdef) then
+    inserttypeconv(sn,p.resultdef);
   if is_shortstr then
     begin
       sn:=caddrnode.create(sn);