* alignment is now saved in the symtable

* C alignment added for records
  * PPU version increased to solve .12 <-> .13 probs
This commit is contained in:
peter 1999-07-23 16:05:18 +00:00
parent ca1ccd9221
commit 07bb58295b
12 changed files with 203 additions and 70 deletions

View File

@ -1097,7 +1097,7 @@ implementation
if porddef(ppointerdef(p^.left^.left^.resulttype)^.definition)=voiddef then
addvalue:=1
else
addvalue:=ppointerdef(p^.left^.left^.resulttype)^.definition^.savesize;
addvalue:=ppointerdef(p^.left^.left^.resulttype)^.definition^.size;
end;
else
internalerror(10081);
@ -1313,7 +1313,12 @@ implementation
end.
{
$Log$
Revision 1.62 1999-07-05 20:13:10 peter
Revision 1.63 1999-07-23 16:05:18 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.62 1999/07/05 20:13:10 peter
* removed temp defines
Revision 1.61 1999/07/03 14:14:27 florian

View File

@ -129,8 +129,8 @@ unit globals;
initmoduleswitches : tmoduleswitches;
initlocalswitches : tlocalswitches;
initmodeswitches : tmodeswitches;
initpackenum,
initpackrecords : longint;
initpackenum : longint;
initpackrecords : tpackrecords;
initoutputformat : tasm;
initoptprocessor : tprocessors;
initasmmode : tasmmode;
@ -139,8 +139,8 @@ unit globals;
aktmoduleswitches : tmoduleswitches;
aktlocalswitches : tlocalswitches;
aktmodeswitches : tmodeswitches;
aktpackenum,
aktpackrecords : longint;
aktpackenum : longint;
aktpackrecords : tpackrecords;
aktoutputformat : tasm;
aktoptprocessor : tprocessors;
aktasmmode : tasmmode;
@ -1172,7 +1172,7 @@ unit globals;
initglobalswitches:=[cs_check_unit_name,cs_link_static];
initmodeswitches:=fpcmodeswitches;
initpackenum:=4;
initpackrecords:=2;
initpackrecords:=packrecord_2;
initoutputformat:=target_asm.id;
initasmmode:=asmmode_i386_att;
initdefines.init;
@ -1184,7 +1184,7 @@ unit globals;
initglobalswitches:=[cs_check_unit_name,cs_link_static];
initmodeswitches:=fpcmodeswitches;
initpackenum:=4;
initpackrecords:=2;
initpackrecords:=packrecord_2;
initoutputformat:=as_m68k_as;
initasmmode:=asmmode_m68k_mot;
initdefines.init;
@ -1210,7 +1210,12 @@ begin
end.
{
$Log$
Revision 1.13 1999-07-18 10:19:52 florian
Revision 1.14 1999-07-23 16:05:19 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.13 1999/07/18 10:19:52 florian
* made it compilable with Dlephi 4 again
+ fixed problem with large stack allocations on win32

View File

@ -123,6 +123,19 @@ interface
bt_general,bt_type,bt_const
);
{ packrecords types }
tpackrecords = (packrecord_none,
packrecord_1,packrecord_2,packrecord_4,
packrecord_8,packrecord_16,packrecord_32,
packrecord_C
);
const
packrecordalignment : array[tpackrecords] of byte=(0,
1,2,4,8,16,32,1
);
type
stringid = string[maxidlen];
tnormalset = set of byte; { 256 elements set }
@ -149,7 +162,12 @@ begin
end.
{
$Log$
Revision 1.12 1999-07-10 10:26:19 peter
Revision 1.13 1999-07-23 16:05:21 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.12 1999/07/10 10:26:19 peter
* merged
Revision 1.11 1999/07/03 00:29:49 peter

View File

@ -181,7 +181,7 @@ unit parser;
oldaktlocalswitches : tlocalswitches;
oldaktmoduleswitches : tmoduleswitches;
oldaktfilepos : tfileposinfo;
oldaktpackrecords : word;
oldaktpackrecords : tpackrecords;
oldaktoutputformat : tasm;
oldaktoptprocessor : tprocessors;
oldaktasmmode : tasmmode;
@ -466,7 +466,12 @@ unit parser;
end.
{
$Log$
Revision 1.76 1999-07-22 09:37:49 florian
Revision 1.77 1999-07-23 16:05:22 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.76 1999/07/22 09:37:49 florian
+ resourcestring implemented
+ start of longstring support

View File

@ -1439,7 +1439,7 @@ unit pdecl;
intmessagetable:=genintmsgtab(aktclass)
else
datasegment^.concat(new(pai_const,init_32bit(0)));
{ table for string messages }
if (aktclass^.options and oo_hasmsgstr)<>0 then
@ -1533,24 +1533,24 @@ unit pdecl;
storetypeforwardsallowed : boolean;
begin
{ create recdef }
symtable:=new(psymtable,init(recordsymtable));
record_dec:=new(precdef,init(symtable));
{ update symtable stack }
symtable^.next:=symtablestack;
symtablestack:=symtable;
{ parse record }
consume(_RECORD);
storetypeforwardsallowed:=typecanbeforward;
if m_tp in aktmodeswitches then
typecanbeforward:=false;
read_var_decs(true,false,false);
{ may be scale record size to a size of n*4 ? }
if ((symtablestack^.datasize mod aktpackrecords)<>0) then
inc(symtablestack^.datasize,aktpackrecords-(symtablestack^.datasize mod aktpackrecords));
consume(_END);
typecanbeforward:=storetypeforwardsallowed;
{ may be scale record size to a size of n*4 ? }
symtablestack^.datasize:=align(symtablestack^.datasize,symtablestack^.dataalignment);
{ restore symtable stack }
symtablestack:=symtable^.next;
record_dec:=new(precdef,init(symtable));
end;
@ -1644,7 +1644,8 @@ unit pdecl;
aufsym : penumsym;
ap : parraydef;
s : stringid;
l,v,oldaktpackrecords : longint;
l,v : longint;
oldaktpackrecords : tpackrecords;
hs : string;
procedure expr_type;
@ -1894,7 +1895,7 @@ unit pdecl;
else
begin
oldaktpackrecords:=aktpackrecords;
aktpackrecords:=1;
aktpackrecords:=packrecord_1;
if token in [_CLASS,_OBJECT] then
p:=object_dec(name,nil)
else
@ -2187,7 +2188,12 @@ unit pdecl;
end.
{
$Log$
Revision 1.134 1999-07-22 09:37:50 florian
Revision 1.135 1999-07-23 16:05:23 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.134 1999/07/22 09:37:50 florian
+ resourcestring implemented
+ start of longstring support

View File

@ -37,7 +37,7 @@ type
{$endif Test_Double_checksum}
const
CurrentPPUVersion=16;
CurrentPPUVersion=17;
{ buffer sizes }
maxentrysize = 1024;
@ -386,7 +386,7 @@ begin
Id[3]:='U';
Ver[1]:='0';
Ver[2]:='1';
Ver[3]:='6';
Ver[3]:='7';
end;
end;
@ -871,7 +871,12 @@ end;
end.
{
$Log$
Revision 1.35 1999-07-05 16:21:30 peter
Revision 1.36 1999-07-23 16:05:25 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.35 1999/07/05 16:21:30 peter
* fixed linking for units without linking necessary
Revision 1.34 1999/07/03 00:29:57 peter

View File

@ -345,12 +345,12 @@ unit ptconst;
else
begin
{$ifdef i386}
for l:=0 to def^.savesize-1 do
for l:=0 to def^.size-1 do
curconstsegment^.concat(new(pai_const,init_8bit(p^.value_set^[l])));
{$endif}
{$ifdef m68k}
j:=0;
for l:=0 to ((def^.savesize-1) div 4) do
for l:=0 to ((def^.size-1) div 4) do
{ HORRIBLE HACK because of endian }
{ now use intel endian for constant sets }
begin
@ -725,7 +725,12 @@ unit ptconst;
end.
{
$Log$
Revision 1.47 1999-07-03 14:14:28 florian
Revision 1.48 1999-07-23 16:05:26 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.47 1999/07/03 14:14:28 florian
+ start of val(int64/qword)
* longbool, wordbool constants weren't written, fixed

View File

@ -749,20 +749,23 @@ const
if not(c in ['0'..'9']) then
begin
hs:=current_scanner^.readid;
if (hs='NORMAL') or (hs='DEFAULT') then
aktpackrecords:=2
if (hs='C') then
aktpackrecords:=packrecord_C
else
if (hs='NORMAL') or (hs='DEFAULT') then
aktpackrecords:=packrecord_2
else
Message(scan_w_only_pack_records);
end
else
begin
case current_scanner^.readval of
1 : aktpackrecords:=1;
2 : aktpackrecords:=2;
4 : aktpackrecords:=4;
8 : aktpackrecords:=8;
16 : aktpackrecords:=16;
32 : aktpackrecords:=32;
1 : aktpackrecords:=packrecord_1;
2 : aktpackrecords:=packrecord_2;
4 : aktpackrecords:=packrecord_4;
8 : aktpackrecords:=packrecord_8;
16 : aktpackrecords:=packrecord_16;
32 : aktpackrecords:=packrecord_32;
else
Message(scan_w_only_pack_records);
end;
@ -1085,7 +1088,12 @@ const
{
$Log$
Revision 1.55 1999-07-16 10:04:36 peter
Revision 1.56 1999-07-23 16:05:27 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.55 1999/07/16 10:04:36 peter
* merged
Revision 1.54 1999/07/03 00:29:58 peter

View File

@ -241,6 +241,13 @@
end;
function tdef.alignment : longint;
begin
{ normal alignment by default }
alignment:=0;
end;
{$ifdef GDB}
procedure tdef.set_globalnb;
begin
@ -1779,6 +1786,13 @@
end;
function tarraydef.alignment : longint;
begin
{ alignment is the size of the elements }
alignment:=definition^.size;
end;
function tarraydef.needs_inittable : boolean;
begin
needs_inittable:=definition^.needs_inittable;
@ -1831,6 +1845,7 @@
symtable:=p;
savesize:=symtable^.datasize;
symtable^.defowner := @self;
symtable^.dataalignment:=packrecordalignment[aktpackrecords];
end;
@ -1851,10 +1866,12 @@
destructor trecdef.done;
begin
if assigned(symtable) then dispose(symtable,done);
if assigned(symtable) then
dispose(symtable,done);
inherited done;
end;
var
binittable : boolean;
@ -1909,6 +1926,16 @@
read_member:=oldread_member;
end;
function trecdef.size:longint;
begin
size:=symtable^.datasize;
end;
function trecdef.alignment:longint;
begin
alignment:=symtable^.dataalignment;
end;
{$ifdef GDB}
Const StabRecString : pchar = Nil;
@ -2862,16 +2889,11 @@ Const local_symtable_index : longint = $8001;
publicsyms:=new(psymtable,init(objectsymtable));
publicsyms^.name := stringdup(n);
{ create space for vmt !! }
{$ifdef OLDVMTSTYLE}
publicsyms^.datasize:=target_os.size_of_pointer;
options:=oo_hasvmt;
vmt_offset:=0;
{$else }
options:=0;
vmt_offset:=0;
publicsyms^.datasize:=0;
{$endif }
publicsyms^.defowner:=@self;
publicsyms^.dataalignment:=packrecordalignment[aktpackrecords];
set_parent(c);
objname:=stringdup(n);
end;
@ -2944,15 +2966,16 @@ Const local_symtable_index : longint = $8001;
else
begin
{ first round up to multiple of 4 }
if (aktpackrecords=2) then
if (publicsyms^.dataalignment=2) then
begin
if (publicsyms^.datasize and 1)<>0 then
inc(publicsyms^.datasize);
end;
if (aktpackrecords>=4) then
end
else
if (publicsyms^.dataalignment>=4) then
begin
if (publicsyms^.datasize mod 4) <> 0 then
publicsyms^.datasize:=publicsyms^.datasize+4-(publicsyms^.datasize mod 4);
if (publicsyms^.datasize mod 4) <> 0 then
publicsyms^.datasize:=publicsyms^.datasize+4-(publicsyms^.datasize mod 4);
end;
vmt_offset:=publicsyms^.datasize;
publicsyms^.datasize:=publicsyms^.datasize+target_os.size_of_pointer;
@ -3002,14 +3025,19 @@ Const local_symtable_index : longint = $8001;
end;
function tobjectdef.size : longint;
begin
function tobjectdef.size : longint;
begin
if (options and oo_is_class)<>0 then
size:=target_os.size_of_pointer
else
size:=publicsyms^.datasize;
end;
end;
function tobjectdef.alignment:longint;
begin
alignment:=publicsyms^.dataalignment;
end;
procedure tobjectdef.deref;
@ -3467,7 +3495,12 @@ Const local_symtable_index : longint = $8001;
{
$Log$
Revision 1.132 1999-07-18 14:47:32 florian
Revision 1.133 1999-07-23 16:05:28 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.132 1999/07/18 14:47:32 florian
* bug 487 fixed, (inc(<property>) isn't allowed)
* more fixes to compile with Delphi

View File

@ -32,9 +32,8 @@
pdef = ^tdef;
tdef = object(tsymtableentry)
deftype : tdeftype;
savesize : longint;
sym : ptypesym; { which type the definition was generated this def }
deftype : tdeftype;
sym : ptypesym; { which type the definition was generated this def }
has_inittable : boolean;
{ adress of init informations }
@ -59,6 +58,7 @@
function typename:string;
procedure write;virtual;
function size:longint;virtual;
function alignment:longint;virtual;
{$ifdef GDB}
function NumberString:string;
procedure set_globalnb;
@ -91,6 +91,8 @@
function is_publishable : boolean;virtual;
function is_in_current : boolean;
function gettypename:string;virtual;
private
savesize : longint;
end;
targconvtyp = (act_convertable,act_equal,act_exact);
@ -173,8 +175,6 @@
tobjectdef = object(tdef)
childof : pobjectdef;
objname : pstring;
{ privatesyms : psymtable;
protectedsyms : psymtable; }
publicsyms : psymtable;
options : longint;
{ to be able to have a variable vmt position }
@ -185,6 +185,7 @@
procedure check_forwards;
function isrelated(d : pobjectdef) : boolean;
function size : longint;virtual;
function alignment:longint;virtual;
constructor load;
procedure write;virtual;
function vmt_mangledname : string;
@ -246,6 +247,7 @@
{$endif GDB}
procedure deref;virtual;
function size : longint;virtual;
function alignment : longint;virtual;
{ generates the ranges needed by the asm instruction BOUND (i386)
or CMP2 (Motorola) }
procedure genrangecheck;
@ -264,6 +266,8 @@
constructor load;
destructor done;virtual;
procedure write;virtual;
function size:longint;virtual;
function alignment : longint;virtual;
{$ifdef GDB}
function stabstring : pchar;virtual;
procedure concatstabto(asmlist : paasmoutput);virtual;
@ -521,7 +525,12 @@
{
$Log$
Revision 1.33 1999-06-22 16:24:45 pierre
Revision 1.34 1999-07-23 16:05:30 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.33 1999/06/22 16:24:45 pierre
* local browser stuff corrected
Revision 1.32 1999/06/02 10:11:51 florian

View File

@ -1035,6 +1035,7 @@
procedure tvarsym.insert_in_data;
var
varalign,
l,ali,modulo : longint;
storefilepos : tfileposinfo;
begin
@ -1147,42 +1148,61 @@
begin
{ this symbol can't be loaded to a register }
var_options:=var_options and not vo_regable;
{ get the alignment size }
if (aktpackrecords=packrecord_C) and
(owner^.dataalignment<4) then
begin
varalign:=definition^.alignment;
if varalign>0 then
begin
if varalign>owner^.dataalignment then
owner^.dataalignment:=varalign;
end
else
begin
if l>=4 then
owner^.dataalignment:=4
else
if l>=2 then
owner^.dataalignment:=2;
end;
end;
{ align record and object fields }
if (l=1) or (aktpackrecords=1) then
if (l=1) or (owner^.dataalignment=1) then
begin
address:=owner^.datasize;
inc(owner^.datasize,l)
end
else
if (l=2) or (aktpackrecords=2) then
if (l=2) or (owner^.dataalignment=2) then
begin
owner^.datasize:=(owner^.datasize+1) and (not 1);
address:=owner^.datasize;
inc(owner^.datasize,l)
end
else
if (l<=4) or (aktpackrecords=4) then
if (l<=4) or (owner^.dataalignment=4) then
begin
owner^.datasize:=(owner^.datasize+3) and (not 3);
address:=owner^.datasize;
inc(owner^.datasize,l);
end
else
if (l<=8) or (aktpackrecords=8) then
if (l<=8) or (owner^.dataalignment=8) then
begin
owner^.datasize:=(owner^.datasize+7) and (not 7);
address:=owner^.datasize;
inc(owner^.datasize,l);
end
else
if (l<=16) or (aktpackrecords=16) then
if (l<=16) or (owner^.dataalignment=16) then
begin
owner^.datasize:=(owner^.datasize+15) and (not 15);
address:=owner^.datasize;
inc(owner^.datasize,l);
end
else
if (l<=32) or (aktpackrecords=32) then
if (l<=32) or (owner^.dataalignment=32) then
begin
owner^.datasize:=(owner^.datasize+31) and (not 31);
address:=owner^.datasize;
@ -1982,7 +2002,12 @@
{
$Log$
Revision 1.99 1999-07-23 11:33:23 peter
Revision 1.100 1999-07-23 16:05:32 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.99 1999/07/23 11:33:23 peter
* removed oldppu from propertysym
Revision 1.98 1999/07/22 09:37:55 florian

View File

@ -147,6 +147,7 @@ unit symtable;
unitid : integer; { each symtable gets a number }
name : pstring;
datasize : longint;
dataalignment : longint;
symindex,
defindex : pindexarray;
symsearch : pdictionary;
@ -1028,6 +1029,7 @@ implementation
name:=nil;
address_fixup:=0;
datasize:=0;
dataalignment:=1;
new(symindex,init(indexgrowsize));
new(defindex,init(indexgrowsize));
if symtabletype<>withsymtable then
@ -1150,8 +1152,9 @@ implementation
Message(unit_f_ppu_read_error);
{ skip amount of symbols, not used currently }
current_ppu^.getlongint;
{ load datasize of this symboltable }
{ load datasize,dataalignment of this symboltable }
datasize:=current_ppu^.getlongint;
dataalignment:=current_ppu^.getlongint;
{ now read the symbols }
repeat
b:=current_ppu^.readentry;
@ -1208,6 +1211,7 @@ implementation
datasize to the ibsymdef entry }
current_ppu^.putlongint(symindex^.count);
current_ppu^.putlongint(datasize);
current_ppu^.putlongint(dataalignment);
current_ppu^.writeentry(ibstartsyms);
{ foreach is used to write all symbols }
pd:=psym(symindex^.first);
@ -2334,7 +2338,12 @@ implementation
end.
{
$Log$
Revision 1.28 1999-07-23 12:02:20 peter
Revision 1.29 1999-07-23 16:05:33 peter
* alignment is now saved in the symtable
* C alignment added for records
* PPU version increased to solve .12 <-> .13 probs
Revision 1.28 1999/07/23 12:02:20 peter
* fixed crash in previous commit
Revision 1.27 1999/07/23 11:37:50 peter