symtype.pas 46 KB

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