mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 05:29:18 +02:00
- disabled "string_var := string_var + ... " and "string_var + char_var"
optimizations (were only active with -dnewoptimizations) because of several internal issues
This commit is contained in:
parent
14fbf4bf69
commit
e96d0a3d6e
@ -141,11 +141,12 @@ implementation
|
||||
|
||||
procedure addstring(var p : ptree);
|
||||
var
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
l: pasmlabel;
|
||||
hreg: tregister;
|
||||
href2: preference;
|
||||
{$endif newoptimizations}
|
||||
oldregisterdef: boolean;
|
||||
{$endif newoptimizations2}
|
||||
pushedregs : tpushed;
|
||||
href : treference;
|
||||
pushed,
|
||||
@ -298,14 +299,20 @@ implementation
|
||||
p^.left^.location.loc:=LOC_MEM;
|
||||
p^.left^.location.reference:=href;
|
||||
|
||||
{$ifdef newoptimizations2}
|
||||
{ length of temp string = 255 (JM) }
|
||||
{ *** redefining a type is not allowed!! (thanks, Pierre) }
|
||||
{ also problem with constant string! }
|
||||
pstringdef(p^.left^.resulttype)^.len := 255;
|
||||
|
||||
{$endif newoptimizations2}
|
||||
end;
|
||||
|
||||
secondpass(p^.right);
|
||||
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
{ special case for string := string + char (JM) }
|
||||
{ needs string length stuff from above! }
|
||||
hreg := R_NO;
|
||||
if is_shortstring(p^.left^.resulttype) and
|
||||
is_char(p^.right^.resulttype) then
|
||||
@ -378,7 +385,7 @@ implementation
|
||||
end
|
||||
else
|
||||
begin
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
{ on the right we do not need the register anymore too }
|
||||
{ Instead of releasing them already, simply do not }
|
||||
{ push them (so the release is in the right place, }
|
||||
@ -389,11 +396,11 @@ implementation
|
||||
regstopush);
|
||||
pushusedregisters(pushedregs,regstopush);
|
||||
{ push the maximum possible length of the result }
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
{ string (could be < 255 chars now) (JM) }
|
||||
emit_const(A_PUSH,S_L,
|
||||
pstringdef(p^.left^.resulttype)^.len);
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
emitpushreferenceaddr(p^.left^.location.reference);
|
||||
{ the optimizer can more easily put the }
|
||||
{ deallocations in the right place if it happens }
|
||||
@ -401,17 +408,17 @@ implementation
|
||||
{ the pushref needs a "lea (..),edi; push edi") }
|
||||
del_reference(p^.right^.location.reference);
|
||||
emitpushreferenceaddr(p^.right^.location.reference);
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
emitcall('FPC_SHORTSTR_CONCAT_LEN');
|
||||
{$else newoptimizations}
|
||||
{$else newoptimizations2}
|
||||
emitcall('FPC_SHORTSTR_CONCAT');
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
ungetiftemp(p^.right^.location.reference);
|
||||
maybe_loadesi;
|
||||
popusedregisters(pushedregs);
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
end;
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
set_location(p^.location,p^.left^.location);
|
||||
end;
|
||||
ltn,lten,gtn,gten,
|
||||
@ -2369,7 +2376,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.100 2000-04-23 09:28:19 jonas
|
||||
Revision 1.101 2000-04-25 14:43:36 jonas
|
||||
- disabled "string_var := string_var + ... " and "string_var + char_var"
|
||||
optimizations (were only active with -dnewoptimizations) because of
|
||||
several internal issues
|
||||
|
||||
Revision 1.100 2000/04/23 09:28:19 jonas
|
||||
* use FPC_SHPRTSTR_CONCAT_LEN for -dnewoptimizations (temp)
|
||||
* more precise reg deallocation when calling the above)
|
||||
|
||||
|
@ -842,13 +842,13 @@ implementation
|
||||
else
|
||||
begin
|
||||
if not(is_shortstring(rd))
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
{$ifdef i386}
|
||||
{ shortstring + char handled seperately (JM) }
|
||||
and (not(cs_optimize in aktglobalswitches) or
|
||||
(p^.treetype <> addn) or not(is_char(rd)))
|
||||
{$endif i386}
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
then
|
||||
p^.right:=gentypeconvnode(p^.right,cshortstringdef);
|
||||
if not(is_shortstring(ld)) then
|
||||
@ -1301,7 +1301,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.74 2000-04-21 12:35:05 jonas
|
||||
Revision 1.75 2000-04-25 14:43:36 jonas
|
||||
- disabled "string_var := string_var + ... " and "string_var + char_var"
|
||||
optimizations (were only active with -dnewoptimizations) because of
|
||||
several internal issues
|
||||
|
||||
Revision 1.74 2000/04/21 12:35:05 jonas
|
||||
+ special code for string + char, between -dnewoptimizations
|
||||
|
||||
Revision 1.73 2000/03/28 21:14:18 pierre
|
||||
|
@ -201,10 +201,10 @@ implementation
|
||||
*****************************************************************************}
|
||||
|
||||
procedure firstassignment(var p : ptree);
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
var
|
||||
hp : ptree;
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
begin
|
||||
{ must be made unique }
|
||||
set_unique(p^.left);
|
||||
@ -273,7 +273,7 @@ implementation
|
||||
{ the problem is for
|
||||
s:=s+s+s;
|
||||
this is broken here !! }
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
{ the above is fixed now, but still problem with s := s + f(); if }
|
||||
{ f modifies s (bad programming, so only enable if uncertain }
|
||||
{ optimizations are on) (JM) }
|
||||
@ -293,7 +293,7 @@ implementation
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -496,7 +496,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.63 2000-04-23 21:04:09 jonas
|
||||
Revision 1.64 2000-04-25 14:43:36 jonas
|
||||
- disabled "string_var := string_var + ... " and "string_var + char_var"
|
||||
optimizations (were only active with -dnewoptimizations) because of
|
||||
several internal issues
|
||||
|
||||
Revision 1.63 2000/04/23 21:04:09 jonas
|
||||
* only enable string_concat optimization with uncertain optimizations,
|
||||
because it gives wrong results with "s := s + f()" where s is a
|
||||
string and f() is a call to a function that modifies s
|
||||
|
@ -309,10 +309,10 @@ unit tree;
|
||||
function getcopy(p : ptree) : ptree;
|
||||
|
||||
function equal_trees(t1,t2 : ptree) : boolean;
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
{ checks if t1 is loaded more than once in t2 and its sub-trees }
|
||||
function multiple_uses(t1,t2: ptree): boolean;
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
|
||||
procedure swaptree(p:Ptree);
|
||||
procedure disposetree(p : ptree);
|
||||
@ -1755,7 +1755,7 @@ unit tree;
|
||||
equal_trees:=false;
|
||||
end;
|
||||
|
||||
{$ifdef newoptimizations}
|
||||
{$ifdef newoptimizations2}
|
||||
function multiple_uses(t1,t2: ptree): boolean;
|
||||
var nr: longint;
|
||||
|
||||
@ -1773,7 +1773,7 @@ unit tree;
|
||||
check_tree(t2);
|
||||
multiple_uses := nr > 1;
|
||||
end;
|
||||
{$endif newoptimizations}
|
||||
{$endif newoptimizations2}
|
||||
|
||||
procedure set_unique(p : ptree);
|
||||
|
||||
@ -2110,7 +2110,12 @@ unit tree;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.118 2000-04-24 11:11:50 peter
|
||||
Revision 1.119 2000-04-25 14:43:37 jonas
|
||||
- disabled "string_var := string_var + ... " and "string_var + char_var"
|
||||
optimizations (were only active with -dnewoptimizations) because of
|
||||
several internal issues
|
||||
|
||||
Revision 1.118 2000/04/24 11:11:50 peter
|
||||
* backtraces for exceptions are now only generated from the place of the
|
||||
exception
|
||||
* frame is also pushed for exceptions
|
||||
|
Loading…
Reference in New Issue
Block a user