nobj.pas 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Routines for the code generation of data structures
  5. like VMT, Messages, VTables, Interfaces descs
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit nobj;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. cutils,cclasses,
  24. symdef,aasmbase,aasmtai,aasmcpu;
  25. type
  26. pprocdeftree = ^tprocdeftree;
  27. tprocdeftree = record
  28. data : tprocdef;
  29. nl : tasmlabel;
  30. l,r : pprocdeftree;
  31. end;
  32. pprocdefcoll = ^tprocdefcoll;
  33. tprocdefcoll = record
  34. data : tprocdef;
  35. hidden : boolean;
  36. next : pprocdefcoll;
  37. end;
  38. psymcoll = ^tsymcoll;
  39. tsymcoll = record
  40. name : pstring;
  41. data : pprocdefcoll;
  42. next : psymcoll;
  43. end;
  44. tclassheader=class
  45. private
  46. _Class : tobjectdef;
  47. count : integer;
  48. private
  49. { message tables }
  50. root : pprocdeftree;
  51. procedure disposeprocdeftree(p : pprocdeftree);
  52. procedure insertmsgint(p : tnamedindexitem;arg:pointer);
  53. procedure insertmsgstr(p : tnamedindexitem;arg:pointer);
  54. procedure insertint(p : pprocdeftree;var at : pprocdeftree);
  55. procedure insertstr(p : pprocdeftree;var at : pprocdeftree);
  56. procedure writenames(p : pprocdeftree);
  57. procedure writeintentry(p : pprocdeftree);
  58. procedure writestrentry(p : pprocdeftree);
  59. {$ifdef WITHDMT}
  60. private
  61. { dmt }
  62. procedure insertdmtentry(p : tnamedindexitem;arg:pointer);
  63. procedure writedmtindexentry(p : pprocdeftree);
  64. procedure writedmtaddressentry(p : pprocdeftree);
  65. {$endif}
  66. private
  67. { published methods }
  68. procedure do_count(p : tnamedindexitem;arg:pointer);
  69. procedure genpubmethodtableentry(p : tnamedindexitem;arg:pointer);
  70. private
  71. { vmt }
  72. wurzel : psymcoll;
  73. nextvirtnumber : integer;
  74. has_constructor,
  75. has_virtual_method : boolean;
  76. procedure eachsym(sym : tnamedindexitem;arg:pointer);
  77. procedure disposevmttree;
  78. procedure writevirtualmethods(List:TAAsmoutput);
  79. private
  80. { interface tables }
  81. function gintfgetvtbllabelname(intfindex: integer): string;
  82. procedure gintfcreatevtbl(intfindex: integer; rawdata,rawcode: TAAsmoutput);
  83. procedure gintfgenentry(intfindex, contintfindex: integer; rawdata: TAAsmoutput);
  84. procedure gintfoptimizevtbls(implvtbl : plongint);
  85. procedure gintfwritedata;
  86. function gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef;
  87. procedure gintfdoonintf(intf: tobjectdef; intfindex: longint);
  88. procedure gintfwalkdowninterface(intf: tobjectdef; intfindex: longint);
  89. protected
  90. procedure cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);virtual;abstract;
  91. public
  92. constructor create(c:tobjectdef);
  93. destructor destroy;override;
  94. { generates the message tables for a class }
  95. function genstrmsgtab : tasmlabel;
  96. function genintmsgtab : tasmlabel;
  97. function genpublishedmethodstable : tasmlabel;
  98. { generates a VMT entries }
  99. procedure genvmt;
  100. {$ifdef WITHDMT}
  101. { generates a DMT for _class }
  102. function gendmt : tasmlabel;
  103. {$endif WITHDMT}
  104. { interfaces }
  105. function genintftable: tasmlabel;
  106. { write the VMT to datasegment }
  107. procedure writevmt;
  108. procedure writeinterfaceids;
  109. end;
  110. tclassheaderclass=class of tclassheader;
  111. var
  112. cclassheader : tclassheaderclass;
  113. implementation
  114. uses
  115. {$ifdef delphi}
  116. sysutils,
  117. {$else}
  118. strings,
  119. {$endif}
  120. globtype,globals,verbose,
  121. symtable,symconst,symtype,symsym,types,
  122. {$ifdef GDB}
  123. gdb,
  124. {$endif GDB}
  125. cpuinfo
  126. ;
  127. {*****************************************************************************
  128. TClassHeader
  129. *****************************************************************************}
  130. constructor tclassheader.create(c:tobjectdef);
  131. begin
  132. inherited Create;
  133. _Class:=c;
  134. end;
  135. destructor tclassheader.destroy;
  136. begin
  137. disposevmttree;
  138. end;
  139. {**************************************
  140. Message Tables
  141. **************************************}
  142. procedure tclassheader.disposeprocdeftree(p : pprocdeftree);
  143. begin
  144. if assigned(p^.l) then
  145. disposeprocdeftree(p^.l);
  146. if assigned(p^.r) then
  147. disposeprocdeftree(p^.r);
  148. dispose(p);
  149. end;
  150. procedure tclassheader.insertint(p : pprocdeftree;var at : pprocdeftree);
  151. begin
  152. if at=nil then
  153. begin
  154. at:=p;
  155. inc(count);
  156. end
  157. else
  158. begin
  159. if p^.data.messageinf.i<at^.data.messageinf.i then
  160. insertint(p,at^.l)
  161. else if p^.data.messageinf.i>at^.data.messageinf.i then
  162. insertint(p,at^.r)
  163. else
  164. Message1(parser_e_duplicate_message_label,tostr(p^.data.messageinf.i));
  165. end;
  166. end;
  167. procedure tclassheader.insertstr(p : pprocdeftree;var at : pprocdeftree);
  168. var
  169. i : integer;
  170. begin
  171. if at=nil then
  172. begin
  173. at:=p;
  174. inc(count);
  175. end
  176. else
  177. begin
  178. i:=strcomp(p^.data.messageinf.str,at^.data.messageinf.str);
  179. if i<0 then
  180. insertstr(p,at^.l)
  181. else if i>0 then
  182. insertstr(p,at^.r)
  183. else
  184. Message1(parser_e_duplicate_message_label,strpas(p^.data.messageinf.str));
  185. end;
  186. end;
  187. procedure tclassheader.insertmsgint(p : tnamedindexitem;arg:pointer);
  188. var
  189. hp : pprocdeflist;
  190. pt : pprocdeftree;
  191. begin
  192. if tsym(p).typ=procsym then
  193. begin
  194. hp:=tprocsym(p).defs;
  195. while assigned(hp) do
  196. begin
  197. if (po_msgint in hp^.def.procoptions) then
  198. begin
  199. new(pt);
  200. pt^.data:=hp^.def;
  201. pt^.l:=nil;
  202. pt^.r:=nil;
  203. insertint(pt,root);
  204. end;
  205. hp:=hp^.next;
  206. end;
  207. end;
  208. end;
  209. procedure tclassheader.insertmsgstr(p : tnamedindexitem;arg:pointer);
  210. var
  211. hp : pprocdeflist;
  212. pt : pprocdeftree;
  213. begin
  214. if tsym(p).typ=procsym then
  215. begin
  216. hp:=tprocsym(p).defs;
  217. while assigned(hp) do
  218. begin
  219. if (po_msgstr in hp^.def.procoptions) then
  220. begin
  221. new(pt);
  222. pt^.data:=hp^.def;
  223. pt^.l:=nil;
  224. pt^.r:=nil;
  225. insertstr(pt,root);
  226. end;
  227. hp:=hp^.next;
  228. end;
  229. end;
  230. end;
  231. procedure tclassheader.writenames(p : pprocdeftree);
  232. begin
  233. getdatalabel(p^.nl);
  234. if assigned(p^.l) then
  235. writenames(p^.l);
  236. dataSegment.concat(Tai_label.Create(p^.nl));
  237. dataSegment.concat(Tai_const.Create_8bit(strlen(p^.data.messageinf.str)));
  238. dataSegment.concat(Tai_string.Create_pchar(p^.data.messageinf.str));
  239. if assigned(p^.r) then
  240. writenames(p^.r);
  241. end;
  242. procedure tclassheader.writestrentry(p : pprocdeftree);
  243. begin
  244. if assigned(p^.l) then
  245. writestrentry(p^.l);
  246. { write name label }
  247. dataSegment.concat(Tai_const_symbol.Create(p^.nl));
  248. dataSegment.concat(Tai_const_symbol.Createname(p^.data.mangledname));
  249. if assigned(p^.r) then
  250. writestrentry(p^.r);
  251. end;
  252. function tclassheader.genstrmsgtab : tasmlabel;
  253. var
  254. r : tasmlabel;
  255. begin
  256. root:=nil;
  257. count:=0;
  258. { insert all message handlers into a tree, sorted by name }
  259. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertmsgstr,nil);
  260. { write all names }
  261. if assigned(root) then
  262. writenames(root);
  263. { now start writing of the message string table }
  264. getdatalabel(r);
  265. dataSegment.concat(Tai_label.Create(r));
  266. genstrmsgtab:=r;
  267. dataSegment.concat(Tai_const.Create_32bit(count));
  268. if assigned(root) then
  269. begin
  270. writestrentry(root);
  271. disposeprocdeftree(root);
  272. end;
  273. end;
  274. procedure tclassheader.writeintentry(p : pprocdeftree);
  275. begin
  276. if assigned(p^.l) then
  277. writeintentry(p^.l);
  278. { write name label }
  279. dataSegment.concat(Tai_const.Create_32bit(p^.data.messageinf.i));
  280. dataSegment.concat(Tai_const_symbol.Createname(p^.data.mangledname));
  281. if assigned(p^.r) then
  282. writeintentry(p^.r);
  283. end;
  284. function tclassheader.genintmsgtab : tasmlabel;
  285. var
  286. r : tasmlabel;
  287. begin
  288. root:=nil;
  289. count:=0;
  290. { insert all message handlers into a tree, sorted by name }
  291. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertmsgint,nil);
  292. { now start writing of the message string table }
  293. getdatalabel(r);
  294. dataSegment.concat(Tai_label.Create(r));
  295. genintmsgtab:=r;
  296. dataSegment.concat(Tai_const.Create_32bit(count));
  297. if assigned(root) then
  298. begin
  299. writeintentry(root);
  300. disposeprocdeftree(root);
  301. end;
  302. end;
  303. {$ifdef WITHDMT}
  304. {**************************************
  305. DMT
  306. **************************************}
  307. procedure tclassheader.insertdmtentry(p : tnamedindexitem;arg:pointer);
  308. var
  309. hp : tprocdef;
  310. pt : pprocdeftree;
  311. begin
  312. if tsym(p).typ=procsym then
  313. begin
  314. hp:=tprocsym(p).definition;
  315. while assigned(hp) do
  316. begin
  317. if (po_msgint in hp.procoptions) then
  318. begin
  319. new(pt);
  320. pt^.p:=hp;
  321. pt^.l:=nil;
  322. pt^.r:=nil;
  323. insertint(pt,root);
  324. end;
  325. hp:=hp.nextoverloaded;
  326. end;
  327. end;
  328. end;
  329. procedure tclassheader.writedmtindexentry(p : pprocdeftree);
  330. begin
  331. if assigned(p^.l) then
  332. writedmtindexentry(p^.l);
  333. dataSegment.concat(Tai_const.Create_32bit(p^.data.messageinf.i));
  334. if assigned(p^.r) then
  335. writedmtindexentry(p^.r);
  336. end;
  337. procedure tclassheader.writedmtaddressentry(p : pprocdeftree);
  338. begin
  339. if assigned(p^.l) then
  340. writedmtaddressentry(p^.l);
  341. dataSegment.concat(Tai_const_symbol.Createname(p^.data.mangledname));
  342. if assigned(p^.r) then
  343. writedmtaddressentry(p^.r);
  344. end;
  345. function tclassheader.gendmt : tasmlabel;
  346. var
  347. r : tasmlabel;
  348. begin
  349. root:=nil;
  350. count:=0;
  351. gendmt:=nil;
  352. { insert all message handlers into a tree, sorted by number }
  353. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}insertdmtentry);
  354. if count>0 then
  355. begin
  356. getdatalabel(r);
  357. gendmt:=r;
  358. dataSegment.concat(Tai_label.Create(r));
  359. { entries for caching }
  360. dataSegment.concat(Tai_const.Create_32bit(0));
  361. dataSegment.concat(Tai_const.Create_32bit(0));
  362. dataSegment.concat(Tai_const.Create_32bit(count));
  363. if assigned(root) then
  364. begin
  365. writedmtindexentry(root);
  366. writedmtaddressentry(root);
  367. disposeprocdeftree(root);
  368. end;
  369. end;
  370. end;
  371. {$endif WITHDMT}
  372. {**************************************
  373. Published Methods
  374. **************************************}
  375. procedure tclassheader.do_count(p : tnamedindexitem;arg:pointer);
  376. begin
  377. if (tsym(p).typ=procsym) and (sp_published in tsym(p).symoptions) then
  378. inc(count);
  379. end;
  380. procedure tclassheader.genpubmethodtableentry(p : tnamedindexitem;arg:pointer);
  381. var
  382. hp : tprocdef;
  383. l : tasmlabel;
  384. begin
  385. if (tsym(p).typ=procsym) and (sp_published in tsym(p).symoptions) then
  386. begin
  387. if assigned(tprocsym(p).defs^.next) then
  388. internalerror(1209992);
  389. hp:=tprocsym(p).defs^.def;
  390. getdatalabel(l);
  391. Consts.concat(Tai_label.Create(l));
  392. Consts.concat(Tai_const.Create_8bit(length(p.name)));
  393. Consts.concat(Tai_string.Create(p.name));
  394. dataSegment.concat(Tai_const_symbol.Create(l));
  395. dataSegment.concat(Tai_const_symbol.Createname(hp.mangledname));
  396. end;
  397. end;
  398. function tclassheader.genpublishedmethodstable : tasmlabel;
  399. var
  400. l : tasmlabel;
  401. begin
  402. count:=0;
  403. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}do_count,nil);
  404. if count>0 then
  405. begin
  406. getdatalabel(l);
  407. dataSegment.concat(Tai_label.Create(l));
  408. dataSegment.concat(Tai_const.Create_32bit(count));
  409. _class.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}genpubmethodtableentry,nil);
  410. genpublishedmethodstable:=l;
  411. end
  412. else
  413. genpublishedmethodstable:=nil;
  414. end;
  415. {**************************************
  416. VMT
  417. **************************************}
  418. procedure tclassheader.eachsym(sym : tnamedindexitem;arg:pointer);
  419. var
  420. procdefcoll : pprocdefcoll;
  421. hp : pprocdeflist;
  422. symcoll : psymcoll;
  423. _name : string;
  424. procedure newdefentry(pd:tprocdef);
  425. begin
  426. new(procdefcoll);
  427. procdefcoll^.data:=pd;
  428. procdefcoll^.hidden:=false;
  429. procdefcoll^.next:=symcoll^.data;
  430. symcoll^.data:=procdefcoll;
  431. { if it's a virtual method }
  432. if (po_virtualmethod in pd.procoptions) then
  433. begin
  434. { then it gets a number ... }
  435. pd.extnumber:=nextvirtnumber;
  436. { and we inc the number }
  437. inc(nextvirtnumber);
  438. has_virtual_method:=true;
  439. end;
  440. if (pd.proctypeoption=potype_constructor) then
  441. has_constructor:=true;
  442. { check, if a method should be overridden }
  443. if (pd._class=_class) and
  444. (po_overridingmethod in pd.procoptions) then
  445. MessagePos1(pd.fileinfo,parser_e_nothing_to_be_overridden,pd.fullprocname);
  446. end;
  447. { creates a new entry in the procsym list }
  448. procedure newentry;
  449. begin
  450. { if not, generate a new symbol item }
  451. new(symcoll);
  452. symcoll^.name:=stringdup(sym.name);
  453. symcoll^.next:=wurzel;
  454. symcoll^.data:=nil;
  455. wurzel:=symcoll;
  456. { inserts all definitions }
  457. hp:=tprocsym(sym).defs;
  458. while assigned(hp) do
  459. begin
  460. newdefentry(hp^.def);
  461. hp:=hp^.next;
  462. end;
  463. end;
  464. label
  465. handlenextdef;
  466. var
  467. pd : tprocdef;
  468. pdoverload : boolean;
  469. begin
  470. { put only sub routines into the VMT }
  471. if tsym(sym).typ=procsym then
  472. begin
  473. { check the current list of symbols }
  474. _name:=sym.name;
  475. symcoll:=wurzel;
  476. while assigned(symcoll) do
  477. begin
  478. { does the symbol already exist in the list ? }
  479. if _name=symcoll^.name^ then
  480. begin
  481. { walk through all defs of the symbol }
  482. hp:=tprocsym(sym).defs;
  483. while assigned(hp) do
  484. begin
  485. pd:=hp^.def;
  486. if pd.procsym=sym then
  487. begin
  488. pdoverload:=(po_overload in pd.procoptions);
  489. { compare with all stored definitions }
  490. procdefcoll:=symcoll^.data;
  491. while assigned(procdefcoll) do
  492. begin
  493. { compare only if the definition is not hidden }
  494. if not procdefcoll^.hidden then
  495. begin
  496. { check if one of the two methods has virtual }
  497. if (po_virtualmethod in procdefcoll^.data.procoptions) or
  498. (po_virtualmethod in pd.procoptions) then
  499. begin
  500. { if the current definition has no virtual then hide the
  501. old virtual if the new definition has the same arguments or
  502. has no overload directive }
  503. if not(po_virtualmethod in pd.procoptions) then
  504. begin
  505. if (not pdoverload or
  506. equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const)) and
  507. (tstoredsym(procdefcoll^.data.procsym).is_visible_for_object(pd._class)) then
  508. begin
  509. procdefcoll^.hidden:=true;
  510. if _class=pd._class then
  511. MessagePos1(pd.fileinfo,parser_w_should_use_override,pd.fullprocname);
  512. end;
  513. end
  514. { if both are virtual we check the header }
  515. else if (po_virtualmethod in pd.procoptions) and
  516. (po_virtualmethod in procdefcoll^.data.procoptions) then
  517. begin
  518. { new one has not override }
  519. if is_class(_class) and
  520. not(po_overridingmethod in pd.procoptions) then
  521. begin
  522. { we start a new virtual tree, hide the old }
  523. if (not pdoverload or
  524. equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const)) and
  525. (tstoredsym(procdefcoll^.data.procsym).is_visible_for_object(pd._class)) then
  526. begin
  527. procdefcoll^.hidden:=true;
  528. if _class=pd._class then
  529. MessagePos1(pd.fileinfo,parser_w_should_use_override,pd.fullprocname);
  530. end;
  531. end
  532. { check if the method to override is visible }
  533. else if (po_overridingmethod in pd.procoptions) and
  534. (not tstoredsym(procdefcoll^.data.procsym).is_visible_for_object(pd._class)) then
  535. begin
  536. { do nothing, the error will follow when adding the entry }
  537. end
  538. { same parameters }
  539. else if (equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const)) then
  540. begin
  541. { overload is inherited }
  542. if (po_overload in procdefcoll^.data.procoptions) then
  543. include(pd.procoptions,po_overload);
  544. { the flags have to match except abstract and override }
  545. { only if both are virtual !! }
  546. if (procdefcoll^.data.proccalloption<>pd.proccalloption) or
  547. (procdefcoll^.data.proctypeoption<>pd.proctypeoption) or
  548. ((procdefcoll^.data.procoptions-
  549. [po_abstractmethod,po_overridingmethod,po_assembler,po_overload])<>
  550. (pd.procoptions-[po_abstractmethod,po_overridingmethod,po_assembler,po_overload])) then
  551. MessagePos1(pd.fileinfo,parser_e_header_dont_match_forward,pd.fullprocname);
  552. { error, if the return types aren't equal }
  553. if not(is_equal(procdefcoll^.data.rettype.def,pd.rettype.def)) and
  554. not((procdefcoll^.data.rettype.def.deftype=objectdef) and
  555. (pd.rettype.def.deftype=objectdef) and
  556. is_class(procdefcoll^.data.rettype.def) and
  557. is_class(pd.rettype.def) and
  558. (tobjectdef(pd.rettype.def).is_related(
  559. tobjectdef(procdefcoll^.data.rettype.def)))) then
  560. Message2(parser_e_overridden_methods_not_same_ret,pd.fullprocnamewithret,
  561. procdefcoll^.data.fullprocnamewithret);
  562. { now set the number }
  563. pd.extnumber:=procdefcoll^.data.extnumber;
  564. { and exchange }
  565. procdefcoll^.data:=pd;
  566. goto handlenextdef;
  567. end
  568. { different parameters }
  569. else
  570. begin
  571. { when we got an override directive then can search futher for
  572. the procedure to override.
  573. If we are starting a new virtual tree then hide the old tree }
  574. if not(po_overridingmethod in pd.procoptions) and
  575. not pdoverload then
  576. begin
  577. procdefcoll^.hidden:=true;
  578. if _class=pd._class then
  579. MessagePos1(pd.fileinfo,parser_w_should_use_override,pd.fullprocname);
  580. end;
  581. end;
  582. end
  583. else
  584. begin
  585. { the new definition is virtual and the old static, we hide the old one
  586. if the new defintion has not the overload directive }
  587. if not pdoverload or
  588. equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const) then
  589. procdefcoll^.hidden:=true;
  590. end;
  591. end
  592. else
  593. begin
  594. { both are static, we hide the old one if the new defintion
  595. has not the overload directive }
  596. if equal_paras(procdefcoll^.data.para,pd.para,cp_value_equal_const) or
  597. not pdoverload then
  598. procdefcoll^.hidden:=true;
  599. end;
  600. end; { not hidden }
  601. procdefcoll:=procdefcoll^.next;
  602. end;
  603. { if it isn't saved in the list we create a new entry }
  604. newdefentry(pd);
  605. end;
  606. handlenextdef:
  607. hp:=hp^.next;
  608. end;
  609. exit;
  610. end;
  611. symcoll:=symcoll^.next;
  612. end;
  613. newentry;
  614. end;
  615. end;
  616. procedure tclassheader.disposevmttree;
  617. var
  618. symcoll : psymcoll;
  619. procdefcoll : pprocdefcoll;
  620. begin
  621. { disposes the above generated tree }
  622. symcoll:=wurzel;
  623. while assigned(symcoll) do
  624. begin
  625. wurzel:=symcoll^.next;
  626. stringdispose(symcoll^.name);
  627. procdefcoll:=symcoll^.data;
  628. while assigned(procdefcoll) do
  629. begin
  630. symcoll^.data:=procdefcoll^.next;
  631. dispose(procdefcoll);
  632. procdefcoll:=symcoll^.data;
  633. end;
  634. dispose(symcoll);
  635. symcoll:=wurzel;
  636. end;
  637. end;
  638. procedure tclassheader.genvmt;
  639. procedure do_genvmt(p : tobjectdef);
  640. begin
  641. { start with the base class }
  642. if assigned(p.childof) then
  643. do_genvmt(p.childof);
  644. { walk through all public syms }
  645. p.symtable.foreach({$ifdef FPCPROCVAR}@{$endif}eachsym,nil);
  646. end;
  647. begin
  648. wurzel:=nil;
  649. nextvirtnumber:=0;
  650. has_constructor:=false;
  651. has_virtual_method:=false;
  652. { generates a tree of all used methods }
  653. do_genvmt(_class);
  654. if not(is_interface(_class)) and
  655. has_virtual_method and
  656. not(has_constructor) then
  657. Message1(parser_w_virtual_without_constructor,_class.objrealname^);
  658. end;
  659. {**************************************
  660. Interface tables
  661. **************************************}
  662. function tclassheader.gintfgetvtbllabelname(intfindex: integer): string;
  663. begin
  664. gintfgetvtbllabelname:=mangledname_prefix('VTBL',_class.owner)+_class.objname^+
  665. '_$_'+_class.implementedinterfaces.interfaces(intfindex).objname^;
  666. end;
  667. procedure tclassheader.gintfcreatevtbl(intfindex: integer; rawdata,rawcode: TAAsmoutput);
  668. var
  669. implintf: timplementedinterfaces;
  670. curintf: tobjectdef;
  671. proccount: integer;
  672. tmps: string;
  673. i: longint;
  674. begin
  675. implintf:=_class.implementedinterfaces;
  676. curintf:=implintf.interfaces(intfindex);
  677. if (cs_create_smart in aktmoduleswitches) then
  678. rawdata.concat(Tai_symbol.Createname_global(gintfgetvtbllabelname(intfindex),0))
  679. else
  680. rawdata.concat(Tai_symbol.Createname(gintfgetvtbllabelname(intfindex),0));
  681. proccount:=implintf.implproccount(intfindex);
  682. for i:=1 to proccount do
  683. begin
  684. tmps:=implintf.implprocs(intfindex,i).mangledname+'_$_'+curintf.objname^;
  685. { create wrapper code }
  686. cgintfwrapper(rawcode,implintf.implprocs(intfindex,i),tmps,implintf.ioffsets(intfindex)^);
  687. { create reference }
  688. rawdata.concat(Tai_const_symbol.Createname(tmps));
  689. end;
  690. end;
  691. procedure tclassheader.gintfgenentry(intfindex, contintfindex: integer; rawdata: TAAsmoutput);
  692. var
  693. implintf: timplementedinterfaces;
  694. curintf: tobjectdef;
  695. tmplabel: tasmlabel;
  696. i: longint;
  697. begin
  698. implintf:=_class.implementedinterfaces;
  699. curintf:=implintf.interfaces(intfindex);
  700. { GUID }
  701. if curintf.objecttype in [odt_interfacecom] then
  702. begin
  703. { label for GUID }
  704. getdatalabel(tmplabel);
  705. rawdata.concat(Tai_label.Create(tmplabel));
  706. rawdata.concat(Tai_const.Create_32bit(curintf.iidguid.D1));
  707. rawdata.concat(Tai_const.Create_16bit(curintf.iidguid.D2));
  708. rawdata.concat(Tai_const.Create_16bit(curintf.iidguid.D3));
  709. for i:=Low(curintf.iidguid.D4) to High(curintf.iidguid.D4) do
  710. rawdata.concat(Tai_const.Create_8bit(curintf.iidguid.D4[i]));
  711. dataSegment.concat(Tai_const_symbol.Create(tmplabel));
  712. end
  713. else
  714. begin
  715. { nil for Corba interfaces }
  716. dataSegment.concat(Tai_const.Create_32bit(0)); { nil }
  717. end;
  718. { VTable }
  719. dataSegment.concat(Tai_const_symbol.Createname(gintfgetvtbllabelname(contintfindex)));
  720. { IOffset field }
  721. dataSegment.concat(Tai_const.Create_32bit(implintf.ioffsets(contintfindex)^));
  722. { IIDStr }
  723. getdatalabel(tmplabel);
  724. rawdata.concat(Tai_label.Create(tmplabel));
  725. rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^)));
  726. if curintf.objecttype=odt_interfacecom then
  727. rawdata.concat(Tai_string.Create(upper(curintf.iidstr^)))
  728. else
  729. rawdata.concat(Tai_string.Create(curintf.iidstr^));
  730. dataSegment.concat(Tai_const_symbol.Create(tmplabel));
  731. end;
  732. procedure tclassheader.gintfoptimizevtbls(implvtbl : plongint);
  733. type
  734. tcompintfentry = record
  735. weight: longint;
  736. compintf: longint;
  737. end;
  738. { Max 1000 interface in the class header interfaces it's enough imho }
  739. tcompintfs = packed array[1..1000] of tcompintfentry;
  740. pcompintfs = ^tcompintfs;
  741. tequals = packed array[1..1000] of longint;
  742. pequals = ^tequals;
  743. var
  744. max: longint;
  745. equals: pequals;
  746. compats: pcompintfs;
  747. i: longint;
  748. j: longint;
  749. w: longint;
  750. cij: boolean;
  751. cji: boolean;
  752. begin
  753. max:=_class.implementedinterfaces.count;
  754. if max>High(tequals) then
  755. Internalerror(200006135);
  756. getmem(compats,sizeof(tcompintfentry)*max);
  757. getmem(equals,sizeof(longint)*max);
  758. fillchar(compats^,sizeof(tcompintfentry)*max,0);
  759. fillchar(equals^,sizeof(longint)*max,0);
  760. { ismergepossible is a containing relation
  761. meaning of ismergepossible(a,b,w) =
  762. if implementorfunction map of a is contained implementorfunction map of b
  763. imp(a,b) and imp(b,c) => imp(a,c) ; imp(a,b) and imp(b,a) => a == b
  764. }
  765. { the order is very important for correct allocation }
  766. for i:=1 to max do
  767. begin
  768. for j:=i+1 to max do
  769. begin
  770. cij:=_class.implementedinterfaces.isimplmergepossible(i,j,w);
  771. cji:=_class.implementedinterfaces.isimplmergepossible(j,i,w);
  772. if cij and cji then { i equal j }
  773. begin
  774. { get minimum index of equal }
  775. if equals^[j]=0 then
  776. equals^[j]:=i;
  777. end
  778. else if cij then
  779. begin
  780. { get minimum index of maximum weight }
  781. if compats^[i].weight<w then
  782. begin
  783. compats^[i].weight:=w;
  784. compats^[i].compintf:=j;
  785. end;
  786. end
  787. else if cji then
  788. begin
  789. { get minimum index of maximum weight }
  790. if (compats^[j].weight<w) then
  791. begin
  792. compats^[j].weight:=w;
  793. compats^[j].compintf:=i;
  794. end;
  795. end;
  796. end;
  797. end;
  798. for i:=1 to max do
  799. begin
  800. if compats^[i].compintf<>0 then
  801. implvtbl[i]:=compats^[i].compintf
  802. else if equals^[i]<>0 then
  803. implvtbl[i]:=equals^[i]
  804. else
  805. implvtbl[i]:=i;
  806. end;
  807. freemem(compats,sizeof(tcompintfentry)*max);
  808. freemem(equals,sizeof(longint)*max);
  809. end;
  810. procedure tclassheader.gintfwritedata;
  811. var
  812. rawdata,rawcode: taasmoutput;
  813. impintfindexes: plongint;
  814. max: longint;
  815. i: longint;
  816. begin
  817. max:=_class.implementedinterfaces.count;
  818. getmem(impintfindexes,(max+1)*sizeof(longint));
  819. gintfoptimizevtbls(impintfindexes);
  820. rawdata:=TAAsmOutput.Create;
  821. rawcode:=TAAsmOutput.Create;
  822. dataSegment.concat(Tai_const.Create_16bit(max));
  823. { Two pass, one for allocation and vtbl creation }
  824. for i:=1 to max do
  825. begin
  826. if impintfindexes[i]=i then { if implement itself }
  827. begin
  828. { allocate a pointer in the object memory }
  829. with tstoredsymtable(_class.symtable) do
  830. begin
  831. if (dataalignment>=pointer_size) then
  832. datasize:=align(datasize,dataalignment)
  833. else
  834. datasize:=align(datasize,pointer_size);
  835. _class.implementedinterfaces.ioffsets(i)^:=datasize;
  836. datasize:=datasize+pointer_size;
  837. end;
  838. { write vtbl }
  839. gintfcreatevtbl(i,rawdata,rawcode);
  840. end;
  841. end;
  842. { second pass: for fill interfacetable and remained ioffsets }
  843. for i:=1 to max do
  844. begin
  845. if i<>impintfindexes[i] then { why execute x:=x ? }
  846. with _class.implementedinterfaces do
  847. ioffsets(i)^:=ioffsets(impintfindexes[i])^;
  848. gintfgenentry(i,impintfindexes[i],rawdata);
  849. end;
  850. dataSegment.concatlist(rawdata);
  851. rawdata.free;
  852. codeSegment.concatlist(rawcode);
  853. rawcode.free;
  854. freemem(impintfindexes,(max+1)*sizeof(longint));
  855. end;
  856. function tclassheader.gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef;
  857. var
  858. sym: tprocsym;
  859. implprocdef : pprocdeflist;
  860. begin
  861. gintfgetcprocdef:=nil;
  862. sym:=tprocsym(search_class_member(_class,name));
  863. if assigned(sym) and (sym.typ=procsym) then
  864. begin
  865. implprocdef:=sym.defs;
  866. while assigned(implprocdef) do
  867. begin
  868. if equal_paras(proc.para,implprocdef^.def.para,cp_none) and
  869. (proc.proccalloption=implprocdef^.def.proccalloption) then
  870. begin
  871. gintfgetcprocdef:=implprocdef^.def;
  872. exit;
  873. end;
  874. implprocdef:=implprocdef^.next;
  875. end;
  876. end;
  877. end;
  878. procedure tclassheader.gintfdoonintf(intf: tobjectdef; intfindex: longint);
  879. var
  880. i: longint;
  881. proc: tprocdef;
  882. procname: string; { for error }
  883. mappedname: string;
  884. nextexist: pointer;
  885. implprocdef: tprocdef;
  886. begin
  887. for i:=1 to intf.symtable.defindex.count do
  888. begin
  889. proc:=tprocdef(intf.symtable.defindex.search(i));
  890. if proc.deftype=procdef then
  891. begin
  892. procname:='';
  893. implprocdef:=nil;
  894. nextexist:=nil;
  895. repeat
  896. mappedname:=_class.implementedinterfaces.getmappings(intfindex,proc.procsym.name,nextexist);
  897. if procname='' then
  898. procname:=proc.procsym.name;
  899. //mappedname; { for error messages }
  900. if mappedname<>'' then
  901. implprocdef:=gintfgetcprocdef(proc,mappedname);
  902. until assigned(implprocdef) or not assigned(nextexist);
  903. if not assigned(implprocdef) then
  904. implprocdef:=gintfgetcprocdef(proc,proc.procsym.name);
  905. if procname='' then
  906. procname:=proc.procsym.name;
  907. if assigned(implprocdef) then
  908. _class.implementedinterfaces.addimplproc(intfindex,implprocdef)
  909. else
  910. Message1(sym_e_id_not_found,procname);
  911. end;
  912. end;
  913. end;
  914. procedure tclassheader.gintfwalkdowninterface(intf: tobjectdef; intfindex: longint);
  915. begin
  916. if assigned(intf.childof) then
  917. gintfwalkdowninterface(intf.childof,intfindex);
  918. gintfdoonintf(intf,intfindex);
  919. end;
  920. function tclassheader.genintftable: tasmlabel;
  921. var
  922. intfindex: longint;
  923. curintf: tobjectdef;
  924. intftable: tasmlabel;
  925. begin
  926. { 1. step collect implementor functions into the implementedinterfaces.implprocs }
  927. for intfindex:=1 to _class.implementedinterfaces.count do
  928. begin
  929. curintf:=_class.implementedinterfaces.interfaces(intfindex);
  930. gintfwalkdowninterface(curintf,intfindex);
  931. end;
  932. { 2. step calc required fieldcount and their offsets in the object memory map
  933. and write data }
  934. getdatalabel(intftable);
  935. dataSegment.concat(Tai_label.Create(intftable));
  936. gintfwritedata;
  937. _class.implementedinterfaces.clearimplprocs; { release temporary information }
  938. genintftable:=intftable;
  939. end;
  940. { Write interface identifiers to the data section }
  941. procedure tclassheader.writeinterfaceids;
  942. var
  943. i: longint;
  944. begin
  945. if _class.isiidguidvalid then
  946. begin
  947. if (cs_create_smart in aktmoduleswitches) then
  948. dataSegment.concat(Tai_cut.Create);
  949. dataSegment.concat(Tai_symbol.Createname_global(mangledname_prefix('IID',_class.owner)+_class.objname^,0));
  950. dataSegment.concat(Tai_const.Create_32bit(longint(_class.iidguid.D1)));
  951. dataSegment.concat(Tai_const.Create_16bit(_class.iidguid.D2));
  952. dataSegment.concat(Tai_const.Create_16bit(_class.iidguid.D3));
  953. for i:=Low(_class.iidguid.D4) to High(_class.iidguid.D4) do
  954. dataSegment.concat(Tai_const.Create_8bit(_class.iidguid.D4[i]));
  955. end;
  956. if (cs_create_smart in aktmoduleswitches) then
  957. dataSegment.concat(Tai_cut.Create);
  958. dataSegment.concat(Tai_symbol.Createname_global(mangledname_prefix('IIDSTR',_class.owner)+_class.objname^,0));
  959. dataSegment.concat(Tai_const.Create_8bit(length(_class.iidstr^)));
  960. dataSegment.concat(Tai_string.Create(_class.iidstr^));
  961. end;
  962. procedure tclassheader.writevirtualmethods(List:TAAsmoutput);
  963. var
  964. symcoll : psymcoll;
  965. procdefcoll : pprocdefcoll;
  966. i : longint;
  967. begin
  968. { walk trough all numbers for virtual methods and search }
  969. { the method }
  970. for i:=0 to nextvirtnumber-1 do
  971. begin
  972. symcoll:=wurzel;
  973. { walk trough all symbols }
  974. while assigned(symcoll) do
  975. begin
  976. { walk trough all methods }
  977. procdefcoll:=symcoll^.data;
  978. while assigned(procdefcoll) do
  979. begin
  980. { writes the addresses to the VMT }
  981. { but only this which are declared as virtual }
  982. if procdefcoll^.data.extnumber=i then
  983. begin
  984. if (po_virtualmethod in procdefcoll^.data.procoptions) then
  985. begin
  986. { if a method is abstract, then is also the }
  987. { class abstract and it's not allow to }
  988. { generates an instance }
  989. if (po_abstractmethod in procdefcoll^.data.procoptions) then
  990. begin
  991. include(_class.objectoptions,oo_has_abstract);
  992. List.concat(Tai_const_symbol.Createname('FPC_ABSTRACTERROR'));
  993. end
  994. else
  995. begin
  996. List.concat(Tai_const_symbol.createname(procdefcoll^.data.mangledname));
  997. end;
  998. end;
  999. end;
  1000. procdefcoll:=procdefcoll^.next;
  1001. end;
  1002. symcoll:=symcoll^.next;
  1003. end;
  1004. end;
  1005. end;
  1006. { generates the vmt for classes as well as for objects }
  1007. procedure tclassheader.writevmt;
  1008. var
  1009. methodnametable,intmessagetable,
  1010. strmessagetable,classnamelabel,
  1011. fieldtablelabel : tasmlabel;
  1012. {$ifdef WITHDMT}
  1013. dmtlabel : tasmlabel;
  1014. {$endif WITHDMT}
  1015. interfacetable : tasmlabel;
  1016. begin
  1017. {$ifdef WITHDMT}
  1018. dmtlabel:=gendmt;
  1019. {$endif WITHDMT}
  1020. if (cs_create_smart in aktmoduleswitches) then
  1021. dataSegment.concat(Tai_cut.Create);
  1022. { write tables for classes, this must be done before the actual
  1023. class is written, because we need the labels defined }
  1024. if is_class(_class) then
  1025. begin
  1026. { interface table }
  1027. if _class.implementedinterfaces.count>0 then
  1028. begin
  1029. if (cs_create_smart in aktmoduleswitches) then
  1030. codeSegment.concat(Tai_cut.Create);
  1031. interfacetable:=genintftable;
  1032. end;
  1033. methodnametable:=genpublishedmethodstable;
  1034. fieldtablelabel:=_class.generate_field_table;
  1035. { write class name }
  1036. getdatalabel(classnamelabel);
  1037. dataSegment.concat(Tai_label.Create(classnamelabel));
  1038. dataSegment.concat(Tai_const.Create_8bit(length(_class.objrealname^)));
  1039. dataSegment.concat(Tai_string.Create(_class.objrealname^));
  1040. { generate message and dynamic tables }
  1041. if (oo_has_msgstr in _class.objectoptions) then
  1042. strmessagetable:=genstrmsgtab;
  1043. if (oo_has_msgint in _class.objectoptions) then
  1044. intmessagetable:=genintmsgtab
  1045. else
  1046. dataSegment.concat(Tai_const.Create_32bit(0));
  1047. end;
  1048. { write debug info }
  1049. {$ifdef GDB}
  1050. if (cs_debuginfo in aktmoduleswitches) then
  1051. begin
  1052. do_count_dbx:=true;
  1053. if assigned(_class.owner) and assigned(_class.owner.name) then
  1054. dataSegment.concat(Tai_stabs.Create(strpnew('"vmt_'+_class.owner.name^+_class.name+':S'+
  1055. typeglobalnumber('__vtbl_ptr_type')+'",'+tostr(N_STSYM)+',0,0,'+_class.vmt_mangledname)));
  1056. end;
  1057. {$endif GDB}
  1058. dataSegment.concat(Tai_symbol.Createdataname_global(_class.vmt_mangledname,0));
  1059. { determine the size with symtable.datasize, because }
  1060. { size gives back 4 for classes }
  1061. dataSegment.concat(Tai_const.Create_32bit(_class.symtable.datasize));
  1062. dataSegment.concat(Tai_const.Create_32bit(-_class.symtable.datasize));
  1063. {$ifdef WITHDMT}
  1064. if _class.classtype=ct_object then
  1065. begin
  1066. if assigned(dmtlabel) then
  1067. dataSegment.concat(Tai_const_symbol.Create(dmtlabel)))
  1068. else
  1069. dataSegment.concat(Tai_const.Create_32bit(0));
  1070. end;
  1071. {$endif WITHDMT}
  1072. { write pointer to parent VMT, this isn't implemented in TP }
  1073. { but this is not used in FPC ? (PM) }
  1074. { it's not used yet, but the delphi-operators as and is need it (FK) }
  1075. { it is not written for parents that don't have any vmt !! }
  1076. if assigned(_class.childof) and
  1077. (oo_has_vmt in _class.childof.objectoptions) then
  1078. dataSegment.concat(Tai_const_symbol.Createname(_class.childof.vmt_mangledname))
  1079. else
  1080. dataSegment.concat(Tai_const.Create_32bit(0));
  1081. { write extended info for classes, for the order see rtl/inc/objpash.inc }
  1082. if is_class(_class) then
  1083. begin
  1084. { pointer to class name string }
  1085. dataSegment.concat(Tai_const_symbol.Create(classnamelabel));
  1086. { pointer to dynamic table }
  1087. if (oo_has_msgint in _class.objectoptions) then
  1088. dataSegment.concat(Tai_const_symbol.Create(intmessagetable))
  1089. else
  1090. dataSegment.concat(Tai_const.Create_32bit(0));
  1091. { pointer to method table }
  1092. if assigned(methodnametable) then
  1093. dataSegment.concat(Tai_const_symbol.Create(methodnametable))
  1094. else
  1095. dataSegment.concat(Tai_const.Create_32bit(0));
  1096. { pointer to field table }
  1097. dataSegment.concat(Tai_const_symbol.Create(fieldtablelabel));
  1098. { pointer to type info of published section }
  1099. if (oo_can_have_published in _class.objectoptions) then
  1100. dataSegment.concat(Tai_const_symbol.Create(_class.get_rtti_label(fullrtti)))
  1101. else
  1102. dataSegment.concat(Tai_const.Create_32bit(0));
  1103. { inittable for con-/destruction, for classes this is always generated }
  1104. dataSegment.concat(Tai_const_symbol.Create(_class.get_rtti_label(initrtti)));
  1105. { auto table }
  1106. dataSegment.concat(Tai_const.Create_32bit(0));
  1107. { interface table }
  1108. if _class.implementedinterfaces.count>0 then
  1109. dataSegment.concat(Tai_const_symbol.Create(interfacetable))
  1110. else
  1111. dataSegment.concat(Tai_const.Create_32bit(0));
  1112. { table for string messages }
  1113. if (oo_has_msgstr in _class.objectoptions) then
  1114. dataSegment.concat(Tai_const_symbol.Create(strmessagetable))
  1115. else
  1116. dataSegment.concat(Tai_const.Create_32bit(0));
  1117. end;
  1118. { write virtual methods }
  1119. writevirtualmethods(dataSegment);
  1120. { write the size of the VMT }
  1121. dataSegment.concat(Tai_symbol_end.Createname(_class.vmt_mangledname));
  1122. end;
  1123. initialization
  1124. cclassheader:=tclassheader;
  1125. end.
  1126. {
  1127. $Log$
  1128. Revision 1.21 2002-07-01 18:46:23 peter
  1129. * internal linker
  1130. * reorganized aasm layer
  1131. Revision 1.20 2002/05/18 13:34:10 peter
  1132. * readded missing revisions
  1133. Revision 1.19 2002/05/16 19:46:39 carl
  1134. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1135. + try to fix temp allocation (still in ifdef)
  1136. + generic constructor calls
  1137. + start of tassembler / tmodulebase class cleanup
  1138. Revision 1.17 2002/05/12 16:53:08 peter
  1139. * moved entry and exitcode to ncgutil and cgobj
  1140. * foreach gets extra argument for passing local data to the
  1141. iterator function
  1142. * -CR checks also class typecasts at runtime by changing them
  1143. into as
  1144. * fixed compiler to cycle with the -CR option
  1145. * fixed stabs with elf writer, finally the global variables can
  1146. be watched
  1147. * removed a lot of routines from cga unit and replaced them by
  1148. calls to cgobj
  1149. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1150. u32bit then the other is typecasted also to u32bit without giving
  1151. a rangecheck warning/error.
  1152. * fixed pascal calling method with reversing also the high tree in
  1153. the parast, detected by tcalcst3 test
  1154. Revision 1.16 2002/04/20 21:32:24 carl
  1155. + generic FPC_CHECKPOINTER
  1156. + first parameter offset in stack now portable
  1157. * rename some constants
  1158. + move some cpu stuff to other units
  1159. - remove unused constents
  1160. * fix stacksize for some targets
  1161. * fix generic size problems which depend now on EXTEND_SIZE constant
  1162. Revision 1.15 2002/04/19 15:46:01 peter
  1163. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  1164. in most cases and not written to the ppu
  1165. * add mangeledname_prefix() routine to generate the prefix of
  1166. manglednames depending on the current procedure, object and module
  1167. * removed static procprefix since the mangledname is now build only
  1168. on demand from tprocdef.mangledname
  1169. Revision 1.14 2002/04/15 18:59:07 carl
  1170. + target_info.size_of_pointer -> pointer_Size
  1171. Revision 1.13 2002/02/11 18:51:35 peter
  1172. * fixed vmt generation for private procedures that were skipped after
  1173. my previous changes
  1174. }