mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 23:59:10 +02:00
* avoid overflow during register allocation
git-svn-id: trunk@49285 -
This commit is contained in:
parent
72667f41ad
commit
837b433abc
@ -2846,8 +2846,10 @@ unit rgobj;
|
|||||||
set weigth of the newly allocated register higher than the old one,
|
set weigth of the newly allocated register higher than the old one,
|
||||||
so it will selected for spilling with a lower priority than
|
so it will selected for spilling with a lower priority than
|
||||||
the original one, this prevents an endless spilling loop if orgreg
|
the original one, this prevents an endless spilling loop if orgreg
|
||||||
is short living, see e.g. tw25164.pp }
|
is short living, see e.g. tw25164.pp
|
||||||
add_reg_instruction(instr,loadreg,reginfo[orgreg].weight+1);
|
|
||||||
|
the min trick is needed to avoid an overflow in case weight=high(weight which might happen }
|
||||||
|
add_reg_instruction(instr,loadreg,min(high(reginfo[orgreg].weight)-1,reginfo[orgreg].weight)+1);
|
||||||
ungetregisterinline(list,loadreg);
|
ungetregisterinline(list,loadreg);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2878,8 +2880,10 @@ unit rgobj;
|
|||||||
set weigth of the newly allocated register higher than the old one,
|
set weigth of the newly allocated register higher than the old one,
|
||||||
so it will selected for spilling with a lower priority than
|
so it will selected for spilling with a lower priority than
|
||||||
the original one, this prevents an endless spilling loop if orgreg
|
the original one, this prevents an endless spilling loop if orgreg
|
||||||
is short living, see e.g. tw25164.pp }
|
is short living, see e.g. tw25164.pp
|
||||||
add_reg_instruction(instr,storereg,reginfo[orgreg].weight+1);
|
|
||||||
|
the min trick is needed to avoid an overflow in case weight=high(weight which might happen }
|
||||||
|
add_reg_instruction(instr,storereg,min(high(reginfo[orgreg].weight)-1,reginfo[orgreg].weight)+1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user