mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 14:10:57 +01:00
* packed column writing/reading for token recorder, reduces size of fgl.ppu by approx. 10%
git-svn-id: trunk@17512 -
This commit is contained in:
parent
120d9a7a4a
commit
d19d8de8fe
@ -43,7 +43,7 @@ type
|
||||
{$endif Test_Double_checksum}
|
||||
|
||||
const
|
||||
CurrentPPUVersion = 129;
|
||||
CurrentPPUVersion = 130;
|
||||
|
||||
{ buffer sizes }
|
||||
maxentrysize = 1024;
|
||||
|
||||
@ -2080,6 +2080,7 @@ In case not, the value returned can be arbitrary.
|
||||
t : ttoken;
|
||||
s : tspecialgenerictoken;
|
||||
len : sizeint;
|
||||
b : byte;
|
||||
begin
|
||||
if not assigned(recordtokenbuf) then
|
||||
internalerror(200511176);
|
||||
@ -2108,8 +2109,17 @@ In case not, the value returned can be arbitrary.
|
||||
begin
|
||||
s:=ST_COLUMN;
|
||||
writetoken(t);
|
||||
recordtokenbuf.write(s,1);
|
||||
recordtokenbuf.write(current_tokenpos.column,sizeof(current_tokenpos.column));
|
||||
{ can the column be written packed? }
|
||||
if current_tokenpos.column<$80 then
|
||||
begin
|
||||
b:=$80 or current_tokenpos.column;
|
||||
recordtokenbuf.write(b,1);
|
||||
end
|
||||
else
|
||||
begin
|
||||
recordtokenbuf.write(s,1);
|
||||
recordtokenbuf.write(current_tokenpos.column,sizeof(current_tokenpos.column));
|
||||
end;
|
||||
last_filepos.column:=current_tokenpos.column;
|
||||
end;
|
||||
if current_tokenpos.fileindex<>last_filepos.fileindex then
|
||||
@ -2258,45 +2268,57 @@ In case not, the value returned can be arbitrary.
|
||||
_GENERICSPECIALTOKEN:
|
||||
begin
|
||||
replaytokenbuf.read(specialtoken,1);
|
||||
case specialtoken of
|
||||
ST_LOADSETTINGS:
|
||||
replaytokenbuf.read(current_settings,sizeof(current_settings));
|
||||
ST_LINE:
|
||||
begin
|
||||
replaytokenbuf.read(current_tokenpos.line,sizeof(current_tokenpos.line));
|
||||
|
||||
{ don't generate invalid line info if no sources are available for the current module }
|
||||
if not(get_module(current_filepos.moduleindex).sources_avail) then
|
||||
current_tokenpos.line:=0;
|
||||
|
||||
current_filepos:=current_tokenpos;
|
||||
end;
|
||||
ST_COLUMN:
|
||||
begin
|
||||
replaytokenbuf.read(current_tokenpos.column,sizeof(current_tokenpos.column));
|
||||
{ packed column? }
|
||||
if (ord(specialtoken) and $80)<>0 then
|
||||
begin
|
||||
current_tokenpos.column:=ord(specialtoken) and $7f;
|
||||
|
||||
{ don't generate invalid line info if no sources are available for the current module }
|
||||
if not(get_module(current_filepos.moduleindex).sources_avail) then
|
||||
current_tokenpos.column:=0;
|
||||
|
||||
current_filepos:=current_tokenpos;
|
||||
end;
|
||||
ST_FILEINDEX:
|
||||
begin
|
||||
replaytokenbuf.read(current_tokenpos.fileindex,sizeof(current_tokenpos.fileindex));
|
||||
end
|
||||
else
|
||||
case specialtoken of
|
||||
ST_LOADSETTINGS:
|
||||
replaytokenbuf.read(current_settings,sizeof(current_settings));
|
||||
ST_LINE:
|
||||
begin
|
||||
replaytokenbuf.read(current_tokenpos.line,sizeof(current_tokenpos.line));
|
||||
|
||||
{ don't generate invalid line info if no sources are available for the current module }
|
||||
if not(get_module(current_filepos.moduleindex).sources_avail) then
|
||||
begin
|
||||
current_tokenpos.column:=0;
|
||||
{ don't generate invalid line info if no sources are available for the current module }
|
||||
if not(get_module(current_filepos.moduleindex).sources_avail) then
|
||||
current_tokenpos.line:=0;
|
||||
end;
|
||||
|
||||
current_filepos:=current_tokenpos;
|
||||
end;
|
||||
else
|
||||
internalerror(2006103010);
|
||||
end;
|
||||
current_filepos:=current_tokenpos;
|
||||
end;
|
||||
ST_COLUMN:
|
||||
begin
|
||||
replaytokenbuf.read(current_tokenpos.column,sizeof(current_tokenpos.column));
|
||||
|
||||
{ don't generate invalid line info if no sources are available for the current module }
|
||||
if not(get_module(current_filepos.moduleindex).sources_avail) then
|
||||
current_tokenpos.column:=0;
|
||||
|
||||
current_filepos:=current_tokenpos;
|
||||
end;
|
||||
ST_FILEINDEX:
|
||||
begin
|
||||
replaytokenbuf.read(current_tokenpos.fileindex,sizeof(current_tokenpos.fileindex));
|
||||
|
||||
{ don't generate invalid line info if no sources are available for the current module }
|
||||
if not(get_module(current_filepos.moduleindex).sources_avail) then
|
||||
begin
|
||||
current_tokenpos.column:=0;
|
||||
current_tokenpos.line:=0;
|
||||
end;
|
||||
|
||||
current_filepos:=current_tokenpos;
|
||||
end;
|
||||
else
|
||||
internalerror(2006103010);
|
||||
end;
|
||||
continue;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1081,32 +1081,38 @@ begin
|
||||
end;
|
||||
_GENERICSPECIALTOKEN:
|
||||
begin
|
||||
case tspecialgenerictoken(tokenbuf[i]) of
|
||||
ST_LOADSETTINGS:
|
||||
begin
|
||||
inc(i);
|
||||
write('Settings');
|
||||
inc(i,sizeof(tsettings));
|
||||
end;
|
||||
ST_LINE:
|
||||
begin
|
||||
inc(i);
|
||||
write('Line: ',pdword(@tokenbuf[i])^);
|
||||
inc(i,4);
|
||||
end;
|
||||
ST_COLUMN:
|
||||
begin
|
||||
inc(i);
|
||||
write('Col: ',pword(@tokenbuf[i])^);
|
||||
inc(i,2);
|
||||
end;
|
||||
ST_FILEINDEX:
|
||||
begin
|
||||
inc(i);
|
||||
write('File: ',pword(@tokenbuf[i])^);
|
||||
inc(i,2);
|
||||
end;
|
||||
end;
|
||||
if (tokenbuf[i] and $80)<>0 then
|
||||
begin
|
||||
write('Col: ',tokenbuf[i] and $7f);
|
||||
inc(i);
|
||||
end
|
||||
else
|
||||
case tspecialgenerictoken(tokenbuf[i]) of
|
||||
ST_LOADSETTINGS:
|
||||
begin
|
||||
inc(i);
|
||||
write('Settings');
|
||||
inc(i,sizeof(tsettings));
|
||||
end;
|
||||
ST_LINE:
|
||||
begin
|
||||
inc(i);
|
||||
write('Line: ',pdword(@tokenbuf[i])^);
|
||||
inc(i,4);
|
||||
end;
|
||||
ST_COLUMN:
|
||||
begin
|
||||
inc(i);
|
||||
write('Col: ',pword(@tokenbuf[i])^);
|
||||
inc(i,2);
|
||||
end;
|
||||
ST_FILEINDEX:
|
||||
begin
|
||||
inc(i);
|
||||
write('File: ',pword(@tokenbuf[i])^);
|
||||
inc(i,2);
|
||||
end;
|
||||
end;
|
||||
{
|
||||
replaytokenbuf.read(specialtoken,1);
|
||||
case specialtoken of
|
||||
@ -2143,7 +2149,7 @@ begin
|
||||
readcommondef('WideString definition',defoptions);
|
||||
writeln(space,' Length : ',getlongint);
|
||||
end;
|
||||
|
||||
|
||||
ibunicodestringdef :
|
||||
begin
|
||||
readcommondef('UnicodeString definition',defoptions);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user