compiler, rtl: write calling conventions for tkMethod members (issue #0014573)

git-svn-id: trunk@14508 -
This commit is contained in:
paul 2010-01-01 14:36:33 +00:00
parent 7592388858
commit 17bd267141
2 changed files with 45 additions and 5 deletions

View File

@ -625,6 +625,23 @@ implementation
procedure procvardef_rtti(def:tprocvardef);
const
ProcCallOptionToCallConv: array[tproccalloption] of byte = (
{ pocall_none } 0,
{ pocall_cdecl } 1,
{ pocall_cppdecl } 5,
{ pocall_far16 } 6,
{ pocall_oldfpccall } 7,
{ pocall_internproc } 8,
{ pocall_syscall } 9,
{ pocall_pascal } 2,
{ pocall_register } 0,
{ pocall_safecall } 4,
{ pocall_stdcall } 3,
{ pocall_softfloat } 10,
{ pocall_mwpascal } 11
);
procedure write_para(parasym:tparavarsym);
var
paraspec : byte;
@ -689,8 +706,22 @@ implementation
for i:=0 to def.paras.count-1 do
write_para(tparavarsym(def.paras[i]));
{ write name of result type }
write_rtti_name(def.returndef);
if methodkind=mkFunction then
begin
{ write name of result type }
write_rtti_name(def.returndef);
{ write result typeinfo }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.returndef,fullrtti)))
end;
{ write calling convention }
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(ProcCallOptionToCallConv[def.proccalloption]));
{ write params typeinfo }
for i:=0 to def.paras.count-1 do
if not(vo_is_hidden_para in tparavarsym(def.paras[i]).varoptions) then
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(tparavarsym(def.paras[i]).vardef,fullrtti)));
end
else
begin
@ -728,8 +759,7 @@ implementation
current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil));
{ write parent typeinfo }
if assigned(def.childof) and
(oo_can_have_published in def.childof.objectoptions) then
if assigned(def.childof) then
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.childof,fullrtti)))
else
current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil));

View File

@ -57,6 +57,13 @@ unit typinfo;
TIntfFlags = set of TIntfFlag;
TIntfFlagsBase = set of TIntfFlag;
// don't rely on integer values of TCallConv since it includes all conventions
// which both delphi and fpc support. In the future delphi can support more and
// fpc own conventions will be shifted/reordered accordinly
TCallConv = (ccReg, ccCdecl, ccPascal, ccStdCall, ccSafeCall,
ccCppdecl, ccFar16, ccOldFPCCall, ccInternProc,
ccSysCall, ccSoftFloat, ccMWPascal);
{$MINENUMSIZE DEFAULT}
const
@ -129,7 +136,10 @@ unit typinfo;
TypeName : ShortString;
end;
followed by
ResultType : ShortString}
ResultType : ShortString // for mkFunction only
ResultTypeRef : PPTypeInfo; // for mkFunction only
CC : TCallConv;
ParamTypeRefs : array[1..ParamCount] of PPTypeInfo;}
);
tkInt64:
(MinInt64Value, MaxInt64Value: Int64);