symtype.pas 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl, Pierre Muller
  4. This unit handles the symbol tables
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit symtype;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. { common }
  23. cutils,
  24. {$ifdef MEMDEBUG}
  25. cclasses,
  26. {$endif MEMDEBUG}
  27. { global }
  28. globtype,globals,
  29. { symtable }
  30. symconst,symbase,
  31. { aasm }
  32. aasmbase
  33. ;
  34. type
  35. {************************************************
  36. Required Forwards
  37. ************************************************}
  38. tsym = class;
  39. {************************************************
  40. TRef
  41. ************************************************}
  42. tref = class
  43. nextref : tref;
  44. posinfo : tfileposinfo;
  45. moduleindex : longint;
  46. is_written : boolean;
  47. constructor create(ref:tref;pos:pfileposinfo);
  48. procedure freechain;
  49. destructor destroy;override;
  50. end;
  51. {************************************************
  52. TDef
  53. ************************************************}
  54. tgetsymtable = (gs_none,gs_record,gs_local,gs_para);
  55. tdef = class(tdefentry)
  56. typesym : tsym; { which type the definition was generated this def }
  57. defoptions : tdefoptions;
  58. constructor create;
  59. procedure deref;virtual;abstract;
  60. procedure derefimpl;virtual;abstract;
  61. function typename:string;
  62. function gettypename:string;virtual;
  63. function mangledparaname:string;
  64. function getmangledparaname:string;virtual;abstract;
  65. function size:longint;virtual;abstract;
  66. function alignment:longint;virtual;abstract;
  67. function getparentdef:tdef;virtual;
  68. function getsymtable(t:tgetsymtable):tsymtable;virtual;
  69. function is_publishable:boolean;virtual;abstract;
  70. function needs_inittable:boolean;virtual;abstract;
  71. end;
  72. {************************************************
  73. TSym
  74. ************************************************}
  75. { this object is the base for all symbol objects }
  76. tsym = class(tsymentry)
  77. _realname : pstring;
  78. fileinfo : tfileposinfo;
  79. symoptions : tsymoptions;
  80. constructor create(const n : string);
  81. destructor destroy;override;
  82. function realname:string;
  83. procedure deref;virtual;abstract;
  84. function gettypedef:tdef;virtual;
  85. end;
  86. {************************************************
  87. TDeref
  88. ************************************************}
  89. tderefdata = array[0..31] of byte;
  90. tderef = object
  91. len : longint;
  92. data : tderefdata;
  93. procedure reset;
  94. procedure setdata(l:longint;var d);
  95. procedure build(s:tsymtableentry);
  96. function resolve:tsymtableentry;
  97. end;
  98. {************************************************
  99. TType
  100. ************************************************}
  101. ttype = object
  102. def : tdef;
  103. sym : tsym;
  104. deref : tderef;
  105. procedure reset;
  106. procedure setdef(p:tdef);
  107. procedure setsym(p:tsym);
  108. procedure resolve;
  109. end;
  110. {************************************************
  111. TSymList
  112. ************************************************}
  113. psymlistitem = ^tsymlistitem;
  114. tsymlistitem = record
  115. sltype : tsltype;
  116. sym : tsym;
  117. symderef : tderef;
  118. value : longint;
  119. next : psymlistitem;
  120. end;
  121. tsymlist = class
  122. procdef : tdef;
  123. procdefderef : tderef;
  124. firstsym,
  125. lastsym : psymlistitem;
  126. constructor create;
  127. destructor destroy;override;
  128. function empty:boolean;
  129. procedure addsym(slt:tsltype;p:tsym);
  130. procedure addsymderef(slt:tsltype;const d:tderef);
  131. procedure addconst(slt:tsltype;v:longint);
  132. procedure clear;
  133. function getcopy:tsymlist;
  134. procedure resolve;
  135. end;
  136. {$ifdef MEMDEBUG}
  137. var
  138. membrowser,
  139. memrealnames,
  140. memmanglednames,
  141. memprocparast,
  142. memproclocalst,
  143. memprocnodetree : tmemdebug;
  144. {$endif MEMDEBUG}
  145. implementation
  146. uses
  147. verbose,
  148. fmodule;
  149. {****************************************************************************
  150. Tdef
  151. ****************************************************************************}
  152. constructor tdef.create;
  153. begin
  154. inherited create;
  155. deftype:=abstractdef;
  156. owner := nil;
  157. typesym := nil;
  158. defoptions:=[];
  159. end;
  160. function tdef.typename:string;
  161. begin
  162. if assigned(typesym) and
  163. not(deftype in [procvardef,procdef]) and
  164. assigned(typesym._realname) and
  165. (typesym._realname^[1]<>'$') then
  166. typename:=typesym._realname^
  167. else
  168. typename:=gettypename;
  169. end;
  170. function tdef.gettypename : string;
  171. begin
  172. gettypename:='<unknown type>'
  173. end;
  174. function tdef.mangledparaname:string;
  175. begin
  176. if assigned(typesym) then
  177. mangledparaname:=typesym.name
  178. else
  179. mangledparaname:=getmangledparaname;
  180. end;
  181. function tdef.getparentdef:tdef;
  182. begin
  183. result:=nil;
  184. end;
  185. function tdef.getsymtable(t:tgetsymtable):tsymtable;
  186. begin
  187. getsymtable:=nil;
  188. end;
  189. {****************************************************************************
  190. TSYM (base for all symtypes)
  191. ****************************************************************************}
  192. constructor tsym.create(const n : string);
  193. begin
  194. if n[1]='$' then
  195. inherited createname(copy(n,2,255))
  196. else
  197. inherited createname(upper(n));
  198. _realname:=stringdup(n);
  199. typ:=abstractsym;
  200. symoptions:=[];
  201. end;
  202. destructor tsym.destroy;
  203. begin
  204. {$ifdef MEMDEBUG}
  205. memrealnames.start;
  206. {$endif MEMDEBUG}
  207. stringdispose(_realname);
  208. {$ifdef MEMDEBUG}
  209. memrealnames.stop;
  210. {$endif MEMDEBUG}
  211. inherited destroy;
  212. end;
  213. function tsym.realname : string;
  214. begin
  215. if assigned(_realname) then
  216. realname:=_realname^
  217. else
  218. realname:=name;
  219. end;
  220. function tsym.gettypedef:tdef;
  221. begin
  222. gettypedef:=nil;
  223. end;
  224. {****************************************************************************
  225. TRef
  226. ****************************************************************************}
  227. constructor tref.create(ref :tref;pos : pfileposinfo);
  228. begin
  229. nextref:=nil;
  230. if pos<>nil then
  231. posinfo:=pos^;
  232. if assigned(current_module) then
  233. moduleindex:=current_module.unit_index;
  234. if assigned(ref) then
  235. ref.nextref:=self;
  236. is_written:=false;
  237. end;
  238. procedure tref.freechain;
  239. var
  240. p,q : tref;
  241. begin
  242. p:=nextref;
  243. nextref:=nil;
  244. while assigned(p) do
  245. begin
  246. q:=p.nextref;
  247. p.free;
  248. p:=q;
  249. end;
  250. end;
  251. destructor tref.destroy;
  252. begin
  253. nextref:=nil;
  254. end;
  255. {****************************************************************************
  256. TType
  257. ****************************************************************************}
  258. procedure ttype.reset;
  259. begin
  260. def:=nil;
  261. sym:=nil;
  262. end;
  263. procedure ttype.setdef(p:tdef);
  264. begin
  265. def:=p;
  266. sym:=nil;
  267. end;
  268. procedure ttype.setsym(p:tsym);
  269. begin
  270. sym:=p;
  271. def:=p.gettypedef;
  272. if not assigned(def) then
  273. internalerror(1234005);
  274. end;
  275. procedure ttype.resolve;
  276. var
  277. p : tsymtableentry;
  278. begin
  279. p:=deref.resolve;
  280. if assigned(p) then
  281. begin
  282. if p is tsym then
  283. begin
  284. setsym(tsym(p));
  285. if not assigned(def) then
  286. internalerror(200212272);
  287. end
  288. else
  289. begin
  290. setdef(tdef(p));
  291. end;
  292. end
  293. else
  294. reset;
  295. end;
  296. {****************************************************************************
  297. TSymList
  298. ****************************************************************************}
  299. constructor tsymlist.create;
  300. begin
  301. procdef:=nil; { needed for procedures }
  302. firstsym:=nil;
  303. lastsym:=nil;
  304. end;
  305. destructor tsymlist.destroy;
  306. begin
  307. clear;
  308. end;
  309. function tsymlist.empty:boolean;
  310. begin
  311. empty:=(firstsym=nil);
  312. end;
  313. procedure tsymlist.clear;
  314. var
  315. hp : psymlistitem;
  316. begin
  317. while assigned(firstsym) do
  318. begin
  319. hp:=firstsym;
  320. firstsym:=firstsym^.next;
  321. dispose(hp);
  322. end;
  323. firstsym:=nil;
  324. lastsym:=nil;
  325. procdef:=nil;
  326. end;
  327. procedure tsymlist.addsym(slt:tsltype;p:tsym);
  328. var
  329. hp : psymlistitem;
  330. begin
  331. if not assigned(p) then
  332. internalerror(200110203);
  333. new(hp);
  334. hp^.sltype:=slt;
  335. hp^.sym:=p;
  336. hp^.symderef.reset;
  337. hp^.value:=0;
  338. hp^.next:=nil;
  339. if assigned(lastsym) then
  340. lastsym^.next:=hp
  341. else
  342. firstsym:=hp;
  343. lastsym:=hp;
  344. end;
  345. procedure tsymlist.addsymderef(slt:tsltype;const d:tderef);
  346. var
  347. hp : psymlistitem;
  348. begin
  349. new(hp);
  350. hp^.sltype:=slt;
  351. hp^.sym:=nil;
  352. hp^.symderef:=d;
  353. hp^.value:=0;
  354. hp^.next:=nil;
  355. if assigned(lastsym) then
  356. lastsym^.next:=hp
  357. else
  358. firstsym:=hp;
  359. lastsym:=hp;
  360. end;
  361. procedure tsymlist.addconst(slt:tsltype;v:longint);
  362. var
  363. hp : psymlistitem;
  364. begin
  365. new(hp);
  366. hp^.sltype:=slt;
  367. hp^.sym:=nil;
  368. hp^.symderef.reset;
  369. hp^.value:=v;
  370. hp^.next:=nil;
  371. if assigned(lastsym) then
  372. lastsym^.next:=hp
  373. else
  374. firstsym:=hp;
  375. lastsym:=hp;
  376. end;
  377. function tsymlist.getcopy:tsymlist;
  378. var
  379. hp : tsymlist;
  380. hp2 : psymlistitem;
  381. hpn : psymlistitem;
  382. begin
  383. hp:=tsymlist.create;
  384. hp.procdef:=procdef;
  385. hp2:=firstsym;
  386. while assigned(hp2) do
  387. begin
  388. new(hpn);
  389. hpn^:=hp2^;
  390. hpn^.next:=nil;
  391. if assigned(hp.lastsym) then
  392. hp.lastsym^.next:=hpn
  393. else
  394. hp.firstsym:=hpn;
  395. hp.lastsym:=hpn;
  396. hp2:=hp2^.next;
  397. end;
  398. getcopy:=hp;
  399. end;
  400. procedure tsymlist.resolve;
  401. var
  402. hp : psymlistitem;
  403. begin
  404. procdef:=tdef(procdefderef.resolve);
  405. hp:=firstsym;
  406. while assigned(hp) do
  407. begin
  408. hp^.sym:=tsym(hp^.symderef.resolve);
  409. hp:=hp^.next;
  410. end;
  411. end;
  412. {****************************************************************************
  413. Tderef
  414. ****************************************************************************}
  415. procedure tderef.reset;
  416. begin
  417. len:=0;
  418. end;
  419. procedure tderef.setdata(l:longint;var d);
  420. begin
  421. len:=l;
  422. if l>sizeof(tderefdata) then
  423. internalerror(200306068);
  424. move(d,data,len);
  425. end;
  426. procedure tderef.build(s:tsymtableentry);
  427. function is_child(currdef,ownerdef:tdef):boolean;
  428. begin
  429. while assigned(currdef) and
  430. (currdef<>ownerdef) do
  431. currdef:=currdef.getparentdef;
  432. result:=assigned(currdef);
  433. end;
  434. procedure addowner(s:tsymtableentry);
  435. begin
  436. if not assigned(s.owner) then
  437. internalerror(200306063);
  438. case s.owner.symtabletype of
  439. globalsymtable :
  440. begin
  441. if s.owner.unitid=0 then
  442. begin
  443. data[len]:=ord(deref_aktglobal);
  444. inc(len);
  445. end
  446. else
  447. begin
  448. { check if the unit is available in the uses
  449. clause, else it's an error }
  450. if s.owner.unitid=$ffff then
  451. internalerror(200306063);
  452. data[len]:=ord(deref_unit);
  453. data[len+1]:=s.owner.unitid shr 8;
  454. data[len+2]:=s.owner.unitid and $ff;
  455. inc(len,3);
  456. end;
  457. end;
  458. staticsymtable :
  459. begin
  460. { only references to the current static symtable are allowed }
  461. if s.owner<>aktstaticsymtable then
  462. internalerror(200306233);
  463. data[len]:=ord(deref_aktstatic);
  464. inc(len);
  465. end;
  466. localsymtable :
  467. begin
  468. addowner(s.owner.defowner);
  469. data[len]:=ord(deref_def);
  470. data[len+1]:=s.owner.defowner.indexnr shr 8;
  471. data[len+2]:=s.owner.defowner.indexnr and $ff;
  472. data[len+3]:=ord(deref_local);
  473. inc(len,4);
  474. end;
  475. parasymtable :
  476. begin
  477. addowner(s.owner.defowner);
  478. data[len]:=ord(deref_def);
  479. data[len+1]:=s.owner.defowner.indexnr shr 8;
  480. data[len+2]:=s.owner.defowner.indexnr and $ff;
  481. data[len+3]:=ord(deref_para);
  482. inc(len,4);
  483. end;
  484. objectsymtable,
  485. recordsymtable :
  486. begin
  487. addowner(s.owner.defowner);
  488. data[len]:=ord(deref_def);
  489. data[len+1]:=s.owner.defowner.indexnr shr 8;
  490. data[len+2]:=s.owner.defowner.indexnr and $ff;
  491. data[len+3]:=ord(deref_record);
  492. inc(len,4);
  493. end;
  494. else
  495. internalerror(200306065);
  496. end;
  497. if len+3>sizeof(tderefdata) then
  498. internalerror(200306062);
  499. end;
  500. procedure addparentobject(currdef,ownerdef:tdef);
  501. var
  502. nextdef : tdef;
  503. begin
  504. if not assigned(currdef) then
  505. internalerror(200306185);
  506. { Already handled by derefaktrecordindex }
  507. if currdef=ownerdef then
  508. internalerror(200306188);
  509. { Generate a direct reference to the top parent
  510. class available in the current unit, this is required because
  511. the parent class is maybe not resolved yet and therefor
  512. has the childof value not available yet }
  513. while (currdef<>ownerdef) do
  514. begin
  515. nextdef:=currdef.getparentdef;
  516. { objects are only allowed in globalsymtable,staticsymtable this check is
  517. needed because we need the unitid }
  518. if not(nextdef.owner.symtabletype in [globalsymtable,staticsymtable]) then
  519. internalerror(200306187);
  520. { Next parent is in a different unit, then stop }
  521. if nextdef.owner.unitid<>0 then
  522. break;
  523. currdef:=nextdef;
  524. end;
  525. { Add reference where to start the parent lookup }
  526. if currdef=aktrecordsymtable.defowner then
  527. begin
  528. data[len]:=ord(deref_aktrecord);
  529. inc(len);
  530. end
  531. else
  532. begin
  533. if currdef.owner.symtabletype=globalsymtable then
  534. data[len]:=ord(deref_aktglobal)
  535. else
  536. data[len]:=ord(deref_aktstatic);
  537. data[len+1]:=ord(deref_def);
  538. data[len+2]:=currdef.indexnr shr 8;
  539. data[len+3]:=currdef.indexnr and $ff;
  540. data[len+4]:=ord(deref_record);
  541. inc(len,5);
  542. end;
  543. { When the current found parent in this module is not the owner we
  544. add derefs for the parent classes not available in this unit }
  545. while (currdef<>ownerdef) do
  546. begin
  547. data[len]:=ord(deref_parent_object);
  548. inc(len);
  549. currdef:=currdef.getparentdef;
  550. { It should be valid as it is checked by is_child }
  551. if not assigned(currdef) then
  552. internalerror(200306186);
  553. end;
  554. end;
  555. begin
  556. len:=0;
  557. if assigned(s) then
  558. begin
  559. { Static symtable of current unit ? }
  560. if (s.owner.symtabletype=staticsymtable) and
  561. (s.owner.unitid=0) then
  562. begin
  563. data[len]:=ord(deref_aktstatic);
  564. inc(len);
  565. end
  566. { Global symtable of current unit ? }
  567. else if (s.owner.symtabletype=globalsymtable) and
  568. (s.owner.unitid=0) then
  569. begin
  570. data[len]:=ord(deref_aktglobal);
  571. inc(len);
  572. end
  573. { Current record/object symtable ? }
  574. else if (s.owner=aktrecordsymtable) then
  575. begin
  576. data[len]:=ord(deref_aktrecord);
  577. inc(len);
  578. end
  579. { Current local symtable ? }
  580. else if (s.owner=aktlocalsymtable) then
  581. begin
  582. data[len]:=ord(deref_aktlocal);
  583. inc(len);
  584. end
  585. { Current para symtable ? }
  586. else if (s.owner=aktparasymtable) then
  587. begin
  588. data[len]:=ord(deref_aktpara);
  589. inc(len);
  590. end
  591. { Parent class? }
  592. else if assigned(aktrecordsymtable) and
  593. (aktrecordsymtable.symtabletype=objectsymtable) and
  594. (s.owner.symtabletype=objectsymtable) and
  595. is_child(tdef(aktrecordsymtable.defowner),tdef(s.owner.defowner)) then
  596. begin
  597. addparentobject(tdef(aktrecordsymtable.defowner),tdef(s.owner.defowner));
  598. end
  599. else
  600. { Default, start by building from unit symtable }
  601. begin
  602. addowner(s);
  603. end;
  604. { Add index of the symbol/def }
  605. if s is tsym then
  606. data[len]:=ord(deref_sym)
  607. else
  608. data[len]:=ord(deref_def);
  609. data[len+1]:=s.indexnr shr 8;
  610. data[len+2]:=s.indexnr and $ff;
  611. inc(len,3);
  612. end
  613. else
  614. begin
  615. { nil pointer }
  616. data[len]:=0;
  617. inc(len);
  618. end;
  619. end;
  620. function tderef.resolve:tsymtableentry;
  621. var
  622. pd : tdef;
  623. pm : tmodule;
  624. typ : tdereftype;
  625. st : tsymtable;
  626. idx : word;
  627. i : longint;
  628. begin
  629. result:=nil;
  630. { not initialized }
  631. if len=0 then
  632. internalerror(200306067);
  633. st:=nil;
  634. i:=0;
  635. while (i<len) do
  636. begin
  637. typ:=tdereftype(data[i]);
  638. inc(i);
  639. case typ of
  640. deref_nil :
  641. begin
  642. result:=nil;
  643. { Only allowed when no other deref is available }
  644. if len<>1 then
  645. internalerror(200306232);
  646. end;
  647. deref_sym :
  648. begin
  649. if not assigned(st) then
  650. internalerror(200309141);
  651. idx:=(data[i] shl 8) or data[i+1];
  652. inc(i,2);
  653. result:=st.getsymnr(idx);
  654. end;
  655. deref_def :
  656. begin
  657. if not assigned(st) then
  658. internalerror(200309142);
  659. idx:=(data[i] shl 8) or data[i+1];
  660. inc(i,2);
  661. result:=st.getdefnr(idx);
  662. end;
  663. deref_aktrecord :
  664. st:=aktrecordsymtable;
  665. deref_aktstatic :
  666. st:=aktstaticsymtable;
  667. deref_aktglobal :
  668. st:=aktglobalsymtable;
  669. deref_aktlocal :
  670. st:=aktlocalsymtable;
  671. deref_aktpara :
  672. st:=aktparasymtable;
  673. deref_unit :
  674. begin
  675. idx:=(data[i] shl 8) or data[i+1];
  676. inc(i,2);
  677. if idx>maxunits then
  678. internalerror(200306231);
  679. pm:=current_module.map^[idx];
  680. if not assigned(pm) then
  681. internalerror(200212273);
  682. st:=pm.globalsymtable;
  683. end;
  684. deref_local :
  685. begin
  686. if not assigned(result) then
  687. internalerror(200306069);
  688. st:=tdef(result).getsymtable(gs_local);
  689. result:=nil;
  690. if not assigned(st) then
  691. internalerror(200212275);
  692. end;
  693. deref_para :
  694. begin
  695. if not assigned(result) then
  696. internalerror(2003060610);
  697. st:=tdef(result).getsymtable(gs_para);
  698. result:=nil;
  699. if not assigned(st) then
  700. internalerror(200212276);
  701. end;
  702. deref_record :
  703. begin
  704. if not assigned(result) then
  705. internalerror(200306068);
  706. st:=tdef(result).getsymtable(gs_record);
  707. result:=nil;
  708. if not assigned(st) then
  709. internalerror(200212274);
  710. end;
  711. deref_parent_object :
  712. begin
  713. { load current object symtable if no
  714. symtable is available yet }
  715. if st=nil then
  716. begin
  717. st:=aktrecordsymtable;
  718. if not assigned(st) then
  719. internalerror(200306068);
  720. end;
  721. if st.symtabletype<>objectsymtable then
  722. internalerror(200306189);
  723. pd:=tdef(st.defowner).getparentdef;
  724. if not assigned(pd) then
  725. internalerror(200306184);
  726. st:=pd.getsymtable(gs_record);
  727. if not assigned(st) then
  728. internalerror(200212274);
  729. end;
  730. else
  731. internalerror(200212277);
  732. end;
  733. end;
  734. end;
  735. {$ifdef MEMDEBUG}
  736. initialization
  737. membrowser:=TMemDebug.create('BrowserRefs');
  738. membrowser.stop;
  739. memrealnames:=TMemDebug.create('Realnames');
  740. memrealnames.stop;
  741. memmanglednames:=TMemDebug.create('Manglednames');
  742. memmanglednames.stop;
  743. memprocparast:=TMemDebug.create('ProcParaSt');
  744. memprocparast.stop;
  745. memproclocalst:=TMemDebug.create('ProcLocalSt');
  746. memproclocalst.stop;
  747. memprocnodetree:=TMemDebug.create('ProcNodeTree');
  748. memprocnodetree.stop;
  749. finalization
  750. membrowser.free;
  751. memrealnames.free;
  752. memmanglednames.free;
  753. memprocparast.free;
  754. memproclocalst.free;
  755. memprocnodetree.free;
  756. {$endif MEMDEBUG}
  757. end.
  758. {
  759. $Log$
  760. Revision 1.28 2003-10-07 16:06:30 peter
  761. * tsymlist.def renamed to tsymlist.procdef
  762. * tsymlist.procdef is now only used to store the procdef
  763. Revision 1.27 2003/09/14 12:58:29 peter
  764. * give IE when st is not assigned in deref
  765. Revision 1.26 2003/06/25 18:31:23 peter
  766. * sym,def resolving partly rewritten to support also parent objects
  767. not directly available through the uses clause
  768. Revision 1.25 2003/06/07 20:26:32 peter
  769. * re-resolving added instead of reloading from ppu
  770. * tderef object added to store deref info for resolving
  771. Revision 1.24 2002/12/29 18:26:31 peter
  772. * also use gettypename for procdef always
  773. Revision 1.23 2002/12/29 14:57:50 peter
  774. * unit loading changed to first register units and load them
  775. afterwards. This is needed to support uses xxx in yyy correctly
  776. * unit dependency check fixed
  777. Revision 1.22 2002/09/05 19:29:46 peter
  778. * memdebug enhancements
  779. Revision 1.21 2002/08/18 20:06:28 peter
  780. * inlining is now also allowed in interface
  781. * renamed write/load to ppuwrite/ppuload
  782. * tnode storing in ppu
  783. * nld,ncon,nbas are already updated for storing in ppu
  784. Revision 1.20 2002/08/11 13:24:16 peter
  785. * saving of asmsymbols in ppu supported
  786. * asmsymbollist global is removed and moved into a new class
  787. tasmlibrarydata that will hold the info of a .a file which
  788. corresponds with a single module. Added librarydata to tmodule
  789. to keep the library info stored for the module. In the future the
  790. objectfiles will also be stored to the tasmlibrarydata class
  791. * all getlabel/newasmsymbol and friends are moved to the new class
  792. Revision 1.19 2002/07/01 18:46:29 peter
  793. * internal linker
  794. * reorganized aasm layer
  795. Revision 1.18 2002/05/18 13:34:21 peter
  796. * readded missing revisions
  797. Revision 1.17 2002/05/16 19:46:45 carl
  798. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  799. + try to fix temp allocation (still in ifdef)
  800. + generic constructor calls
  801. + start of tassembler / tmodulebase class cleanup
  802. Revision 1.15 2002/05/12 16:53:15 peter
  803. * moved entry and exitcode to ncgutil and cgobj
  804. * foreach gets extra argument for passing local data to the
  805. iterator function
  806. * -CR checks also class typecasts at runtime by changing them
  807. into as
  808. * fixed compiler to cycle with the -CR option
  809. * fixed stabs with elf writer, finally the global variables can
  810. be watched
  811. * removed a lot of routines from cga unit and replaced them by
  812. calls to cgobj
  813. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  814. u32bit then the other is typecasted also to u32bit without giving
  815. a rangecheck warning/error.
  816. * fixed pascal calling method with reversing also the high tree in
  817. the parast, detected by tcalcst3 test
  818. Revision 1.14 2002/04/19 15:46:04 peter
  819. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  820. in most cases and not written to the ppu
  821. * add mangeledname_prefix() routine to generate the prefix of
  822. manglednames depending on the current procedure, object and module
  823. * removed static procprefix since the mangledname is now build only
  824. on demand from tprocdef.mangledname
  825. }