mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-05 19:10:15 +02:00
* use shortint for alignments
* remove obsolete position check in tgobj, with the new alignment settings this is not possible anymore git-svn-id: trunk@2984 -
This commit is contained in:
parent
ec768f88ae
commit
9c6a296b86
@ -78,7 +78,7 @@ interface
|
|||||||
procedure derefimpl;override;
|
procedure derefimpl;override;
|
||||||
function size:aint;override;
|
function size:aint;override;
|
||||||
function getvartype:longint;override;
|
function getvartype:longint;override;
|
||||||
function alignment:longint;override;
|
function alignment:shortint;override;
|
||||||
function is_publishable : boolean;override;
|
function is_publishable : boolean;override;
|
||||||
function needs_inittable : boolean;override;
|
function needs_inittable : boolean;override;
|
||||||
{ rtti generation }
|
{ rtti generation }
|
||||||
@ -200,8 +200,8 @@ interface
|
|||||||
procedure buildderef;override;
|
procedure buildderef;override;
|
||||||
procedure deref;override;
|
procedure deref;override;
|
||||||
function size:aint;override;
|
function size:aint;override;
|
||||||
function alignment : longint;override;
|
function alignment : shortint;override;
|
||||||
function padalignment: longint;
|
function padalignment: shortint;
|
||||||
function gettypename:string;override;
|
function gettypename:string;override;
|
||||||
{ debug }
|
{ debug }
|
||||||
function needs_inittable : boolean;override;
|
function needs_inittable : boolean;override;
|
||||||
@ -260,7 +260,7 @@ interface
|
|||||||
procedure deref;override;
|
procedure deref;override;
|
||||||
function getparentdef:tdef;override;
|
function getparentdef:tdef;override;
|
||||||
function size : aint;override;
|
function size : aint;override;
|
||||||
function alignment:longint;override;
|
function alignment:shortint;override;
|
||||||
function vmtmethodoffset(index:longint):longint;
|
function vmtmethodoffset(index:longint):longint;
|
||||||
function members_need_inittable : boolean;
|
function members_need_inittable : boolean;
|
||||||
{ this should be called when this class implements an interface }
|
{ this should be called when this class implements an interface }
|
||||||
@ -348,7 +348,7 @@ interface
|
|||||||
procedure buildderef;override;
|
procedure buildderef;override;
|
||||||
procedure deref;override;
|
procedure deref;override;
|
||||||
function size : aint;override;
|
function size : aint;override;
|
||||||
function alignment : longint;override;
|
function alignment : shortint;override;
|
||||||
{ returns the label of the range check string }
|
{ returns the label of the range check string }
|
||||||
function needs_inittable : boolean;override;
|
function needs_inittable : boolean;override;
|
||||||
procedure write_child_rtti_data(rt:trttitype);override;
|
procedure write_child_rtti_data(rt:trttitype);override;
|
||||||
@ -365,7 +365,7 @@ interface
|
|||||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||||
function is_publishable : boolean;override;
|
function is_publishable : boolean;override;
|
||||||
function gettypename:string;override;
|
function gettypename:string;override;
|
||||||
function alignment:longint;override;
|
function alignment:shortint;override;
|
||||||
procedure setsize;
|
procedure setsize;
|
||||||
function getvartype : longint;override;
|
function getvartype : longint;override;
|
||||||
{ rtti }
|
{ rtti }
|
||||||
@ -380,7 +380,7 @@ interface
|
|||||||
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
procedure ppuwrite(ppufile:tcompilerppufile);override;
|
||||||
function gettypename:string;override;
|
function gettypename:string;override;
|
||||||
function is_publishable : boolean;override;
|
function is_publishable : boolean;override;
|
||||||
function alignment:longint;override;
|
function alignment:shortint;override;
|
||||||
procedure setsize;
|
procedure setsize;
|
||||||
function getvartype:longint;override;
|
function getvartype:longint;override;
|
||||||
{ rtti }
|
{ rtti }
|
||||||
@ -579,7 +579,7 @@ interface
|
|||||||
function gettypename:string;override;
|
function gettypename:string;override;
|
||||||
function getmangledparaname:string;override;
|
function getmangledparaname:string;override;
|
||||||
function is_publishable : boolean;override;
|
function is_publishable : boolean;override;
|
||||||
function alignment : longint;override;
|
function alignment : shortint;override;
|
||||||
{ init/final }
|
{ init/final }
|
||||||
function needs_inittable : boolean;override;
|
function needs_inittable : boolean;override;
|
||||||
{ rtti }
|
{ rtti }
|
||||||
@ -1075,7 +1075,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tstoreddef.alignment : longint;
|
function tstoreddef.alignment : shortint;
|
||||||
begin
|
begin
|
||||||
{ natural alignment by default }
|
{ natural alignment by default }
|
||||||
alignment:=size_2_align(savesize);
|
alignment:=size_2_align(savesize);
|
||||||
@ -1317,7 +1317,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tstringdef.alignment : longint;
|
function tstringdef.alignment : shortint;
|
||||||
begin
|
begin
|
||||||
case string_typ of
|
case string_typ of
|
||||||
st_widestring,
|
st_widestring,
|
||||||
@ -1622,7 +1622,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function torddef.alignment:longint;
|
function torddef.alignment:shortint;
|
||||||
begin
|
begin
|
||||||
if (target_info.system = system_i386_darwin) and
|
if (target_info.system = system_i386_darwin) and
|
||||||
(typ in [s64bit,u64bit]) then
|
(typ in [s64bit,u64bit]) then
|
||||||
@ -1798,7 +1798,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tfloatdef.alignment:longint;
|
function tfloatdef.alignment:shortint;
|
||||||
begin
|
begin
|
||||||
if (target_info.system = system_i386_darwin) then
|
if (target_info.system = system_i386_darwin) then
|
||||||
case typ of
|
case typ of
|
||||||
@ -2539,7 +2539,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tarraydef.alignment : longint;
|
function tarraydef.alignment : shortint;
|
||||||
begin
|
begin
|
||||||
{ alignment is the size of the elements }
|
{ alignment is the size of the elements }
|
||||||
if (elementtype.def.deftype in [arraydef,recorddef]) or
|
if (elementtype.def.deftype in [arraydef,recorddef]) or
|
||||||
@ -2784,13 +2784,13 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function trecorddef.alignment:longint;
|
function trecorddef.alignment:shortint;
|
||||||
begin
|
begin
|
||||||
alignment:=trecordsymtable(symtable).recordalignment;
|
alignment:=trecordsymtable(symtable).recordalignment;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function trecorddef.padalignment:longint;
|
function trecorddef.padalignment:shortint;
|
||||||
begin
|
begin
|
||||||
padalignment := trecordsymtable(symtable).padalignment;
|
padalignment := trecordsymtable(symtable).padalignment;
|
||||||
end;
|
end;
|
||||||
@ -4594,7 +4594,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function tobjectdef.alignment:longint;
|
function tobjectdef.alignment:shortint;
|
||||||
begin
|
begin
|
||||||
if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba] then
|
if objecttype in [odt_class,odt_interfacecom,odt_interfacecorba] then
|
||||||
alignment:=sizeof(aint)
|
alignment:=sizeof(aint)
|
||||||
|
@ -86,7 +86,7 @@ interface
|
|||||||
function mangledparaname:string;
|
function mangledparaname:string;
|
||||||
function getmangledparaname:string;virtual;
|
function getmangledparaname:string;virtual;
|
||||||
function size:aint;virtual;abstract;
|
function size:aint;virtual;abstract;
|
||||||
function alignment:longint;virtual;abstract;
|
function alignment:shortint;virtual;abstract;
|
||||||
function getvartype:longint;virtual;abstract;
|
function getvartype:longint;virtual;abstract;
|
||||||
function getparentdef:tdef;virtual;
|
function getparentdef:tdef;virtual;
|
||||||
function getsymtable(t:tgetsymtable):tsymtable;virtual;
|
function getsymtable(t:tgetsymtable):tsymtable;virtual;
|
||||||
|
@ -173,14 +173,7 @@ implementation
|
|||||||
procedure ttgobj.resettempgen;
|
procedure ttgobj.resettempgen;
|
||||||
var
|
var
|
||||||
hp : ptemprecord;
|
hp : ptemprecord;
|
||||||
{$ifdef EXTDEBUG}
|
|
||||||
currpos,
|
|
||||||
lastpos : longint;
|
|
||||||
{$endif EXTDEBUG}
|
|
||||||
begin
|
begin
|
||||||
{$ifdef EXTDEBUG}
|
|
||||||
lastpos:=lasttemp;
|
|
||||||
{$endif EXTDEBUG}
|
|
||||||
{ Clear the old templist }
|
{ Clear the old templist }
|
||||||
while assigned(templist) do
|
while assigned(templist) do
|
||||||
begin
|
begin
|
||||||
@ -192,21 +185,6 @@ implementation
|
|||||||
' from pos '+tostr(templist^.posinfo.line)+':'+tostr(templist^.posinfo.column)+
|
' from pos '+tostr(templist^.posinfo.line)+':'+tostr(templist^.posinfo.column)+
|
||||||
' not freed at the end of the procedure');
|
' not freed at the end of the procedure');
|
||||||
end;
|
end;
|
||||||
if direction=1 then
|
|
||||||
currpos:=templist^.pos+templist^.size
|
|
||||||
else
|
|
||||||
currpos:=templist^.pos;
|
|
||||||
if currpos<>lastpos then
|
|
||||||
begin
|
|
||||||
Comment(V_Warning,'tgobj: (ResetTempgen) temp at pos '+tostr(templist^.pos)+
|
|
||||||
' with size '+tostr(templist^.size)+' and type '+TempTypeStr[templist^.temptype]+
|
|
||||||
' from pos '+tostr(templist^.posinfo.line)+':'+tostr(templist^.posinfo.column)+
|
|
||||||
' was expected at position '+tostr(lastpos));
|
|
||||||
end;
|
|
||||||
if direction=1 then
|
|
||||||
lastpos:=templist^.pos
|
|
||||||
else
|
|
||||||
lastpos:=templist^.pos+templist^.size;
|
|
||||||
{$endif EXTDEBUG}
|
{$endif EXTDEBUG}
|
||||||
hp:=templist;
|
hp:=templist;
|
||||||
templist:=hp^.next;
|
templist:=hp^.next;
|
||||||
@ -475,7 +453,7 @@ implementation
|
|||||||
|
|
||||||
procedure ttgobj.gettemp(list: TAsmList; size : longint;temptype:ttemptype;var ref : treference);
|
procedure ttgobj.gettemp(list: TAsmList; size : longint;temptype:ttemptype;var ref : treference);
|
||||||
var
|
var
|
||||||
varalign : longint;
|
varalign : shortint;
|
||||||
begin
|
begin
|
||||||
varalign:=size_2_align(size);
|
varalign:=size_2_align(size);
|
||||||
varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax);
|
varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax);
|
||||||
@ -489,7 +467,7 @@ implementation
|
|||||||
|
|
||||||
procedure ttgobj.gettemptyped(list: TAsmList; def:tdef;temptype:ttemptype;var ref : treference);
|
procedure ttgobj.gettemptyped(list: TAsmList; def:tdef;temptype:ttemptype;var ref : treference);
|
||||||
var
|
var
|
||||||
varalign : longint;
|
varalign : shortint;
|
||||||
begin
|
begin
|
||||||
varalign:=def.alignment;
|
varalign:=def.alignment;
|
||||||
varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax);
|
varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax);
|
||||||
@ -599,7 +577,7 @@ implementation
|
|||||||
|
|
||||||
procedure ttgobj.getlocal(list: TAsmList; size : longint;def:tdef;var ref : treference);
|
procedure ttgobj.getlocal(list: TAsmList; size : longint;def:tdef;var ref : treference);
|
||||||
var
|
var
|
||||||
varalign : longint;
|
varalign : shortint;
|
||||||
begin
|
begin
|
||||||
varalign:=def.alignment;
|
varalign:=def.alignment;
|
||||||
varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax);
|
varalign:=used_align(varalign,aktalignment.localalignmin,aktalignment.localalignmax);
|
||||||
|
Loading…
Reference in New Issue
Block a user