* If object has VMT, properly align whole object instance if target CPU requires alignment. It fixes usage of static object instances created as var or const on CPUs which require alignment.

* Partially reverted Micha's fix in revs 10544,10546,10548, because it is not needed anymore.

git-svn-id: trunk@10648 -
This commit is contained in:
yury 2008-04-13 15:36:44 +00:00
parent 4341b18461
commit 348e30958e
2 changed files with 5 additions and 4 deletions

View File

@ -1174,7 +1174,6 @@ implementation
obj : tobjectdef;
srsym : tsym;
st : tsymtable;
objst : tobjectsymtable;
curroffset : aint;
s,sorg : TIDString;
vmtwritten : boolean;
@ -1250,8 +1249,6 @@ implementation
(oo_has_vmt in def.objectoptions) and
(def.vmt_offset<fieldoffset) then
begin
objst:=tobjectsymtable(def.symtable);
objst.alignrecord(def.vmt_offset,sizeof(TConstPtrUInt));
for i:=1 to def.vmt_offset-curroffset do
list.concat(tai_const.create_8bit(0));
list.concat(tai_const.createname(def.vmt_mangledname,0));

View File

@ -3922,7 +3922,11 @@ implementation
tObjectSymtable(symtable).fieldalignment);
if (tf_requires_proper_alignment in target_info.flags) then
tObjectSymtable(symtable).datasize:=align(tObjectSymtable(symtable).datasize,sizeof(pint));
begin
{ Align VMT pointer and whole object instance if target CPU requires alignment. }
tObjectSymtable(symtable).datasize:=align(tObjectSymtable(symtable).datasize,sizeof(pint));
tObjectSymtable(symtable).alignrecord(tObjectSymtable(symtable).datasize,sizeof(pint));
end;
vmt_offset:=tObjectSymtable(symtable).datasize;
tObjectSymtable(symtable).datasize:=