mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-27 09:08:05 +02:00
* converted TVMTWriter.intf_write_table() to the high level typed constant
builder o removed variant record part in the RTL to force a specific size/alignment, since we now import the record into the compiler and hence it will always be handled correctly git-svn-id: branches/hlcgllvm@28777 -
This commit is contained in:
parent
634d2931e2
commit
427b05e97c
@ -66,7 +66,7 @@ interface
|
|||||||
{ interface tables }
|
{ interface tables }
|
||||||
function intf_get_vtbl_name(AImplIntf:TImplementedInterface): string;
|
function intf_get_vtbl_name(AImplIntf:TImplementedInterface): string;
|
||||||
procedure intf_create_vtbl(rawdata: TAsmList;AImplIntf:TImplementedInterface);
|
procedure intf_create_vtbl(rawdata: TAsmList;AImplIntf:TImplementedInterface);
|
||||||
procedure intf_gen_intf_ref(rawdata: TAsmList;AImplIntf:TImplementedInterface);
|
procedure intf_gen_intf_ref(tcb: ttai_typedconstbuilder; AImplIntf: TImplementedInterface; interfaceentrydef, interfaceentrytypedef: tdef);
|
||||||
function intf_write_table(list : TAsmList):TAsmLabel;
|
function intf_write_table(list : TAsmList):TAsmLabel;
|
||||||
{ get a table def of the form
|
{ get a table def of the form
|
||||||
record
|
record
|
||||||
@ -748,44 +748,47 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TVMTWriter.intf_gen_intf_ref(rawdata: TAsmList;AImplIntf:TImplementedInterface);
|
procedure TVMTWriter.intf_gen_intf_ref(tcb: ttai_typedconstbuilder; AImplIntf: TImplementedInterface; interfaceentrydef, interfaceentrytypedef: tdef);
|
||||||
var
|
var
|
||||||
pd: tprocdef;
|
pd: tprocdef;
|
||||||
begin
|
begin
|
||||||
|
tcb.maybe_begin_aggregate(interfaceentrydef);
|
||||||
{ GUID (or nil for Corba interfaces) }
|
{ GUID (or nil for Corba interfaces) }
|
||||||
if AImplIntf.IntfDef.objecttype in [odt_interfacecom] then
|
if AImplIntf.IntfDef.objecttype in [odt_interfacecom] then
|
||||||
rawdata.concat(Tai_const.CreateName(
|
tcb.emit_tai(Tai_const.CreateName(
|
||||||
make_mangledname('IID',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0))
|
make_mangledname('IID',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0),getpointerdef(rec_tguid))
|
||||||
else
|
else
|
||||||
rawdata.concat(Tai_const.Create_nil_dataptr);
|
tcb.emit_tai(Tai_const.Create_nil_dataptr,getpointerdef(rec_tguid));
|
||||||
|
|
||||||
{ VTable }
|
{ VTable }
|
||||||
rawdata.concat(Tai_const.Createname(intf_get_vtbl_name(AImplIntf.VtblImplIntf),AT_DATA,0));
|
tcb.queue_init(voidpointertype);
|
||||||
|
tcb.queue_emit_asmsym(current_asmdata.RefAsmSymbol(intf_get_vtbl_name(AImplIntf.VtblImplIntf),AT_DATA),AImplIntf.VtblImplIntf.IntfDef);
|
||||||
{ IOffset field }
|
{ IOffset field }
|
||||||
case AImplIntf.VtblImplIntf.IType of
|
case AImplIntf.VtblImplIntf.IType of
|
||||||
etFieldValue, etFieldValueClass,
|
etFieldValue, etFieldValueClass,
|
||||||
etStandard:
|
etStandard:
|
||||||
rawdata.concat(Tai_const.Create_pint(AImplIntf.VtblImplIntf.IOffset));
|
tcb.emit_tai(Tai_const.Create_pint(AImplIntf.VtblImplIntf.IOffset),ptruinttype);
|
||||||
etStaticMethodResult, etStaticMethodClass:
|
etStaticMethodResult, etStaticMethodClass:
|
||||||
rawdata.concat(Tai_const.Createname(
|
begin
|
||||||
tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef).mangledname,
|
pd:=tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef);
|
||||||
AT_FUNCTION,
|
tcb.queue_init(ptruinttype);
|
||||||
0
|
tcb.queue_emit_proc(pd);
|
||||||
));
|
end;
|
||||||
etVirtualMethodResult, etVirtualMethodClass:
|
etVirtualMethodResult, etVirtualMethodClass:
|
||||||
begin
|
begin
|
||||||
pd := tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef);
|
pd:=tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef);
|
||||||
rawdata.concat(Tai_const.Create_pint(tobjectdef(pd.struct).vmtmethodoffset(pd.extnumber)));
|
tcb.emit_tai(Tai_const.Create_pint(tobjectdef(pd.struct).vmtmethodoffset(pd.extnumber)),ptruinttype);
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
internalerror(200802162);
|
internalerror(200802162);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ IIDStr }
|
{ IIDStr }
|
||||||
rawdata.concat(Tai_const.CreateName(
|
tcb.emit_tai(Tai_const.CreateName(
|
||||||
make_mangledname('IIDSTR',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0));
|
make_mangledname('IIDSTR',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0),getpointerdef(getarraydef(cansichartype,length(AImplIntf.IntfDef.iidstr^)+1)));
|
||||||
{ IType }
|
{ IType }
|
||||||
rawdata.concat(Tai_const.Create_pint(aint(AImplIntf.VtblImplIntf.IType)));
|
tcb.emit_ord_const(aint(AImplIntf.VtblImplIntf.IType),interfaceentrytypedef);
|
||||||
|
tcb.maybe_end_aggregate(interfaceentrydef);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -793,17 +796,29 @@ implementation
|
|||||||
var
|
var
|
||||||
i : longint;
|
i : longint;
|
||||||
ImplIntf : TImplementedInterface;
|
ImplIntf : TImplementedInterface;
|
||||||
|
tcb : ttai_typedconstbuilder;
|
||||||
|
tabledef : tdef;
|
||||||
|
interfaceentrydef : tdef;
|
||||||
|
interfaceentrytypedef: tdef;
|
||||||
|
interfacearray: tdef;
|
||||||
begin
|
begin
|
||||||
current_asmdata.getlabel(result,alt_data);
|
current_asmdata.getlabel(result,alt_data);
|
||||||
list.concat(cai_align.create(const_align(sizeof(pint))));
|
tcb:=ctai_typedconstbuilder.create;
|
||||||
list.concat(Tai_label.Create(result));
|
tcb.begin_anonymous_record('',0);
|
||||||
list.concat(Tai_const.Create_pint(_class.ImplementedInterfaces.count));
|
tcb.emit_tai(Tai_const.Create_pint(_class.ImplementedInterfaces.count),search_system_type('SIZEUINT').typedef);
|
||||||
|
interfaceentrydef:=search_system_type('TINTERFACEENTRY').typedef;
|
||||||
|
interfaceentrytypedef:=search_system_type('TINTERFACEENTRYTYPE').typedef;
|
||||||
|
interfacearray:=getarraydef(interfaceentrydef,_class.ImplementedInterfaces.count);
|
||||||
|
tcb.maybe_begin_aggregate(interfacearray);
|
||||||
{ Write vtbl references }
|
{ Write vtbl references }
|
||||||
for i:=0 to _class.ImplementedInterfaces.count-1 do
|
for i:=0 to _class.ImplementedInterfaces.count-1 do
|
||||||
begin
|
begin
|
||||||
ImplIntf:=TImplementedInterface(_class.ImplementedInterfaces[i]);
|
ImplIntf:=TImplementedInterface(_class.ImplementedInterfaces[i]);
|
||||||
intf_gen_intf_ref(list,ImplIntf);
|
intf_gen_intf_ref(tcb,ImplIntf,interfaceentrydef,interfaceentrytypedef);
|
||||||
end;
|
end;
|
||||||
|
tcb.maybe_end_aggregate(interfacearray);
|
||||||
|
tabledef:=tcb.end_anonymous_record;
|
||||||
|
list.concatlist(tcb.get_final_asmlist(result,tabledef,sec_rodata,'',tabledef.alignment,[tcalo_is_lab]));
|
||||||
|
|
||||||
{ Write vtbls }
|
{ Write vtbls }
|
||||||
for i:=0 to _class.ImplementedInterfaces.count-1 do
|
for i:=0 to _class.ImplementedInterfaces.count-1 do
|
||||||
@ -812,6 +827,7 @@ implementation
|
|||||||
if ImplIntf.VtblImplIntf=ImplIntf then
|
if ImplIntf.VtblImplIntf=ImplIntf then
|
||||||
intf_create_vtbl(list,ImplIntf);
|
intf_create_vtbl(list,ImplIntf);
|
||||||
end;
|
end;
|
||||||
|
tcb.free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,6 +166,7 @@
|
|||||||
VTable : Pointer;
|
VTable : Pointer;
|
||||||
IOffset : sizeuint;
|
IOffset : sizeuint;
|
||||||
IIDStr : pshortstring; { never nil. Com: upper(GuidToString(IID^)) }
|
IIDStr : pshortstring; { never nil. Com: upper(GuidToString(IID^)) }
|
||||||
|
{$ifdef VER2_6}
|
||||||
case boolean of
|
case boolean of
|
||||||
{$ifdef ENDIAN_BIG}
|
{$ifdef ENDIAN_BIG}
|
||||||
true : ({$IFDEF CPU64}__pad: longint;{$ENDIF}IType : tinterfaceentrytype);
|
true : ({$IFDEF CPU64}__pad: longint;{$ENDIF}IType : tinterfaceentrytype);
|
||||||
@ -173,6 +174,9 @@
|
|||||||
true : (IType : tinterfaceentrytype);
|
true : (IType : tinterfaceentrytype);
|
||||||
{$endif ENDIAN_BIG}
|
{$endif ENDIAN_BIG}
|
||||||
false : (__pad_dummy : sizeint);
|
false : (__pad_dummy : sizeint);
|
||||||
|
{$else VER2_6}
|
||||||
|
IType : tinterfaceentrytype;
|
||||||
|
{$endif VER2_6}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
tinterfacetable = record
|
tinterfacetable = record
|
||||||
|
Loading…
Reference in New Issue
Block a user