* fixed writing "packed" status of bitpacked records to ppu files.

Not sure how it ever worked, nor how exactly symtable ppu entries
    work -- but it's now stored with the recorddef (which also means
    that bitpacking is disabled currently for objects and classes,
    since they are based on tabstractrecorddef rather than trecorddef)

git-svn-id: trunk@4679 -
This commit is contained in:
Jonas Maebe 2006-09-21 20:39:36 +00:00
parent 6be389e954
commit 3bb41dcf9a
7 changed files with 37 additions and 9 deletions

2
.gitattributes vendored
View File

@ -6532,6 +6532,8 @@ tests/webtbf/tw6686.pp svneol=native#text/plain
tests/webtbf/tw6796.pp svneol=native#text/plain tests/webtbf/tw6796.pp svneol=native#text/plain
tests/webtbf/tw6922.pp svneol=native#text/plain tests/webtbf/tw6922.pp svneol=native#text/plain
tests/webtbf/tw6970.pp svneol=native#text/plain tests/webtbf/tw6970.pp svneol=native#text/plain
tests/webtbf/tw7438.pp svneol=native#text/plain
tests/webtbf/tw7438a.pp svneol=native#text/plain
tests/webtbf/uw0744.pp svneol=native#text/plain tests/webtbf/uw0744.pp svneol=native#text/plain
tests/webtbf/uw0840a.pp svneol=native#text/plain tests/webtbf/uw0840a.pp svneol=native#text/plain
tests/webtbf/uw0840b.pp svneol=native#text/plain tests/webtbf/uw0840b.pp svneol=native#text/plain

View File

@ -43,7 +43,7 @@ type
{$endif Test_Double_checksum} {$endif Test_Double_checksum}
const const
CurrentPPUVersion=64; CurrentPPUVersion=65;
{ buffer sizes } { buffer sizes }
maxentrysize = 1024; maxentrysize = 1024;

View File

@ -711,7 +711,8 @@ implementation
else else
begin begin
oldaktpackrecords:=aktpackrecords; oldaktpackrecords:=aktpackrecords;
if not bitpacking then if (not bitpacking) or
(token in [_CLASS,_OBJECT]) then
aktpackrecords:=1 aktpackrecords:=1
else else
aktpackrecords:=bit_alignment; aktpackrecords:=bit_alignment;

View File

@ -2809,6 +2809,7 @@ implementation
trecordsymtable(symtable).fieldalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).fieldalignment:=shortint(ppufile.getbyte);
trecordsymtable(symtable).recordalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).recordalignment:=shortint(ppufile.getbyte);
trecordsymtable(symtable).padalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).padalignment:=shortint(ppufile.getbyte);
trecordsymtable(symtable).usefieldalignment:=shortint(ppufile.getbyte);
trecordsymtable(symtable).ppuload(ppufile); trecordsymtable(symtable).ppuload(ppufile);
symtable.defowner:=self; symtable.defowner:=self;
isunion:=false; isunion:=false;
@ -2876,6 +2877,7 @@ implementation
ppufile.putbyte(byte(trecordsymtable(symtable).fieldalignment)); ppufile.putbyte(byte(trecordsymtable(symtable).fieldalignment));
ppufile.putbyte(byte(trecordsymtable(symtable).recordalignment)); ppufile.putbyte(byte(trecordsymtable(symtable).recordalignment));
ppufile.putbyte(byte(trecordsymtable(symtable).padalignment)); ppufile.putbyte(byte(trecordsymtable(symtable).padalignment));
ppufile.putbyte(byte(trecordsymtable(symtable).usefieldalignment));
ppufile.writeentry(ibrecorddef); ppufile.writeentry(ibrecorddef);
trecordsymtable(symtable).ppuwrite(ppufile); trecordsymtable(symtable).ppuwrite(ppufile);
end; end;

View File

@ -103,7 +103,6 @@ interface
{ no need to save in/restore from ppu file. datasize is always (databitsize+7) div 8. } { no need to save in/restore from ppu file. datasize is always (databitsize+7) div 8. }
databitsize : aint; databitsize : aint;
{ bitpacked? -> all fieldvarsym offsets are in bits instead of bytes } { bitpacked? -> all fieldvarsym offsets are in bits instead of bytes }
packed_record: boolean;
public public
property datasize : aint read _datasize write setdatasize; property datasize : aint read _datasize write setdatasize;
end; end;
@ -831,7 +830,6 @@ implementation
databitsize:=0; databitsize:=0;
recordalignment:=1; recordalignment:=1;
usefieldalignment:=usealign; usefieldalignment:=usealign;
packed_record:=usealign=bit_alignment;
padalignment:=1; padalignment:=1;
{ recordalign C_alignment means C record packing, that starts { recordalign C_alignment means C record packing, that starts
with an alignment of 1 } with an alignment of 1 }
@ -849,8 +847,6 @@ implementation
var var
storesymtable : tsymtable; storesymtable : tsymtable;
begin begin
packed_record:=boolean(ppufile.getbyte);
storesymtable:=aktrecordsymtable; storesymtable:=aktrecordsymtable;
aktrecordsymtable:=self; aktrecordsymtable:=self;
@ -865,8 +861,6 @@ implementation
oldtyp : byte; oldtyp : byte;
storesymtable : tsymtable; storesymtable : tsymtable;
begin begin
ppufile.putbyte(byte(packed_record));
storesymtable:=aktrecordsymtable; storesymtable:=aktrecordsymtable;
aktrecordsymtable:=self; aktrecordsymtable:=self;
oldtyp:=ppufile.entrytyp; oldtyp:=ppufile.entrytyp;
@ -1059,7 +1053,7 @@ implementation
function tabstractrecordsymtable.is_packed: boolean; function tabstractrecordsymtable.is_packed: boolean;
begin begin
result:=packed_record; result:=usefieldalignment=bit_alignment;
end; end;

17
tests/webtbf/tw7438.pp Normal file
View File

@ -0,0 +1,17 @@
{ %norun }
{$mode macpas}
unit tw7438;
interface
type
tr = bitpacked record
l1: longint;
l2: longint;
end;
implementation
end.

12
tests/webtbf/tw7438a.pp Normal file
View File

@ -0,0 +1,12 @@
{ %fail }
{$mode macpas}
uses
tw7438;
var
t: tr;
begin
writeln(ptruint(@t.l2) - ptruint(@t.l1));
end.