symtype.pas 46 KB

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