symtype.pas 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661
  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,ppu,cpuinfo
  33. ;
  34. type
  35. {************************************************
  36. Required Forwards
  37. ************************************************}
  38. tsym = class;
  39. Tcompilerppufile=class;
  40. {************************************************
  41. TRef
  42. ************************************************}
  43. tref = class
  44. nextref : tref;
  45. posinfo : tfileposinfo;
  46. moduleindex : longint;
  47. is_written : boolean;
  48. constructor create(ref:tref;pos:pfileposinfo);
  49. procedure freechain;
  50. destructor destroy;override;
  51. end;
  52. {************************************************
  53. TDef
  54. ************************************************}
  55. tgetsymtable = (gs_none,gs_record,gs_local,gs_para);
  56. tdef = class(tdefentry)
  57. typesym : tsym; { which type the definition was generated this def }
  58. defoptions : tdefoptions;
  59. constructor create;
  60. procedure buildderef;virtual;abstract;
  61. procedure buildderefimpl;virtual;abstract;
  62. procedure deref;virtual;abstract;
  63. procedure derefimpl;virtual;abstract;
  64. function typename:string;
  65. function gettypename:string;virtual;
  66. function mangledparaname:string;
  67. function getmangledparaname:string;virtual;abstract;
  68. function size:longint;virtual;abstract;
  69. function alignment:longint;virtual;abstract;
  70. function getparentdef:tdef;virtual;
  71. function getsymtable(t:tgetsymtable):tsymtable;virtual;
  72. function is_publishable:boolean;virtual;abstract;
  73. function needs_inittable:boolean;virtual;abstract;
  74. end;
  75. {************************************************
  76. TSym
  77. ************************************************}
  78. { this object is the base for all symbol objects }
  79. tsym = class(tsymentry)
  80. protected
  81. public
  82. _realname : pstring;
  83. fileinfo : tfileposinfo;
  84. symoptions : tsymoptions;
  85. refs : longint;
  86. lastref,
  87. defref,
  88. lastwritten : tref;
  89. refcount : longint;
  90. {$ifdef GDB}
  91. isstabwritten : boolean;
  92. function get_var_value(const s:string):string;
  93. function stabstr_evaluate(const s:string;vars:array of string):Pchar;
  94. function stabstring : pchar;virtual;
  95. {$endif GDB}
  96. constructor create(const n : string);
  97. constructor loadsym(ppufile:tcompilerppufile);
  98. destructor destroy;override;
  99. procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract;
  100. procedure writesym(ppufile:tcompilerppufile);
  101. function realname:string;
  102. procedure buildderef;virtual;
  103. { procedure buildderefimpl;virtual;abstract;}
  104. procedure deref;virtual;
  105. { procedure derefimpl;virtual;abstract;}
  106. function gettypedef:tdef;virtual;
  107. procedure load_references(ppufile:tcompilerppufile;locals:boolean);virtual;
  108. function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;virtual;
  109. function is_visible_for_object(currobjdef:Tdef):boolean;
  110. end;
  111. {************************************************
  112. TDeref
  113. ************************************************}
  114. tderef = object
  115. dataidx : longint;
  116. procedure reset;
  117. procedure build(s:tsymtableentry);
  118. function resolve:tsymtableentry;
  119. end;
  120. {************************************************
  121. TType
  122. ************************************************}
  123. ttype = object
  124. def : tdef;
  125. sym : tsym;
  126. deref : tderef;
  127. procedure reset;
  128. procedure setdef(p:tdef);
  129. procedure setsym(p:tsym);
  130. procedure resolve;
  131. procedure buildderef;
  132. end;
  133. {************************************************
  134. TSymList
  135. ************************************************}
  136. psymlistitem = ^tsymlistitem;
  137. tsymlistitem = record
  138. sltype : tsltype;
  139. next : psymlistitem;
  140. case byte of
  141. 0 : (sym : tsym; symderef : tderef);
  142. 1 : (value : longint);
  143. 2 : (tt : ttype);
  144. end;
  145. tsymlist = class
  146. procdef : tdef;
  147. procdefderef : tderef;
  148. firstsym,
  149. lastsym : psymlistitem;
  150. constructor create;
  151. destructor destroy;override;
  152. function empty:boolean;
  153. procedure addsym(slt:tsltype;p:tsym);
  154. procedure addsymderef(slt:tsltype;const d:tderef);
  155. procedure addconst(slt:tsltype;v:longint);
  156. procedure addtype(slt:tsltype;const tt:ttype);
  157. procedure clear;
  158. function getcopy:tsymlist;
  159. procedure resolve;
  160. procedure buildderef;
  161. end;
  162. {************************************************
  163. Tcompilerppufile
  164. ************************************************}
  165. tcompilerppufile=class(tppufile)
  166. public
  167. procedure checkerror;
  168. procedure getguid(var g: tguid);
  169. function getexprint:tconstexprint;
  170. function getptruint:TConstPtrUInt;
  171. procedure getposinfo(var p:tfileposinfo);
  172. procedure getderef(var d:tderef);
  173. function getsymlist:tsymlist;
  174. procedure gettype(var t:ttype);
  175. function getasmsymbol:tasmsymbol;
  176. procedure putguid(const g: tguid);
  177. procedure putexprint(v:tconstexprint);
  178. procedure PutPtrUInt(v:TConstPtrUInt);
  179. procedure putposinfo(const p:tfileposinfo);
  180. procedure putderef(const d:tderef);
  181. procedure putsymlist(p:tsymlist);
  182. procedure puttype(const t:ttype);
  183. procedure putasmsymbol(s:tasmsymbol);
  184. end;
  185. {$ifdef MEMDEBUG}
  186. var
  187. membrowser,
  188. memrealnames,
  189. memmanglednames,
  190. memprocpara,
  191. memprocparast,
  192. memproclocalst,
  193. memprocnodetree : tmemdebug;
  194. {$endif MEMDEBUG}
  195. const
  196. current_object_option : tsymoptions = [sp_public];
  197. implementation
  198. uses
  199. verbose,
  200. fmodule,
  201. symdef,
  202. gdb;
  203. {****************************************************************************
  204. Tdef
  205. ****************************************************************************}
  206. constructor tdef.create;
  207. begin
  208. inherited create;
  209. deftype:=abstractdef;
  210. owner := nil;
  211. typesym := nil;
  212. defoptions:=[];
  213. end;
  214. function tdef.typename:string;
  215. begin
  216. if assigned(typesym) and
  217. not(deftype in [procvardef,procdef]) and
  218. assigned(typesym._realname) and
  219. (typesym._realname^[1]<>'$') then
  220. typename:=typesym._realname^
  221. else
  222. typename:=gettypename;
  223. end;
  224. function tdef.gettypename : string;
  225. begin
  226. gettypename:='<unknown type>'
  227. end;
  228. function tdef.mangledparaname:string;
  229. begin
  230. if assigned(typesym) then
  231. mangledparaname:=typesym.name
  232. else
  233. mangledparaname:=getmangledparaname;
  234. end;
  235. function tdef.getparentdef:tdef;
  236. begin
  237. result:=nil;
  238. end;
  239. function tdef.getsymtable(t:tgetsymtable):tsymtable;
  240. begin
  241. getsymtable:=nil;
  242. end;
  243. {****************************************************************************
  244. TSYM (base for all symtypes)
  245. ****************************************************************************}
  246. constructor tsym.create(const n : string);
  247. begin
  248. if n[1]='$' then
  249. inherited createname(copy(n,2,255))
  250. else
  251. inherited createname(upper(n));
  252. _realname:=stringdup(n);
  253. typ:=abstractsym;
  254. symoptions:=[];
  255. defref:=nil;
  256. refs:=0;
  257. lastwritten:=nil;
  258. refcount:=0;
  259. fileinfo:=akttokenpos;
  260. if (cs_browser in aktmoduleswitches) and make_ref then
  261. begin
  262. defref:=tref.create(defref,@akttokenpos);
  263. inc(refcount);
  264. end;
  265. lastref:=defref;
  266. {$ifdef GDB}
  267. isstabwritten := false;
  268. {$endif GDB}
  269. symoptions:=current_object_option;
  270. end;
  271. constructor tsym.loadsym(ppufile:tcompilerppufile);
  272. var
  273. s : string;
  274. nr : word;
  275. begin
  276. nr:=ppufile.getword;
  277. s:=ppufile.getstring;
  278. if s[1]='$' then
  279. inherited createname(copy(s,2,255))
  280. else
  281. inherited createname(upper(s));
  282. _realname:=stringdup(s);
  283. typ:=abstractsym;
  284. { force the correct indexnr. must be after create! }
  285. indexnr:=nr;
  286. ppufile.getposinfo(fileinfo);
  287. ppufile.getsmallset(symoptions);
  288. lastref:=nil;
  289. defref:=nil;
  290. refs:=0;
  291. lastwritten:=nil;
  292. refcount:=0;
  293. {$ifdef GDB}
  294. isstabwritten := false;
  295. {$endif GDB}
  296. end;
  297. destructor tsym.destroy;
  298. begin
  299. {$ifdef MEMDEBUG}
  300. memrealnames.start;
  301. {$endif MEMDEBUG}
  302. stringdispose(_realname);
  303. {$ifdef MEMDEBUG}
  304. memrealnames.stop;
  305. {$endif MEMDEBUG}
  306. inherited destroy;
  307. end;
  308. procedure Tsym.writesym(ppufile:tcompilerppufile);
  309. begin
  310. ppufile.putword(indexnr);
  311. ppufile.putstring(_realname^);
  312. ppufile.putposinfo(fileinfo);
  313. ppufile.putsmallset(symoptions);
  314. end;
  315. procedure Tsym.buildderef;
  316. begin
  317. end;
  318. procedure Tsym.deref;
  319. begin
  320. end;
  321. {$ifdef GDB}
  322. function Tsym.get_var_value(const s:string):string;
  323. begin
  324. if s='name' then
  325. get_var_value:=name
  326. else if s='ownername' then
  327. get_var_value:=owner.name^
  328. else if s='line' then
  329. get_var_value:=tostr(fileinfo.line)
  330. else if s='N_LSYM' then
  331. get_var_value:=tostr(N_LSYM)
  332. else if s='N_LCSYM' then
  333. get_var_value:=tostr(N_LCSYM)
  334. else if s='N_RSYM' then
  335. get_var_value:=tostr(N_RSYM)
  336. else if s='N_TSYM' then
  337. get_var_value:=tostr(N_TSYM)
  338. else if s='N_STSYM' then
  339. get_var_value:=tostr(N_STSYM)
  340. else if s='N_FUNCTION' then
  341. get_var_value:=tostr(N_FUNCTION)
  342. else
  343. internalerror(200401152);
  344. end;
  345. function Tsym.stabstr_evaluate(const s:string;vars:array of string):Pchar;
  346. begin
  347. stabstr_evaluate:=string_evaluate(s,@get_var_value,vars);
  348. end;
  349. function Tsym.stabstring : pchar;
  350. begin
  351. { stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);}
  352. stabstring:=nil;
  353. end;
  354. {
  355. procedure Tsym.concatstabto(asmlist : taasmoutput);
  356. var
  357. stab_str : pchar;
  358. begin
  359. if not isstabwritten then
  360. begin
  361. stab_str := stabstring;
  362. if assigned(stab_str) then
  363. asmList.concat(Tai_stabs.Create(stab_str));
  364. isstabwritten:=true;
  365. end;
  366. end;}
  367. {$endif GDB}
  368. function tsym.realname : string;
  369. begin
  370. if assigned(_realname) then
  371. realname:=_realname^
  372. else
  373. realname:=name;
  374. end;
  375. function tsym.gettypedef:tdef;
  376. begin
  377. gettypedef:=nil;
  378. end;
  379. procedure Tsym.load_references(ppufile:tcompilerppufile;locals:boolean);
  380. var
  381. pos : tfileposinfo;
  382. move_last : boolean;
  383. begin
  384. move_last:=lastwritten=lastref;
  385. while (not ppufile.endofentry) do
  386. begin
  387. ppufile.getposinfo(pos);
  388. inc(refcount);
  389. lastref:=tref.create(lastref,@pos);
  390. lastref.is_written:=true;
  391. if refcount=1 then
  392. defref:=lastref;
  393. end;
  394. if move_last then
  395. lastwritten:=lastref;
  396. end;
  397. { big problem here :
  398. wrong refs were written because of
  399. interface parsing of other units PM
  400. moduleindex must be checked !! }
  401. function Tsym.write_references(ppufile:tcompilerppufile;locals:boolean):boolean;
  402. var
  403. d : tderef;
  404. ref : tref;
  405. symref_written,move_last : boolean;
  406. begin
  407. write_references:=false;
  408. if lastwritten=lastref then
  409. exit;
  410. { should we update lastref }
  411. move_last:=true;
  412. symref_written:=false;
  413. { write symbol refs }
  414. d.reset;
  415. if assigned(lastwritten) then
  416. ref:=lastwritten
  417. else
  418. ref:=defref;
  419. while assigned(ref) do
  420. begin
  421. if ref.moduleindex=current_module.unit_index then
  422. begin
  423. { write address to this symbol }
  424. if not symref_written then
  425. begin
  426. d.build(self);
  427. ppufile.putderef(d);
  428. symref_written:=true;
  429. end;
  430. ppufile.putposinfo(ref.posinfo);
  431. ref.is_written:=true;
  432. if move_last then
  433. lastwritten:=ref;
  434. end
  435. else if not ref.is_written then
  436. move_last:=false
  437. else if move_last then
  438. lastwritten:=ref;
  439. ref:=ref.nextref;
  440. end;
  441. if symref_written then
  442. ppufile.writeentry(ibsymref);
  443. write_references:=symref_written;
  444. end;
  445. function Tsym.is_visible_for_object(currobjdef:Tdef):boolean;
  446. begin
  447. is_visible_for_object:=false;
  448. { private symbols are allowed when we are in the same
  449. module as they are defined }
  450. if (sp_private in symoptions) and
  451. assigned(owner.defowner) and
  452. (owner.defowner.owner.symtabletype in [globalsymtable,staticsymtable]) and
  453. (owner.defowner.owner.unitid<>0) then
  454. exit;
  455. { protected symbols are vissible in the module that defines them and
  456. also visible to related objects }
  457. if (sp_protected in symoptions) and
  458. (
  459. (
  460. assigned(owner.defowner) and
  461. (owner.defowner.owner.symtabletype in [globalsymtable,staticsymtable]) and
  462. (owner.defowner.owner.unitid<>0)
  463. ) and
  464. not(
  465. assigned(currobjdef) and
  466. Tobjectdef(currobjdef).is_related(tobjectdef(owner.defowner))
  467. )
  468. ) then
  469. exit;
  470. is_visible_for_object:=true;
  471. end;
  472. {****************************************************************************
  473. TRef
  474. ****************************************************************************}
  475. constructor tref.create(ref :tref;pos : pfileposinfo);
  476. begin
  477. nextref:=nil;
  478. if pos<>nil then
  479. posinfo:=pos^;
  480. if assigned(current_module) then
  481. moduleindex:=current_module.unit_index;
  482. if assigned(ref) then
  483. ref.nextref:=self;
  484. is_written:=false;
  485. end;
  486. procedure tref.freechain;
  487. var
  488. p,q : tref;
  489. begin
  490. p:=nextref;
  491. nextref:=nil;
  492. while assigned(p) do
  493. begin
  494. q:=p.nextref;
  495. p.free;
  496. p:=q;
  497. end;
  498. end;
  499. destructor tref.destroy;
  500. begin
  501. nextref:=nil;
  502. end;
  503. {****************************************************************************
  504. TType
  505. ****************************************************************************}
  506. procedure ttype.reset;
  507. begin
  508. def:=nil;
  509. sym:=nil;
  510. end;
  511. procedure ttype.setdef(p:tdef);
  512. begin
  513. def:=p;
  514. sym:=nil;
  515. end;
  516. procedure ttype.setsym(p:tsym);
  517. begin
  518. sym:=p;
  519. def:=p.gettypedef;
  520. if not assigned(def) then
  521. internalerror(1234005);
  522. end;
  523. procedure ttype.resolve;
  524. var
  525. p : tsymtableentry;
  526. begin
  527. p:=deref.resolve;
  528. if assigned(p) then
  529. begin
  530. if p is tsym then
  531. begin
  532. setsym(tsym(p));
  533. if not assigned(def) then
  534. internalerror(200212272);
  535. end
  536. else
  537. begin
  538. setdef(tdef(p));
  539. end;
  540. end
  541. else
  542. reset;
  543. end;
  544. procedure ttype.buildderef;
  545. begin
  546. { Write symbol references when the symbol is a redefine,
  547. but don't write symbol references for the current unit
  548. and for the system unit }
  549. if assigned(sym) and
  550. (
  551. (sym<>def.typesym) or
  552. ((sym.owner.unitid<>0) and
  553. (sym.owner.unitid<>1))
  554. ) then
  555. deref.build(sym)
  556. else
  557. deref.build(def);
  558. end;
  559. {****************************************************************************
  560. TSymList
  561. ****************************************************************************}
  562. constructor tsymlist.create;
  563. begin
  564. procdef:=nil; { needed for procedures }
  565. firstsym:=nil;
  566. lastsym:=nil;
  567. end;
  568. destructor tsymlist.destroy;
  569. begin
  570. clear;
  571. end;
  572. function tsymlist.empty:boolean;
  573. begin
  574. empty:=(firstsym=nil);
  575. end;
  576. procedure tsymlist.clear;
  577. var
  578. hp : psymlistitem;
  579. begin
  580. while assigned(firstsym) do
  581. begin
  582. hp:=firstsym;
  583. firstsym:=firstsym^.next;
  584. dispose(hp);
  585. end;
  586. firstsym:=nil;
  587. lastsym:=nil;
  588. procdef:=nil;
  589. end;
  590. procedure tsymlist.addsym(slt:tsltype;p:tsym);
  591. var
  592. hp : psymlistitem;
  593. begin
  594. if not assigned(p) then
  595. internalerror(200110203);
  596. new(hp);
  597. fillchar(hp^,sizeof(tsymlistitem),0);
  598. hp^.sltype:=slt;
  599. hp^.sym:=p;
  600. hp^.symderef.reset;
  601. if assigned(lastsym) then
  602. lastsym^.next:=hp
  603. else
  604. firstsym:=hp;
  605. lastsym:=hp;
  606. end;
  607. procedure tsymlist.addsymderef(slt:tsltype;const d:tderef);
  608. var
  609. hp : psymlistitem;
  610. begin
  611. new(hp);
  612. fillchar(hp^,sizeof(tsymlistitem),0);
  613. hp^.sltype:=slt;
  614. hp^.symderef:=d;
  615. if assigned(lastsym) then
  616. lastsym^.next:=hp
  617. else
  618. firstsym:=hp;
  619. lastsym:=hp;
  620. end;
  621. procedure tsymlist.addconst(slt:tsltype;v:longint);
  622. var
  623. hp : psymlistitem;
  624. begin
  625. new(hp);
  626. fillchar(hp^,sizeof(tsymlistitem),0);
  627. hp^.sltype:=slt;
  628. hp^.value:=v;
  629. if assigned(lastsym) then
  630. lastsym^.next:=hp
  631. else
  632. firstsym:=hp;
  633. lastsym:=hp;
  634. end;
  635. procedure tsymlist.addtype(slt:tsltype;const tt:ttype);
  636. var
  637. hp : psymlistitem;
  638. begin
  639. new(hp);
  640. fillchar(hp^,sizeof(tsymlistitem),0);
  641. hp^.sltype:=slt;
  642. hp^.tt:=tt;
  643. if assigned(lastsym) then
  644. lastsym^.next:=hp
  645. else
  646. firstsym:=hp;
  647. lastsym:=hp;
  648. end;
  649. function tsymlist.getcopy:tsymlist;
  650. var
  651. hp : tsymlist;
  652. hp2 : psymlistitem;
  653. hpn : psymlistitem;
  654. begin
  655. hp:=tsymlist.create;
  656. hp.procdef:=procdef;
  657. hp2:=firstsym;
  658. while assigned(hp2) do
  659. begin
  660. new(hpn);
  661. hpn^:=hp2^;
  662. hpn^.next:=nil;
  663. if assigned(hp.lastsym) then
  664. hp.lastsym^.next:=hpn
  665. else
  666. hp.firstsym:=hpn;
  667. hp.lastsym:=hpn;
  668. hp2:=hp2^.next;
  669. end;
  670. getcopy:=hp;
  671. end;
  672. procedure tsymlist.resolve;
  673. var
  674. hp : psymlistitem;
  675. begin
  676. procdef:=tdef(procdefderef.resolve);
  677. hp:=firstsym;
  678. while assigned(hp) do
  679. begin
  680. case hp^.sltype of
  681. sl_call,
  682. sl_load,
  683. sl_subscript :
  684. hp^.sym:=tsym(hp^.symderef.resolve);
  685. sl_typeconv :
  686. hp^.tt.resolve;
  687. sl_vec :
  688. ;
  689. else
  690. internalerror(200110205);
  691. end;
  692. hp:=hp^.next;
  693. end;
  694. end;
  695. procedure tsymlist.buildderef;
  696. var
  697. hp : psymlistitem;
  698. begin
  699. procdefderef.build(procdef);
  700. hp:=firstsym;
  701. while assigned(hp) do
  702. begin
  703. case hp^.sltype of
  704. sl_call,
  705. sl_load,
  706. sl_subscript :
  707. hp^.symderef.build(hp^.sym);
  708. sl_typeconv :
  709. hp^.tt.buildderef;
  710. sl_vec :
  711. ;
  712. else
  713. internalerror(200110205);
  714. end;
  715. hp:=hp^.next;
  716. end;
  717. end;
  718. {****************************************************************************
  719. Tderef
  720. ****************************************************************************}
  721. procedure tderef.reset;
  722. begin
  723. dataidx:=-1;
  724. end;
  725. procedure tderef.build(s:tsymtableentry);
  726. var
  727. len : byte;
  728. data : array[0..255] of byte;
  729. function is_child(currdef,ownerdef:tdef):boolean;
  730. begin
  731. while assigned(currdef) and
  732. (currdef<>ownerdef) do
  733. currdef:=currdef.getparentdef;
  734. result:=assigned(currdef);
  735. end;
  736. procedure addowner(s:tsymtableentry);
  737. begin
  738. if not assigned(s.owner) then
  739. internalerror(200306063);
  740. case s.owner.symtabletype of
  741. globalsymtable :
  742. begin
  743. if s.owner.unitid=0 then
  744. begin
  745. data[len]:=ord(deref_aktglobal);
  746. inc(len);
  747. end
  748. else
  749. begin
  750. { check if the unit is available in the uses
  751. clause, else it's an error }
  752. if s.owner.unitid=$ffff then
  753. internalerror(200306063);
  754. data[len]:=ord(deref_unit);
  755. data[len+1]:=s.owner.unitid shr 8;
  756. data[len+2]:=s.owner.unitid and $ff;
  757. inc(len,3);
  758. end;
  759. end;
  760. staticsymtable :
  761. begin
  762. { only references to the current static symtable are allowed }
  763. if s.owner<>aktstaticsymtable then
  764. internalerror(200306233);
  765. data[len]:=ord(deref_aktstatic);
  766. inc(len);
  767. end;
  768. localsymtable :
  769. begin
  770. addowner(s.owner.defowner);
  771. data[len]:=ord(deref_def);
  772. data[len+1]:=s.owner.defowner.indexnr shr 8;
  773. data[len+2]:=s.owner.defowner.indexnr and $ff;
  774. data[len+3]:=ord(deref_local);
  775. inc(len,4);
  776. end;
  777. parasymtable :
  778. begin
  779. addowner(s.owner.defowner);
  780. data[len]:=ord(deref_def);
  781. data[len+1]:=s.owner.defowner.indexnr shr 8;
  782. data[len+2]:=s.owner.defowner.indexnr and $ff;
  783. data[len+3]:=ord(deref_para);
  784. inc(len,4);
  785. end;
  786. objectsymtable,
  787. recordsymtable :
  788. begin
  789. addowner(s.owner.defowner);
  790. data[len]:=ord(deref_def);
  791. data[len+1]:=s.owner.defowner.indexnr shr 8;
  792. data[len+2]:=s.owner.defowner.indexnr and $ff;
  793. data[len+3]:=ord(deref_record);
  794. inc(len,4);
  795. end;
  796. else
  797. internalerror(200306065);
  798. end;
  799. if len>252 then
  800. internalerror(200306062);
  801. end;
  802. procedure addparentobject(currdef,ownerdef:tdef);
  803. var
  804. nextdef : tdef;
  805. begin
  806. if not assigned(currdef) then
  807. internalerror(200306185);
  808. { Already handled by derefaktrecordindex }
  809. if currdef=ownerdef then
  810. internalerror(200306188);
  811. { Generate a direct reference to the top parent
  812. class available in the current unit, this is required because
  813. the parent class is maybe not resolved yet and therefor
  814. has the childof value not available yet }
  815. while (currdef<>ownerdef) do
  816. begin
  817. nextdef:=currdef.getparentdef;
  818. { objects are only allowed in globalsymtable,staticsymtable this check is
  819. needed because we need the unitid }
  820. if not(nextdef.owner.symtabletype in [globalsymtable,staticsymtable]) then
  821. internalerror(200306187);
  822. { Next parent is in a different unit, then stop }
  823. if nextdef.owner.unitid<>0 then
  824. break;
  825. currdef:=nextdef;
  826. end;
  827. { Add reference where to start the parent lookup }
  828. if currdef=aktrecordsymtable.defowner then
  829. begin
  830. data[len]:=ord(deref_aktrecord);
  831. inc(len);
  832. end
  833. else
  834. begin
  835. if currdef.owner.symtabletype=globalsymtable then
  836. data[len]:=ord(deref_aktglobal)
  837. else
  838. data[len]:=ord(deref_aktstatic);
  839. data[len+1]:=ord(deref_def);
  840. data[len+2]:=currdef.indexnr shr 8;
  841. data[len+3]:=currdef.indexnr and $ff;
  842. data[len+4]:=ord(deref_record);
  843. inc(len,5);
  844. end;
  845. { When the current found parent in this module is not the owner we
  846. add derefs for the parent classes not available in this unit }
  847. while (currdef<>ownerdef) do
  848. begin
  849. data[len]:=ord(deref_parent_object);
  850. inc(len);
  851. currdef:=currdef.getparentdef;
  852. { It should be valid as it is checked by is_child }
  853. if not assigned(currdef) then
  854. internalerror(200306186);
  855. end;
  856. end;
  857. begin
  858. { skip length byte }
  859. len:=1;
  860. if assigned(s) then
  861. begin
  862. { Static symtable of current unit ? }
  863. if (s.owner.symtabletype=staticsymtable) and
  864. (s.owner.unitid=0) then
  865. begin
  866. data[len]:=ord(deref_aktstatic);
  867. inc(len);
  868. end
  869. { Global symtable of current unit ? }
  870. else if (s.owner.symtabletype=globalsymtable) and
  871. (s.owner.unitid=0) then
  872. begin
  873. data[len]:=ord(deref_aktglobal);
  874. inc(len);
  875. end
  876. { Current record/object symtable ? }
  877. else if (s.owner=aktrecordsymtable) then
  878. begin
  879. data[len]:=ord(deref_aktrecord);
  880. inc(len);
  881. end
  882. { Current local symtable ? }
  883. else if (s.owner=aktlocalsymtable) then
  884. begin
  885. data[len]:=ord(deref_aktlocal);
  886. inc(len);
  887. end
  888. { Current para symtable ? }
  889. else if (s.owner=aktparasymtable) then
  890. begin
  891. data[len]:=ord(deref_aktpara);
  892. inc(len);
  893. end
  894. { Parent class? }
  895. else if assigned(aktrecordsymtable) and
  896. (aktrecordsymtable.symtabletype=objectsymtable) and
  897. (s.owner.symtabletype=objectsymtable) and
  898. is_child(tdef(aktrecordsymtable.defowner),tdef(s.owner.defowner)) then
  899. begin
  900. addparentobject(tdef(aktrecordsymtable.defowner),tdef(s.owner.defowner));
  901. end
  902. else
  903. { Default, start by building from unit symtable }
  904. begin
  905. addowner(s);
  906. end;
  907. { Add index of the symbol/def }
  908. if s is tsym then
  909. data[len]:=ord(deref_sym)
  910. else
  911. data[len]:=ord(deref_def);
  912. data[len+1]:=s.indexnr shr 8;
  913. data[len+2]:=s.indexnr and $ff;
  914. inc(len,3);
  915. end
  916. else
  917. begin
  918. { nil pointer }
  919. data[len]:=0;
  920. inc(len);
  921. end;
  922. { store data length in first byte }
  923. data[0]:=len-1;
  924. { store index and write to derefdata }
  925. dataidx:=current_module.derefdata.size;
  926. current_module.derefdata.write(data,len);
  927. end;
  928. function tderef.resolve:tsymtableentry;
  929. var
  930. pd : tdef;
  931. pm : tmodule;
  932. typ : tdereftype;
  933. st : tsymtable;
  934. idx : word;
  935. i : longint;
  936. len : byte;
  937. data : array[0..255] of byte;
  938. begin
  939. result:=nil;
  940. { not initialized }
  941. if dataidx=-1 then
  942. internalerror(200306067);
  943. { read data }
  944. current_module.derefdata.seek(dataidx);
  945. if current_module.derefdata.read(len,1)<>1 then
  946. internalerror(200310221);
  947. if len>0 then
  948. begin
  949. if current_module.derefdata.read(data,len)<>len then
  950. internalerror(200310222);
  951. end;
  952. { process data }
  953. st:=nil;
  954. i:=0;
  955. while (i<len) do
  956. begin
  957. typ:=tdereftype(data[i]);
  958. inc(i);
  959. case typ of
  960. deref_nil :
  961. begin
  962. result:=nil;
  963. { Only allowed when no other deref is available }
  964. if len<>1 then
  965. internalerror(200306232);
  966. end;
  967. deref_sym :
  968. begin
  969. if not assigned(st) then
  970. internalerror(200309141);
  971. idx:=(data[i] shl 8) or data[i+1];
  972. inc(i,2);
  973. result:=st.getsymnr(idx);
  974. end;
  975. deref_def :
  976. begin
  977. if not assigned(st) then
  978. internalerror(200309142);
  979. idx:=(data[i] shl 8) or data[i+1];
  980. inc(i,2);
  981. result:=st.getdefnr(idx);
  982. end;
  983. deref_aktrecord :
  984. st:=aktrecordsymtable;
  985. deref_aktstatic :
  986. st:=aktstaticsymtable;
  987. deref_aktglobal :
  988. st:=aktglobalsymtable;
  989. deref_aktlocal :
  990. st:=aktlocalsymtable;
  991. deref_aktpara :
  992. st:=aktparasymtable;
  993. deref_unit :
  994. begin
  995. idx:=(data[i] shl 8) or data[i+1];
  996. inc(i,2);
  997. if idx>current_module.mapsize then
  998. internalerror(200306231);
  999. pm:=current_module.map[idx].u;
  1000. if not assigned(pm) then
  1001. internalerror(200212273);
  1002. st:=pm.globalsymtable;
  1003. end;
  1004. deref_local :
  1005. begin
  1006. if not assigned(result) then
  1007. internalerror(200306069);
  1008. st:=tdef(result).getsymtable(gs_local);
  1009. result:=nil;
  1010. if not assigned(st) then
  1011. internalerror(200212275);
  1012. end;
  1013. deref_para :
  1014. begin
  1015. if not assigned(result) then
  1016. internalerror(2003060610);
  1017. st:=tdef(result).getsymtable(gs_para);
  1018. result:=nil;
  1019. if not assigned(st) then
  1020. internalerror(200212276);
  1021. end;
  1022. deref_record :
  1023. begin
  1024. if not assigned(result) then
  1025. internalerror(200306068);
  1026. st:=tdef(result).getsymtable(gs_record);
  1027. result:=nil;
  1028. if not assigned(st) then
  1029. internalerror(200212274);
  1030. end;
  1031. deref_parent_object :
  1032. begin
  1033. { load current object symtable if no
  1034. symtable is available yet }
  1035. if st=nil then
  1036. begin
  1037. st:=aktrecordsymtable;
  1038. if not assigned(st) then
  1039. internalerror(200306068);
  1040. end;
  1041. if st.symtabletype<>objectsymtable then
  1042. internalerror(200306189);
  1043. pd:=tdef(st.defowner).getparentdef;
  1044. if not assigned(pd) then
  1045. internalerror(200306184);
  1046. st:=pd.getsymtable(gs_record);
  1047. if not assigned(st) then
  1048. internalerror(200212274);
  1049. end;
  1050. else
  1051. internalerror(200212277);
  1052. end;
  1053. end;
  1054. end;
  1055. {*****************************************************************************
  1056. TCompilerPPUFile
  1057. *****************************************************************************}
  1058. procedure tcompilerppufile.checkerror;
  1059. begin
  1060. if error then
  1061. Message(unit_f_ppu_read_error);
  1062. end;
  1063. procedure tcompilerppufile.getguid(var g: tguid);
  1064. begin
  1065. getdata(g,sizeof(g));
  1066. end;
  1067. function tcompilerppufile.getexprint:tconstexprint;
  1068. var
  1069. l1,l2 : longint;
  1070. begin
  1071. if sizeof(tconstexprint)=8 then
  1072. begin
  1073. l1:=getlongint;
  1074. l2:=getlongint;
  1075. {$ifopt R+}
  1076. {$define Range_check_on}
  1077. {$endif opt R+}
  1078. {$R- needed here }
  1079. {$ifdef Delphi}
  1080. result:=int64(l1)+(int64(l2) shl 32);
  1081. {$else}
  1082. result:=qword(l1)+(int64(l2) shl 32);
  1083. {$endif}
  1084. {$ifdef Range_check_on}
  1085. {$R+}
  1086. {$undef Range_check_on}
  1087. {$endif Range_check_on}
  1088. end
  1089. else
  1090. result:=tconstexprint(getlongint);
  1091. end;
  1092. function tcompilerppufile.getPtrUInt:TConstPtrUInt;
  1093. var
  1094. l1,l2 : longint;
  1095. begin
  1096. if sizeof(TConstPtrUInt)=8 then
  1097. begin
  1098. l1:=getlongint;
  1099. l2:=getlongint;
  1100. {$ifopt R+}
  1101. {$define Range_check_on}
  1102. {$endif opt R+}
  1103. {$R- needed here }
  1104. {$ifdef Delphi}
  1105. result:=int64(l1)+(int64(l2) shl 32);
  1106. {$else}
  1107. result:=qword(l1)+(int64(l2) shl 32);
  1108. {$endif}
  1109. {$ifdef Range_check_on}
  1110. {$R+}
  1111. {$undef Range_check_on}
  1112. {$endif Range_check_on}
  1113. end
  1114. else
  1115. result:=TConstPtrUInt(getlongint);
  1116. end;
  1117. procedure tcompilerppufile.getposinfo(var p:tfileposinfo);
  1118. var
  1119. info : byte;
  1120. begin
  1121. {
  1122. info byte layout in bits:
  1123. 0-1 - amount of bytes for fileindex
  1124. 2-3 - amount of bytes for line
  1125. 4-5 - amount of bytes for column
  1126. }
  1127. info:=getbyte;
  1128. case (info and $03) of
  1129. 0 : p.fileindex:=getbyte;
  1130. 1 : p.fileindex:=getword;
  1131. 2 : p.fileindex:=(getbyte shl 16) or getword;
  1132. 3 : p.fileindex:=getlongint;
  1133. end;
  1134. case ((info shr 2) and $03) of
  1135. 0 : p.line:=getbyte;
  1136. 1 : p.line:=getword;
  1137. 2 : p.line:=(getbyte shl 16) or getword;
  1138. 3 : p.line:=getlongint;
  1139. end;
  1140. case ((info shr 4) and $03) of
  1141. 0 : p.column:=getbyte;
  1142. 1 : p.column:=getword;
  1143. 2 : p.column:=(getbyte shl 16) or getword;
  1144. 3 : p.column:=getlongint;
  1145. end;
  1146. end;
  1147. procedure tcompilerppufile.getderef(var d:tderef);
  1148. begin
  1149. d.dataidx:=getlongint;
  1150. end;
  1151. function tcompilerppufile.getsymlist:tsymlist;
  1152. var
  1153. symderef : tderef;
  1154. tt : ttype;
  1155. slt : tsltype;
  1156. idx : longint;
  1157. p : tsymlist;
  1158. begin
  1159. p:=tsymlist.create;
  1160. getderef(p.procdefderef);
  1161. repeat
  1162. slt:=tsltype(getbyte);
  1163. case slt of
  1164. sl_none :
  1165. break;
  1166. sl_call,
  1167. sl_load,
  1168. sl_subscript :
  1169. begin
  1170. getderef(symderef);
  1171. p.addsymderef(slt,symderef);
  1172. end;
  1173. sl_typeconv :
  1174. begin
  1175. gettype(tt);
  1176. p.addtype(slt,tt);
  1177. end;
  1178. sl_vec :
  1179. begin
  1180. idx:=getlongint;
  1181. p.addconst(slt,idx);
  1182. end;
  1183. else
  1184. internalerror(200110204);
  1185. end;
  1186. until false;
  1187. getsymlist:=tsymlist(p);
  1188. end;
  1189. procedure tcompilerppufile.gettype(var t:ttype);
  1190. begin
  1191. getderef(t.deref);
  1192. t.def:=nil;
  1193. t.sym:=nil;
  1194. end;
  1195. function tcompilerppufile.getasmsymbol:tasmsymbol;
  1196. begin
  1197. getasmsymbol:=tasmsymbol(pointer(getlongint));
  1198. end;
  1199. procedure tcompilerppufile.putposinfo(const p:tfileposinfo);
  1200. var
  1201. oldcrc : boolean;
  1202. info : byte;
  1203. begin
  1204. { posinfo is not relevant for changes in PPU }
  1205. oldcrc:=do_crc;
  1206. do_crc:=false;
  1207. {
  1208. info byte layout in bits:
  1209. 0-1 - amount of bytes for fileindex
  1210. 2-3 - amount of bytes for line
  1211. 4-5 - amount of bytes for column
  1212. }
  1213. info:=0;
  1214. { calculate info byte }
  1215. if (p.fileindex>$ff) then
  1216. begin
  1217. if (p.fileindex<=$ffff) then
  1218. info:=info or $1
  1219. else
  1220. if (p.fileindex<=$ffffff) then
  1221. info:=info or $2
  1222. else
  1223. info:=info or $3;
  1224. end;
  1225. if (p.line>$ff) then
  1226. begin
  1227. if (p.line<=$ffff) then
  1228. info:=info or $4
  1229. else
  1230. if (p.line<=$ffffff) then
  1231. info:=info or $8
  1232. else
  1233. info:=info or $c;
  1234. end;
  1235. if (p.column>$ff) then
  1236. begin
  1237. if (p.column<=$ffff) then
  1238. info:=info or $10
  1239. else
  1240. if (p.column<=$ffffff) then
  1241. info:=info or $20
  1242. else
  1243. info:=info or $30;
  1244. end;
  1245. { write data }
  1246. putbyte(info);
  1247. case (info and $03) of
  1248. 0 : putbyte(p.fileindex);
  1249. 1 : putword(p.fileindex);
  1250. 2 : begin
  1251. putbyte(p.fileindex shr 16);
  1252. putword(p.fileindex and $ffff);
  1253. end;
  1254. 3 : putlongint(p.fileindex);
  1255. end;
  1256. case ((info shr 2) and $03) of
  1257. 0 : putbyte(p.line);
  1258. 1 : putword(p.line);
  1259. 2 : begin
  1260. putbyte(p.line shr 16);
  1261. putword(p.line and $ffff);
  1262. end;
  1263. 3 : putlongint(p.line);
  1264. end;
  1265. case ((info shr 4) and $03) of
  1266. 0 : putbyte(p.column);
  1267. 1 : putword(p.column);
  1268. 2 : begin
  1269. putbyte(p.column shr 16);
  1270. putword(p.column and $ffff);
  1271. end;
  1272. 3 : putlongint(p.column);
  1273. end;
  1274. do_crc:=oldcrc;
  1275. end;
  1276. procedure tcompilerppufile.putguid(const g: tguid);
  1277. begin
  1278. putdata(g,sizeof(g));
  1279. end;
  1280. procedure tcompilerppufile.putexprint(v:tconstexprint);
  1281. begin
  1282. if sizeof(TConstExprInt)=8 then
  1283. begin
  1284. putlongint(longint(lo(v)));
  1285. putlongint(longint(hi(v)));
  1286. end
  1287. else if sizeof(TConstExprInt)=4 then
  1288. putlongint(longint(v))
  1289. else
  1290. internalerror(2002082601);
  1291. end;
  1292. procedure tcompilerppufile.PutPtrUInt(v:TConstPtrUInt);
  1293. begin
  1294. if sizeof(TConstPtrUInt)=8 then
  1295. begin
  1296. putlongint(longint(lo(v)));
  1297. putlongint(longint(hi(v)));
  1298. end
  1299. else if sizeof(TConstPtrUInt)=4 then
  1300. putlongint(longint(v))
  1301. else
  1302. internalerror(2002082601);
  1303. end;
  1304. procedure tcompilerppufile.putderef(const d:tderef);
  1305. var
  1306. oldcrc : boolean;
  1307. begin
  1308. oldcrc:=do_crc;
  1309. do_crc:=false;
  1310. putlongint(d.dataidx);
  1311. do_crc:=oldcrc;
  1312. end;
  1313. procedure tcompilerppufile.putsymlist(p:tsymlist);
  1314. var
  1315. hp : psymlistitem;
  1316. begin
  1317. putderef(p.procdefderef);
  1318. hp:=p.firstsym;
  1319. while assigned(hp) do
  1320. begin
  1321. putbyte(byte(hp^.sltype));
  1322. case hp^.sltype of
  1323. sl_call,
  1324. sl_load,
  1325. sl_subscript :
  1326. putderef(hp^.symderef);
  1327. sl_typeconv :
  1328. puttype(hp^.tt);
  1329. sl_vec :
  1330. putlongint(hp^.value);
  1331. else
  1332. internalerror(200110205);
  1333. end;
  1334. hp:=hp^.next;
  1335. end;
  1336. putbyte(byte(sl_none));
  1337. end;
  1338. procedure tcompilerppufile.puttype(const t:ttype);
  1339. begin
  1340. putderef(t.deref);
  1341. end;
  1342. procedure tcompilerppufile.putasmsymbol(s:tasmsymbol);
  1343. begin
  1344. if assigned(s) then
  1345. begin
  1346. if s.ppuidx=-1 then
  1347. begin
  1348. inc(objectlibrary.asmsymbolppuidx);
  1349. s.ppuidx:=objectlibrary.asmsymbolppuidx;
  1350. end;
  1351. putlongint(s.ppuidx);
  1352. end
  1353. else
  1354. putlongint(0);
  1355. end;
  1356. {$ifdef MEMDEBUG}
  1357. initialization
  1358. membrowser:=TMemDebug.create('BrowserRefs');
  1359. membrowser.stop;
  1360. memrealnames:=TMemDebug.create('Realnames');
  1361. memrealnames.stop;
  1362. memmanglednames:=TMemDebug.create('Manglednames');
  1363. memmanglednames.stop;
  1364. memprocpara:=TMemDebug.create('ProcPara');
  1365. memprocpara.stop;
  1366. memprocparast:=TMemDebug.create('ProcParaSt');
  1367. memprocparast.stop;
  1368. memproclocalst:=TMemDebug.create('ProcLocalSt');
  1369. memproclocalst.stop;
  1370. memprocnodetree:=TMemDebug.create('ProcNodeTree');
  1371. memprocnodetree.stop;
  1372. finalization
  1373. membrowser.free;
  1374. memrealnames.free;
  1375. memmanglednames.free;
  1376. memprocpara.free;
  1377. memprocparast.free;
  1378. memproclocalst.free;
  1379. memprocnodetree.free;
  1380. {$endif MEMDEBUG}
  1381. end.
  1382. {
  1383. $Log$
  1384. Revision 1.38 2004-01-31 22:48:31 daniel
  1385. * Fix stabs generation problem reported by Jonas
  1386. Revision 1.37 2004/01/31 21:09:58 daniel
  1387. * Stabs lineinfo problem fixed
  1388. Revision 1.36 2004/01/31 18:40:15 daniel
  1389. * Last steps before removal of aasmtai dependency in symsym can be
  1390. accomplished.
  1391. Revision 1.35 2004/01/26 16:12:28 daniel
  1392. * reginfo now also only allocated during register allocation
  1393. * third round of gdb cleanups: kick out most of concatstabto
  1394. Revision 1.34 2003/11/10 22:02:52 peter
  1395. * cross unit inlining fixed
  1396. Revision 1.33 2003/10/28 15:36:01 peter
  1397. * absolute to object field supported, fixes tb0458
  1398. Revision 1.32 2003/10/23 14:44:07 peter
  1399. * splitted buildderef and buildderefimpl to fix interface crc
  1400. calculation
  1401. Revision 1.31 2003/10/22 20:40:00 peter
  1402. * write derefdata in a separate ppu entry
  1403. Revision 1.30 2003/10/22 15:22:33 peter
  1404. * fixed unitsym-globalsymtable relation so the uses of a unit
  1405. is counted correctly
  1406. Revision 1.29 2003/10/17 14:38:32 peter
  1407. * 64k registers supported
  1408. * fixed some memory leaks
  1409. Revision 1.28 2003/10/07 16:06:30 peter
  1410. * tsymlist.def renamed to tsymlist.procdef
  1411. * tsymlist.procdef is now only used to store the procdef
  1412. Revision 1.27 2003/09/14 12:58:29 peter
  1413. * give IE when st is not assigned in deref
  1414. Revision 1.26 2003/06/25 18:31:23 peter
  1415. * sym,def resolving partly rewritten to support also parent objects
  1416. not directly available through the uses clause
  1417. Revision 1.25 2003/06/07 20:26:32 peter
  1418. * re-resolving added instead of reloading from ppu
  1419. * tderef object added to store deref info for resolving
  1420. Revision 1.24 2002/12/29 18:26:31 peter
  1421. * also use gettypename for procdef always
  1422. Revision 1.23 2002/12/29 14:57:50 peter
  1423. * unit loading changed to first register units and load them
  1424. afterwards. This is needed to support uses xxx in yyy correctly
  1425. * unit dependency check fixed
  1426. Revision 1.22 2002/09/05 19:29:46 peter
  1427. * memdebug enhancements
  1428. Revision 1.21 2002/08/18 20:06:28 peter
  1429. * inlining is now also allowed in interface
  1430. * renamed write/load to ppuwrite/ppuload
  1431. * tnode storing in ppu
  1432. * nld,ncon,nbas are already updated for storing in ppu
  1433. Revision 1.20 2002/08/11 13:24:16 peter
  1434. * saving of asmsymbols in ppu supported
  1435. * asmsymbollist global is removed and moved into a new class
  1436. tasmlibrarydata that will hold the info of a .a file which
  1437. corresponds with a single module. Added librarydata to tmodule
  1438. to keep the library info stored for the module. In the future the
  1439. objectfiles will also be stored to the tasmlibrarydata class
  1440. * all getlabel/newasmsymbol and friends are moved to the new class
  1441. Revision 1.19 2002/07/01 18:46:29 peter
  1442. * internal linker
  1443. * reorganized aasm layer
  1444. Revision 1.18 2002/05/18 13:34:21 peter
  1445. * readded missing revisions
  1446. Revision 1.17 2002/05/16 19:46:45 carl
  1447. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1448. + try to fix temp allocation (still in ifdef)
  1449. + generic constructor calls
  1450. + start of tassembler / tmodulebase class cleanup
  1451. Revision 1.15 2002/05/12 16:53:15 peter
  1452. * moved entry and exitcode to ncgutil and cgobj
  1453. * foreach gets extra argument for passing local data to the
  1454. iterator function
  1455. * -CR checks also class typecasts at runtime by changing them
  1456. into as
  1457. * fixed compiler to cycle with the -CR option
  1458. * fixed stabs with elf writer, finally the global variables can
  1459. be watched
  1460. * removed a lot of routines from cga unit and replaced them by
  1461. calls to cgobj
  1462. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1463. u32bit then the other is typecasted also to u32bit without giving
  1464. a rangecheck warning/error.
  1465. * fixed pascal calling method with reversing also the high tree in
  1466. the parast, detected by tcalcst3 test
  1467. Revision 1.14 2002/04/19 15:46:04 peter
  1468. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  1469. in most cases and not written to the ppu
  1470. * add mangeledname_prefix() routine to generate the prefix of
  1471. manglednames depending on the current procedure, object and module
  1472. * removed static procprefix since the mangledname is now build only
  1473. on demand from tprocdef.mangledname
  1474. }
  1475. end.