symsym.pas 83 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl, Pierre Muller
  4. Implementation for the symbols types of the symtable
  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 symsym;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. { common }
  23. cutils,
  24. { target }
  25. globtype,globals,
  26. { symtable }
  27. symconst,symbase,symtype,symdef,defcmp,
  28. { ppu }
  29. ppu,
  30. cclasses,symnot,
  31. { aasm }
  32. aasmbase,
  33. cpuinfo,cpubase,cgbase
  34. ;
  35. type
  36. { this class is the base for all symbol objects }
  37. tstoredsym = class(tsym)
  38. protected
  39. _mangledname : pstring;
  40. public
  41. constructor create(const n : string);
  42. constructor loadsym(ppufile:tcompilerppufile);
  43. destructor destroy;override;
  44. {$ifdef GDB}
  45. function get_var_value(const s:string):string;
  46. function stabstr_evaluate(const s:string;vars:array of string):Pchar;
  47. {$endif GDB}
  48. function mangledname : string;
  49. procedure generate_mangledname;virtual;abstract;
  50. end;
  51. tlabelsym = class(tstoredsym)
  52. lab : tasmlabel;
  53. used,
  54. defined : boolean;
  55. code : pointer; { should be tnode }
  56. constructor create(const n : string; l : tasmlabel);
  57. constructor ppuload(ppufile:tcompilerppufile);
  58. procedure generate_mangledname;override;
  59. procedure ppuwrite(ppufile:tcompilerppufile);override;
  60. {$ifdef GDB}
  61. function stabstring : pchar;override;
  62. {$endif GDB}
  63. end;
  64. tunitsym = class(Tsym)
  65. unitsymtable : tsymtable;
  66. constructor create(const n : string;ref : tsymtable);
  67. constructor ppuload(ppufile:tcompilerppufile);
  68. destructor destroy;override;
  69. procedure ppuwrite(ppufile:tcompilerppufile);override;
  70. end;
  71. terrorsym = class(Tsym)
  72. constructor create;
  73. end;
  74. Tprocdefcallback = procedure(p:Tprocdef;arg:pointer);
  75. tprocsym = class(tstoredsym)
  76. protected
  77. pdlistfirst,
  78. pdlistlast : pprocdeflist; { linked list of overloaded procdefs }
  79. function getprocdef(nr:cardinal):Tprocdef;
  80. public
  81. procdef_count : byte;
  82. {$ifdef GDB}
  83. is_global : boolean;
  84. {$endif GDB}
  85. overloadchecked : boolean;
  86. overloadcount : word; { amount of overloaded functions in this module }
  87. property procdef[nr:cardinal]:Tprocdef read getprocdef;
  88. constructor create(const n : string);
  89. constructor ppuload(ppufile:tcompilerppufile);
  90. destructor destroy;override;
  91. { writes all declarations except the specified one }
  92. procedure write_parameter_lists(skipdef:tprocdef);
  93. { tests, if all procedures definitions are defined and not }
  94. { only forward }
  95. procedure check_forward;
  96. procedure unchain_overload;
  97. procedure ppuwrite(ppufile:tcompilerppufile);override;
  98. procedure buildderef;override;
  99. procedure deref;override;
  100. procedure addprocdef(p:tprocdef);
  101. procedure addprocdef_deref(const d:tderef);
  102. procedure add_para_match_to(Aprocsym:Tprocsym;cpoptions:tcompare_paras_options);
  103. procedure concat_procdefs_to(s:Tprocsym);
  104. procedure foreach_procdef_static(proc2call:Tprocdefcallback;arg:pointer);
  105. function first_procdef:Tprocdef;
  106. function last_procdef:Tprocdef;
  107. function search_procdef_nopara_boolret:Tprocdef;
  108. function search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
  109. function search_procdef_bypara(params:Tlinkedlist;
  110. retdef:tdef;
  111. cpoptions:tcompare_paras_options):Tprocdef;
  112. function search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
  113. function search_procdef_assignment_operator(fromdef,todef:tdef):Tprocdef;
  114. function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
  115. {$ifdef GDB}
  116. function stabstring : pchar;override;
  117. {$endif GDB}
  118. end;
  119. ttypesym = class(Tsym)
  120. restype : ttype;
  121. {$ifdef GDB}
  122. isusedinstab : boolean;
  123. {$endif GDB}
  124. constructor create(const n : string;const tt : ttype);
  125. constructor ppuload(ppufile:tcompilerppufile);
  126. procedure ppuwrite(ppufile:tcompilerppufile);override;
  127. procedure buildderef;override;
  128. procedure deref;override;
  129. function gettypedef:tdef;override;
  130. procedure load_references(ppufile:tcompilerppufile;locals:boolean);override;
  131. function write_references(ppufile:tcompilerppufile;locals:boolean):boolean;override;
  132. {$ifdef GDB}
  133. function stabstring : pchar;override;
  134. {$endif GDB}
  135. end;
  136. tvarsym = class(tstoredsym)
  137. defaultconstsym : tsym;
  138. varoptions : tvaroptions;
  139. varspez : tvarspez; { sets the type of access }
  140. varstate : tvarstate;
  141. localloc : tparalocation; { register/reference for local var }
  142. fieldoffset : longint; { offset in record/object }
  143. paraitem : tparaitem;
  144. notifications : Tlinkedlist;
  145. constructor create(const n : string;vsp:tvarspez;const tt : ttype);
  146. constructor create_dll(const n : string;vsp:tvarspez;const tt : ttype);
  147. constructor create_C(const n,mangled : string;vsp:tvarspez;const tt : ttype);
  148. constructor ppuload(ppufile:tcompilerppufile);
  149. destructor destroy;override;
  150. procedure ppuwrite(ppufile:tcompilerppufile);override;
  151. procedure buildderef;override;
  152. procedure deref;override;
  153. procedure generate_mangledname;override;
  154. procedure set_mangledname(const s:string);
  155. function getsize : longint;
  156. function getvaluesize : longint;
  157. procedure trigger_notifications(what:Tnotification_flag);
  158. function register_notification(flags:Tnotification_flags;
  159. callback:Tnotification_callback):cardinal;
  160. procedure unregister_notification(id:cardinal);
  161. {$ifdef GDB}
  162. function stabstring : pchar;override;
  163. {$endif GDB}
  164. private
  165. procedure setvartype(const newtype: ttype);
  166. _vartype : ttype;
  167. public
  168. property vartype: ttype read _vartype write setvartype;
  169. end;
  170. tpropertysym = class(Tsym)
  171. propoptions : tpropertyoptions;
  172. propoverriden : tpropertysym;
  173. propoverridenderef : tderef;
  174. proptype,
  175. indextype : ttype;
  176. index,
  177. default : longint;
  178. readaccess,
  179. writeaccess,
  180. storedaccess : tsymlist;
  181. constructor create(const n : string);
  182. destructor destroy;override;
  183. constructor ppuload(ppufile:tcompilerppufile);
  184. function getsize : longint;
  185. procedure ppuwrite(ppufile:tcompilerppufile);override;
  186. function gettypedef:tdef;override;
  187. procedure buildderef;override;
  188. procedure deref;override;
  189. procedure dooverride(overriden:tpropertysym);
  190. end;
  191. tabsolutesym = class(Tvarsym)
  192. abstyp : absolutetyp;
  193. {$ifdef i386}
  194. absseg : boolean;
  195. {$endif i386}
  196. asmname : pstring;
  197. ref : tsymlist;
  198. constructor create(const n : string;const tt : ttype);
  199. constructor create_ref(const n : string;const tt : ttype;_ref:tsymlist);
  200. destructor destroy;override;
  201. constructor ppuload(ppufile:tcompilerppufile);
  202. procedure buildderef;override;
  203. procedure deref;override;
  204. function mangledname : string;
  205. procedure ppuwrite(ppufile:tcompilerppufile);override;
  206. {$ifdef gdb}
  207. function stabstring:Pchar;override;
  208. {$endif}
  209. end;
  210. ttypedconstsym = class(tstoredsym)
  211. typedconsttype : ttype;
  212. is_writable : boolean;
  213. constructor create(const n : string;p : tdef;writable : boolean);
  214. constructor createtype(const n : string;const tt : ttype;writable : boolean);
  215. constructor ppuload(ppufile:tcompilerppufile);
  216. destructor destroy;override;
  217. procedure generate_mangledname;override;
  218. procedure ppuwrite(ppufile:tcompilerppufile);override;
  219. procedure buildderef;override;
  220. procedure deref;override;
  221. function getsize:longint;
  222. {$ifdef GDB}
  223. function stabstring : pchar;override;
  224. {$endif GDB}
  225. end;
  226. tconstvalue = record
  227. case integer of
  228. 0: (valueord : tconstexprint);
  229. 1: (valueordptr : tconstptruint);
  230. 2: (valueptr : pointer; len : longint);
  231. end;
  232. tconstsym = class(tstoredsym)
  233. consttype : ttype;
  234. consttyp : tconsttyp;
  235. value : tconstvalue;
  236. resstrindex : longint; { needed for resource strings }
  237. constructor create_ord(const n : string;t : tconsttyp;v : tconstexprint);
  238. constructor create_ord_typed(const n : string;t : tconsttyp;v : tconstexprint;const tt:ttype);
  239. constructor create_ordptr_typed(const n : string;t : tconsttyp;v : tconstptruint;const tt:ttype);
  240. constructor create_ptr(const n : string;t : tconsttyp;v : pointer);
  241. constructor create_ptr_typed(const n : string;t : tconsttyp;v : pointer;const tt:ttype);
  242. constructor create_string(const n : string;t : tconsttyp;str:pchar;l:longint);
  243. constructor ppuload(ppufile:tcompilerppufile);
  244. destructor destroy;override;
  245. { function mangledname : string;}
  246. procedure buildderef;override;
  247. procedure deref;override;
  248. procedure ppuwrite(ppufile:tcompilerppufile);override;
  249. {$ifdef GDB}
  250. function stabstring : pchar;override;
  251. {$endif GDB}
  252. end;
  253. tenumsym = class(Tsym)
  254. value : longint;
  255. definition : tenumdef;
  256. definitionderef : tderef;
  257. nextenum : tenumsym;
  258. constructor create(const n : string;def : tenumdef;v : longint);
  259. constructor ppuload(ppufile:tcompilerppufile);
  260. procedure ppuwrite(ppufile:tcompilerppufile);override;
  261. procedure buildderef;override;
  262. procedure deref;override;
  263. procedure order;
  264. end;
  265. tsyssym = class(Tsym)
  266. number : longint;
  267. constructor create(const n : string;l : longint);
  268. constructor ppuload(ppufile:tcompilerppufile);
  269. destructor destroy;override;
  270. procedure ppuwrite(ppufile:tcompilerppufile);override;
  271. end;
  272. { compiler generated symbol to point to rtti and init/finalize tables }
  273. trttisym = class(tstoredsym)
  274. lab : tasmsymbol;
  275. rttityp : trttitype;
  276. constructor create(const n:string;rt:trttitype);
  277. constructor ppuload(ppufile:tcompilerppufile);
  278. procedure ppuwrite(ppufile:tcompilerppufile);override;
  279. function mangledname:string;
  280. function get_label:tasmsymbol;
  281. end;
  282. var
  283. generrorsym : tsym;
  284. implementation
  285. uses
  286. {$ifdef Delphi}
  287. sysutils,
  288. {$else Delphi}
  289. strings,
  290. {$endif Delphi}
  291. { global }
  292. verbose,
  293. { target }
  294. systems,
  295. { symtable }
  296. defutil,symtable,
  297. {$ifdef GDB}
  298. gdb,
  299. {$endif GDB}
  300. { tree }
  301. node,
  302. { aasm }
  303. aasmcpu,
  304. { module }
  305. fmodule,
  306. { codegen }
  307. paramgr,cresstr,
  308. procinfo
  309. ;
  310. {****************************************************************************
  311. Helpers
  312. ****************************************************************************}
  313. {****************************************************************************
  314. TSYM (base for all symtypes)
  315. ****************************************************************************}
  316. constructor tstoredsym.create(const n : string);
  317. begin
  318. inherited create(n);
  319. _mangledname:=nil;
  320. end;
  321. constructor tstoredsym.loadsym(ppufile:tcompilerppufile);
  322. var
  323. s : string;
  324. nr : word;
  325. begin
  326. inherited loadsym(ppufile);
  327. _mangledname:=nil;
  328. end;
  329. { procedure tstoredsym.buildderef;
  330. begin
  331. end;
  332. procedure tstoredsym.deref;
  333. begin
  334. end;}
  335. destructor tstoredsym.destroy;
  336. begin
  337. if assigned(_mangledname) then
  338. begin
  339. {$ifdef MEMDEBUG}
  340. memmanglednames.start;
  341. {$endif MEMDEBUG}
  342. stringdispose(_mangledname);
  343. {$ifdef MEMDEBUG}
  344. memmanglednames.stop;
  345. {$endif MEMDEBUG}
  346. end;
  347. if assigned(defref) then
  348. begin
  349. {$ifdef MEMDEBUG}
  350. membrowser.start;
  351. {$endif MEMDEBUG}
  352. defref.freechain;
  353. defref.free;
  354. {$ifdef MEMDEBUG}
  355. membrowser.stop;
  356. {$endif MEMDEBUG}
  357. end;
  358. inherited destroy;
  359. end;
  360. {$ifdef GDB}
  361. function Tstoredsym.get_var_value(const s:string):string;
  362. begin
  363. if s='mangledname' then
  364. get_var_value:=mangledname
  365. else
  366. get_var_value:=inherited get_var_value(s);
  367. end;
  368. function Tstoredsym.stabstr_evaluate(const s:string;vars:array of string):Pchar;
  369. begin
  370. stabstr_evaluate:=string_evaluate(s,@get_var_value,vars);
  371. end;
  372. {$endif GDB}
  373. function tstoredsym.mangledname : string;
  374. begin
  375. if not assigned(_mangledname) then
  376. begin
  377. generate_mangledname;
  378. if not assigned(_mangledname) then
  379. internalerror(200204171);
  380. end;
  381. {$ifdef compress}
  382. mangledname:=minilzw_decode(_mangledname^);
  383. {$else}
  384. mangledname:=_mangledname^;
  385. {$endif}
  386. end;
  387. {****************************************************************************
  388. TLABELSYM
  389. ****************************************************************************}
  390. constructor tlabelsym.create(const n : string; l : tasmlabel);
  391. begin
  392. inherited create(n);
  393. typ:=labelsym;
  394. lab:=l;
  395. used:=false;
  396. defined:=false;
  397. code:=nil;
  398. end;
  399. constructor tlabelsym.ppuload(ppufile:tcompilerppufile);
  400. begin
  401. inherited loadsym(ppufile);
  402. typ:=labelsym;
  403. { this is all dummy
  404. it is only used for local browsing }
  405. lab:=nil;
  406. code:=nil;
  407. used:=false;
  408. defined:=true;
  409. end;
  410. procedure tlabelsym.generate_mangledname;
  411. begin
  412. {$ifdef compress}
  413. _mangledname:=stringdup(minilzw_encode(lab.name));
  414. {$else}
  415. _mangledname:=stringdup(lab.name);
  416. {$endif}
  417. end;
  418. procedure tlabelsym.ppuwrite(ppufile:tcompilerppufile);
  419. begin
  420. if owner.symtabletype=globalsymtable then
  421. Message(sym_e_ill_label_decl)
  422. else
  423. begin
  424. inherited writesym(ppufile);
  425. ppufile.writeentry(iblabelsym);
  426. end;
  427. end;
  428. {$ifdef GDB}
  429. function Tlabelsym.stabstring : pchar;
  430. begin
  431. stabstring:=stabstr_evaluate('"${name}",${N_LSYM},0,${line},0',[]);
  432. end;
  433. {$endif GDB}
  434. {****************************************************************************
  435. TUNITSYM
  436. ****************************************************************************}
  437. constructor tunitsym.create(const n : string;ref : tsymtable);
  438. var
  439. old_make_ref : boolean;
  440. begin
  441. old_make_ref:=make_ref;
  442. make_ref:=false;
  443. inherited create(n);
  444. make_ref:=old_make_ref;
  445. typ:=unitsym;
  446. unitsymtable:=ref;
  447. end;
  448. constructor tunitsym.ppuload(ppufile:tcompilerppufile);
  449. begin
  450. inherited loadsym(ppufile);
  451. typ:=unitsym;
  452. unitsymtable:=nil;
  453. refs:=0;
  454. end;
  455. destructor tunitsym.destroy;
  456. begin
  457. inherited destroy;
  458. end;
  459. procedure tunitsym.ppuwrite(ppufile:tcompilerppufile);
  460. begin
  461. inherited writesym(ppufile);
  462. ppufile.writeentry(ibunitsym);
  463. end;
  464. {****************************************************************************
  465. TPROCSYM
  466. ****************************************************************************}
  467. constructor tprocsym.create(const n : string);
  468. begin
  469. inherited create(n);
  470. typ:=procsym;
  471. pdlistfirst:=nil;
  472. pdlistlast:=nil;
  473. owner:=nil;
  474. {$ifdef GDB}
  475. is_global:=false;
  476. {$endif GDB}
  477. overloadchecked:=false;
  478. overloadcount:=0;
  479. procdef_count:=0;
  480. end;
  481. constructor tprocsym.ppuload(ppufile:tcompilerppufile);
  482. var
  483. pdderef : tderef;
  484. i,n : longint;
  485. begin
  486. inherited loadsym(ppufile);
  487. typ:=procsym;
  488. pdlistfirst:=nil;
  489. pdlistlast:=nil;
  490. procdef_count:=0;
  491. n:=ppufile.getword;
  492. for i:=1to n do
  493. begin
  494. ppufile.getderef(pdderef);
  495. addprocdef_deref(pdderef);
  496. end;
  497. {$ifdef GDB}
  498. is_global:=false;
  499. {$endif GDB}
  500. overloadchecked:=false;
  501. overloadcount:=$ffff; { invalid, not used anymore }
  502. end;
  503. destructor tprocsym.destroy;
  504. var
  505. hp,p : pprocdeflist;
  506. begin
  507. p:=pdlistfirst;
  508. while assigned(p) do
  509. begin
  510. hp:=p^.next;
  511. dispose(p);
  512. p:=hp;
  513. end;
  514. inherited destroy;
  515. end;
  516. procedure tprocsym.ppuwrite(ppufile:tcompilerppufile);
  517. var
  518. p : pprocdeflist;
  519. n : word;
  520. begin
  521. inherited writesym(ppufile);
  522. { count procdefs }
  523. n:=0;
  524. p:=pdlistfirst;
  525. while assigned(p) do
  526. begin
  527. { only write the proc definitions that belong
  528. to this procsym and are in the global symtable }
  529. if p^.own and
  530. (p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then
  531. inc(n);
  532. p:=p^.next;
  533. end;
  534. ppufile.putword(n);
  535. { write procdefs }
  536. p:=pdlistfirst;
  537. while assigned(p) do
  538. begin
  539. { only write the proc definitions that belong
  540. to this procsym and are in the global symtable }
  541. if p^.own and
  542. (p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then
  543. ppufile.putderef(p^.defderef);
  544. p:=p^.next;
  545. end;
  546. ppufile.writeentry(ibprocsym);
  547. end;
  548. procedure tprocsym.write_parameter_lists(skipdef:tprocdef);
  549. var
  550. p : pprocdeflist;
  551. begin
  552. p:=pdlistfirst;
  553. while assigned(p) do
  554. begin
  555. if p^.def<>skipdef then
  556. MessagePos1(p^.def.fileinfo,sym_h_param_list,p^.def.fullprocname(false));
  557. p:=p^.next;
  558. end;
  559. end;
  560. procedure tprocsym.check_forward;
  561. var
  562. p : pprocdeflist;
  563. begin
  564. p:=pdlistfirst;
  565. while assigned(p) do
  566. begin
  567. if p^.own and
  568. (p^.def.forwarddef) then
  569. begin
  570. MessagePos1(p^.def.fileinfo,sym_e_forward_not_resolved,p^.def.fullprocname(false));
  571. { Turn futher error messages off }
  572. p^.def.forwarddef:=false;
  573. end;
  574. p:=p^.next;
  575. end;
  576. end;
  577. procedure tprocsym.buildderef;
  578. var
  579. p : pprocdeflist;
  580. begin
  581. p:=pdlistfirst;
  582. while assigned(p) do
  583. begin
  584. if p^.own then
  585. p^.defderef.build(p^.def);
  586. p:=p^.next;
  587. end;
  588. end;
  589. procedure tprocsym.deref;
  590. var
  591. p : pprocdeflist;
  592. begin
  593. { We have removed the overloaded entries, because they
  594. are not valid anymore and we can't deref them because
  595. the unit were they come from is not necessary in
  596. our uses clause (PFV) }
  597. unchain_overload;
  598. { Deref our own procdefs }
  599. p:=pdlistfirst;
  600. while assigned(p) do
  601. begin
  602. if not p^.own then
  603. internalerror(200310291);
  604. p^.def:=tprocdef(p^.defderef.resolve);
  605. p:=p^.next;
  606. end;
  607. end;
  608. procedure tprocsym.addprocdef(p:tprocdef);
  609. var
  610. pd : pprocdeflist;
  611. begin
  612. new(pd);
  613. pd^.def:=p;
  614. pd^.defderef.reset;
  615. pd^.next:=nil;
  616. pd^.own:=(pd^.def.procsym=self);
  617. { if not pd^.own then
  618. internalerror(2222222);}
  619. { Add at end of list to keep always
  620. a correct order, also after loading from ppu }
  621. if assigned(pdlistlast) then
  622. begin
  623. pdlistlast^.next:=pd;
  624. pdlistlast:=pd;
  625. end
  626. else
  627. begin
  628. pdlistfirst:=pd;
  629. pdlistlast:=pd;
  630. end;
  631. inc(procdef_count);
  632. end;
  633. procedure tprocsym.addprocdef_deref(const d:tderef);
  634. var
  635. pd : pprocdeflist;
  636. begin
  637. new(pd);
  638. pd^.def:=nil;
  639. pd^.defderef:=d;
  640. pd^.next:=nil;
  641. pd^.own:=true;
  642. { Add at end of list to keep always
  643. a correct order, also after loading from ppu }
  644. if assigned(pdlistlast) then
  645. begin
  646. pdlistlast^.next:=pd;
  647. pdlistlast:=pd;
  648. end
  649. else
  650. begin
  651. pdlistfirst:=pd;
  652. pdlistlast:=pd;
  653. end;
  654. inc(procdef_count);
  655. end;
  656. function Tprocsym.getprocdef(nr:cardinal):Tprocdef;
  657. var
  658. i : cardinal;
  659. pd : pprocdeflist;
  660. begin
  661. pd:=pdlistfirst;
  662. for i:=2 to nr do
  663. begin
  664. if not assigned(pd) then
  665. internalerror(200209051);
  666. pd:=pd^.next;
  667. end;
  668. getprocdef:=pd^.def;
  669. end;
  670. procedure Tprocsym.add_para_match_to(Aprocsym:Tprocsym;cpoptions:tcompare_paras_options);
  671. var
  672. pd:pprocdeflist;
  673. begin
  674. pd:=pdlistfirst;
  675. while assigned(pd) do
  676. begin
  677. if Aprocsym.search_procdef_bypara(pd^.def.para,nil,cpoptions)=nil then
  678. Aprocsym.addprocdef(pd^.def);
  679. pd:=pd^.next;
  680. end;
  681. end;
  682. procedure Tprocsym.concat_procdefs_to(s:Tprocsym);
  683. var
  684. pd : pprocdeflist;
  685. begin
  686. pd:=pdlistfirst;
  687. while assigned(pd) do
  688. begin
  689. s.addprocdef(pd^.def);
  690. pd:=pd^.next;
  691. end;
  692. end;
  693. function Tprocsym.first_procdef:Tprocdef;
  694. begin
  695. if assigned(pdlistfirst) then
  696. first_procdef:=pdlistfirst^.def
  697. else
  698. first_procdef:=nil;
  699. end;
  700. function Tprocsym.last_procdef:Tprocdef;
  701. begin
  702. if assigned(pdlistlast) then
  703. last_procdef:=pdlistlast^.def
  704. else
  705. last_procdef:=nil;
  706. end;
  707. procedure Tprocsym.foreach_procdef_static(proc2call:Tprocdefcallback;arg:pointer);
  708. var
  709. p : pprocdeflist;
  710. begin
  711. p:=pdlistfirst;
  712. while assigned(p) do
  713. begin
  714. proc2call(p^.def,arg);
  715. p:=p^.next;
  716. end;
  717. end;
  718. function Tprocsym.search_procdef_nopara_boolret:Tprocdef;
  719. var
  720. p : pprocdeflist;
  721. begin
  722. search_procdef_nopara_boolret:=nil;
  723. p:=pdlistfirst;
  724. while p<>nil do
  725. begin
  726. if (p^.def.maxparacount=0) and
  727. is_boolean(p^.def.rettype.def) then
  728. begin
  729. search_procdef_nopara_boolret:=p^.def;
  730. break;
  731. end;
  732. p:=p^.next;
  733. end;
  734. end;
  735. function Tprocsym.search_procdef_bytype(pt:Tproctypeoption):Tprocdef;
  736. var
  737. p : pprocdeflist;
  738. begin
  739. search_procdef_bytype:=nil;
  740. p:=pdlistfirst;
  741. while p<>nil do
  742. begin
  743. if p^.def.proctypeoption=pt then
  744. begin
  745. search_procdef_bytype:=p^.def;
  746. break;
  747. end;
  748. p:=p^.next;
  749. end;
  750. end;
  751. function Tprocsym.search_procdef_bypara(params:Tlinkedlist;
  752. retdef:tdef;
  753. cpoptions:tcompare_paras_options):Tprocdef;
  754. var
  755. pd : pprocdeflist;
  756. eq : tequaltype;
  757. begin
  758. search_procdef_bypara:=nil;
  759. pd:=pdlistfirst;
  760. while assigned(pd) do
  761. begin
  762. if assigned(retdef) then
  763. eq:=compare_defs(retdef,pd^.def.rettype.def,nothingn)
  764. else
  765. eq:=te_equal;
  766. if (eq>=te_equal) or
  767. ((cpo_allowconvert in cpoptions) and (eq>te_incompatible)) then
  768. begin
  769. eq:=compare_paras(pd^.def.para,params,cp_value_equal_const,cpoptions);
  770. if (eq>=te_equal) or
  771. ((cpo_allowconvert in cpoptions) and (eq>te_incompatible)) then
  772. begin
  773. search_procdef_bypara:=pd^.def;
  774. break;
  775. end;
  776. end;
  777. pd:=pd^.next;
  778. end;
  779. end;
  780. function Tprocsym.search_procdef_byprocvardef(d:Tprocvardef):Tprocdef;
  781. var
  782. pd : pprocdeflist;
  783. eq,besteq : tequaltype;
  784. bestpd : tprocdef;
  785. begin
  786. { This function will return the pprocdef of pprocsym that
  787. is the best match for procvardef. When there are multiple
  788. matches it returns nil.}
  789. search_procdef_byprocvardef:=nil;
  790. bestpd:=nil;
  791. besteq:=te_incompatible;
  792. pd:=pdlistfirst;
  793. while assigned(pd) do
  794. begin
  795. eq:=proc_to_procvar_equal(pd^.def,d,false);
  796. if eq>=te_equal then
  797. begin
  798. { multiple procvars with the same equal level }
  799. if assigned(bestpd) and
  800. (besteq=eq) then
  801. exit;
  802. if eq>besteq then
  803. begin
  804. besteq:=eq;
  805. bestpd:=pd^.def;
  806. end;
  807. end;
  808. pd:=pd^.next;
  809. end;
  810. search_procdef_byprocvardef:=bestpd;
  811. end;
  812. function Tprocsym.search_procdef_assignment_operator(fromdef,todef:tdef):Tprocdef;
  813. var
  814. convtyp : tconverttype;
  815. pd : pprocdeflist;
  816. bestpd : tprocdef;
  817. eq,
  818. besteq : tequaltype;
  819. hpd : tprocdef;
  820. currpara : tparaitem;
  821. begin
  822. result:=nil;
  823. bestpd:=nil;
  824. besteq:=te_incompatible;
  825. pd:=pdlistfirst;
  826. while assigned(pd) do
  827. begin
  828. if equal_defs(todef,pd^.def.rettype.def) then
  829. begin
  830. currpara:=Tparaitem(pd^.def.para.first);
  831. { ignore vs_hidden parameters }
  832. while assigned(currpara) and (currpara.is_hidden) do
  833. currpara:=tparaitem(currpara.next);
  834. if assigned(currpara) then
  835. begin
  836. eq:=compare_defs_ext(fromdef,currpara.paratype.def,nothingn,convtyp,hpd,[]);
  837. if eq=te_exact then
  838. begin
  839. result:=pd^.def;
  840. exit;
  841. end;
  842. if eq>besteq then
  843. begin
  844. bestpd:=pd^.def;
  845. besteq:=eq;
  846. end;
  847. end;
  848. end;
  849. pd:=pd^.next;
  850. end;
  851. result:=bestpd;
  852. end;
  853. function tprocsym.write_references(ppufile:tcompilerppufile;locals:boolean) : boolean;
  854. var
  855. p : pprocdeflist;
  856. begin
  857. write_references:=false;
  858. if not inherited write_references(ppufile,locals) then
  859. exit;
  860. write_references:=true;
  861. p:=pdlistfirst;
  862. while assigned(p) do
  863. begin
  864. if p^.own then
  865. p^.def.write_references(ppufile,locals);
  866. p:=p^.next;
  867. end;
  868. end;
  869. procedure tprocsym.unchain_overload;
  870. var
  871. p,hp : pprocdeflist;
  872. begin
  873. { remove all overloaded procdefs from the
  874. procdeflist that are not in the current symtable }
  875. overloadchecked:=false;
  876. p:=pdlistfirst;
  877. { reset new lists }
  878. pdlistfirst:=nil;
  879. pdlistlast:=nil;
  880. while assigned(p) do
  881. begin
  882. hp:=p^.next;
  883. if p^.own then
  884. begin
  885. { keep, add to list }
  886. if assigned(pdlistlast) then
  887. begin
  888. pdlistlast^.next:=p;
  889. pdlistlast:=p;
  890. end
  891. else
  892. begin
  893. pdlistfirst:=p;
  894. pdlistlast:=p;
  895. end;
  896. p^.next:=nil;
  897. end
  898. else
  899. begin
  900. { remove }
  901. dispose(p);
  902. dec(procdef_count);
  903. end;
  904. p:=hp;
  905. end;
  906. end;
  907. {$ifdef GDB}
  908. function tprocsym.stabstring : pchar;
  909. begin
  910. internalerror(200111171);
  911. end;
  912. {$endif GDB}
  913. {****************************************************************************
  914. TERRORSYM
  915. ****************************************************************************}
  916. constructor terrorsym.create;
  917. begin
  918. inherited create('');
  919. typ:=errorsym;
  920. end;
  921. {****************************************************************************
  922. TPROPERTYSYM
  923. ****************************************************************************}
  924. constructor tpropertysym.create(const n : string);
  925. begin
  926. inherited create(n);
  927. typ:=propertysym;
  928. propoptions:=[];
  929. index:=0;
  930. default:=0;
  931. proptype.reset;
  932. indextype.reset;
  933. readaccess:=tsymlist.create;
  934. writeaccess:=tsymlist.create;
  935. storedaccess:=tsymlist.create;
  936. end;
  937. constructor tpropertysym.ppuload(ppufile:tcompilerppufile);
  938. begin
  939. inherited loadsym(ppufile);
  940. typ:=propertysym;
  941. ppufile.getsmallset(propoptions);
  942. if (ppo_is_override in propoptions) then
  943. begin
  944. ppufile.getderef(propoverridenderef);
  945. { we need to have these objects initialized }
  946. readaccess:=tsymlist.create;
  947. writeaccess:=tsymlist.create;
  948. storedaccess:=tsymlist.create;
  949. end
  950. else
  951. begin
  952. ppufile.gettype(proptype);
  953. index:=ppufile.getlongint;
  954. default:=ppufile.getlongint;
  955. ppufile.gettype(indextype);
  956. readaccess:=ppufile.getsymlist;
  957. writeaccess:=ppufile.getsymlist;
  958. storedaccess:=ppufile.getsymlist;
  959. end;
  960. end;
  961. destructor tpropertysym.destroy;
  962. begin
  963. readaccess.free;
  964. writeaccess.free;
  965. storedaccess.free;
  966. inherited destroy;
  967. end;
  968. function tpropertysym.gettypedef:tdef;
  969. begin
  970. gettypedef:=proptype.def;
  971. end;
  972. procedure tpropertysym.buildderef;
  973. begin
  974. if (ppo_is_override in propoptions) then
  975. begin
  976. propoverridenderef.build(propoverriden);
  977. end
  978. else
  979. begin
  980. proptype.buildderef;
  981. indextype.buildderef;
  982. readaccess.buildderef;
  983. writeaccess.buildderef;
  984. storedaccess.buildderef;
  985. end;
  986. end;
  987. procedure tpropertysym.deref;
  988. begin
  989. if (ppo_is_override in propoptions) then
  990. begin
  991. propoverriden:=tpropertysym(propoverridenderef.resolve);
  992. dooverride(propoverriden);
  993. end
  994. else
  995. begin
  996. proptype.resolve;
  997. indextype.resolve;
  998. readaccess.resolve;
  999. writeaccess.resolve;
  1000. storedaccess.resolve;
  1001. end;
  1002. end;
  1003. function tpropertysym.getsize : longint;
  1004. begin
  1005. getsize:=0;
  1006. end;
  1007. procedure tpropertysym.ppuwrite(ppufile:tcompilerppufile);
  1008. begin
  1009. inherited writesym(ppufile);
  1010. ppufile.putsmallset(propoptions);
  1011. if (ppo_is_override in propoptions) then
  1012. ppufile.putderef(propoverridenderef)
  1013. else
  1014. begin
  1015. ppufile.puttype(proptype);
  1016. ppufile.putlongint(index);
  1017. ppufile.putlongint(default);
  1018. ppufile.puttype(indextype);
  1019. ppufile.putsymlist(readaccess);
  1020. ppufile.putsymlist(writeaccess);
  1021. ppufile.putsymlist(storedaccess);
  1022. end;
  1023. ppufile.writeentry(ibpropertysym);
  1024. end;
  1025. procedure tpropertysym.dooverride(overriden:tpropertysym);
  1026. begin
  1027. propoverriden:=overriden;
  1028. proptype:=overriden.proptype;
  1029. propoptions:=overriden.propoptions+[ppo_is_override];
  1030. index:=overriden.index;
  1031. default:=overriden.default;
  1032. indextype:=overriden.indextype;
  1033. readaccess.free;
  1034. readaccess:=overriden.readaccess.getcopy;
  1035. writeaccess.free;
  1036. writeaccess:=overriden.writeaccess.getcopy;
  1037. storedaccess.free;
  1038. storedaccess:=overriden.storedaccess.getcopy;
  1039. end;
  1040. {****************************************************************************
  1041. TABSOLUTESYM
  1042. ****************************************************************************}
  1043. constructor tabsolutesym.create(const n : string;const tt : ttype);
  1044. begin
  1045. inherited create(n,vs_value,tt);
  1046. typ:=absolutesym;
  1047. ref:=nil;
  1048. end;
  1049. constructor tabsolutesym.create_ref(const n : string;const tt : ttype;_ref:tsymlist);
  1050. begin
  1051. inherited create(n,vs_value,tt);
  1052. typ:=absolutesym;
  1053. ref:=_ref;
  1054. end;
  1055. destructor tabsolutesym.destroy;
  1056. begin
  1057. if assigned(ref) then
  1058. ref.free;
  1059. inherited destroy;
  1060. end;
  1061. constructor tabsolutesym.ppuload(ppufile:tcompilerppufile);
  1062. begin
  1063. { Note: This needs to load everything of tvarsym.write }
  1064. inherited ppuload(ppufile);
  1065. { load absolute }
  1066. typ:=absolutesym;
  1067. ref:=nil;
  1068. fieldoffset:=0;
  1069. asmname:=nil;
  1070. abstyp:=absolutetyp(ppufile.getbyte);
  1071. {$ifdef i386}
  1072. absseg:=false;
  1073. {$endif i386}
  1074. case abstyp of
  1075. tovar :
  1076. ref:=ppufile.getsymlist;
  1077. toasm :
  1078. asmname:=stringdup(ppufile.getstring);
  1079. toaddr :
  1080. begin
  1081. fieldoffset:=ppufile.getlongint;
  1082. {$ifdef i386}
  1083. absseg:=boolean(ppufile.getbyte);
  1084. {$endif i386}
  1085. end;
  1086. end;
  1087. end;
  1088. procedure tabsolutesym.ppuwrite(ppufile:tcompilerppufile);
  1089. var
  1090. hvo : tvaroptions;
  1091. begin
  1092. { Note: This needs to write everything of tvarsym.write }
  1093. inherited writesym(ppufile);
  1094. ppufile.putbyte(byte(varspez));
  1095. ppufile.putlongint(fieldoffset);
  1096. { write only definition or definitionsym }
  1097. ppufile.puttype(vartype);
  1098. hvo:=varoptions-[vo_regable,vo_fpuregable];
  1099. ppufile.putsmallset(hvo);
  1100. ppufile.putbyte(byte(abstyp));
  1101. case abstyp of
  1102. tovar :
  1103. ppufile.putsymlist(ref);
  1104. toasm :
  1105. ppufile.putstring(asmname^);
  1106. toaddr :
  1107. begin
  1108. ppufile.putlongint(fieldoffset);
  1109. {$ifdef i386}
  1110. ppufile.putbyte(byte(absseg));
  1111. {$endif i386}
  1112. end;
  1113. end;
  1114. ppufile.writeentry(ibabsolutesym);
  1115. end;
  1116. procedure tabsolutesym.buildderef;
  1117. begin
  1118. { inheritance of varsym.deref ! }
  1119. vartype.buildderef;
  1120. if (abstyp=tovar) then
  1121. ref.buildderef;
  1122. end;
  1123. procedure tabsolutesym.deref;
  1124. begin
  1125. { inheritance of varsym.deref ! }
  1126. vartype.resolve;
  1127. { own absolute deref }
  1128. if (abstyp=tovar) then
  1129. ref.resolve;
  1130. end;
  1131. function tabsolutesym.mangledname : string;
  1132. begin
  1133. case abstyp of
  1134. toasm :
  1135. mangledname:=asmname^;
  1136. toaddr :
  1137. mangledname:='$'+tostr(fieldoffset);
  1138. else
  1139. internalerror(10002);
  1140. end;
  1141. end;
  1142. {$ifdef GDB}
  1143. function Tabsolutesym.stabstring:Pchar;
  1144. begin
  1145. stabstring:=nil;
  1146. end;
  1147. {$endif GDB}
  1148. {****************************************************************************
  1149. TVARSYM
  1150. ****************************************************************************}
  1151. constructor tvarsym.create(const n : string;vsp:tvarspez;const tt : ttype);
  1152. begin
  1153. inherited create(n);
  1154. typ:=varsym;
  1155. vartype:=tt;
  1156. _mangledname:=nil;
  1157. varspez:=vsp;
  1158. fieldoffset:=0;
  1159. fillchar(localloc,sizeof(localloc),0);
  1160. defaultconstsym:=nil;
  1161. refs:=0;
  1162. varstate:=vs_declared;
  1163. varoptions:=[];
  1164. end;
  1165. constructor tvarsym.create_dll(const n : string;vsp:tvarspez;const tt : ttype);
  1166. begin
  1167. tvarsym(self).create(n,vsp,tt);
  1168. include(varoptions,vo_is_dll_var);
  1169. end;
  1170. constructor tvarsym.create_C(const n,mangled : string;vsp:tvarspez;const tt : ttype);
  1171. begin
  1172. tvarsym(self).create(n,vsp,tt);
  1173. stringdispose(_mangledname);
  1174. {$ifdef compress}
  1175. _mangledname:=stringdup(minilzw_encode(mangled));
  1176. {$else}
  1177. _mangledname:=stringdup(mangled);
  1178. {$endif}
  1179. end;
  1180. constructor tvarsym.ppuload(ppufile:tcompilerppufile);
  1181. begin
  1182. inherited loadsym(ppufile);
  1183. typ:=varsym;
  1184. fillchar(localloc,sizeof(localloc),0);
  1185. refs := 0;
  1186. varstate:=vs_used;
  1187. varspez:=tvarspez(ppufile.getbyte);
  1188. fieldoffset:=ppufile.getlongint;
  1189. defaultconstsym:=nil;
  1190. ppufile.gettype(_vartype);
  1191. ppufile.getsmallset(varoptions);
  1192. if (vo_is_C_var in varoptions) then
  1193. _mangledname:=stringdup(ppufile.getstring);
  1194. end;
  1195. destructor tvarsym.destroy;
  1196. begin
  1197. if assigned(notifications) then
  1198. notifications.destroy;
  1199. inherited destroy;
  1200. end;
  1201. procedure tvarsym.buildderef;
  1202. begin
  1203. vartype.buildderef;
  1204. end;
  1205. procedure tvarsym.deref;
  1206. begin
  1207. vartype.resolve;
  1208. end;
  1209. procedure tvarsym.ppuwrite(ppufile:tcompilerppufile);
  1210. var
  1211. hvo : tvaroptions;
  1212. begin
  1213. inherited writesym(ppufile);
  1214. ppufile.putbyte(byte(varspez));
  1215. ppufile.putlongint(fieldoffset);
  1216. ppufile.puttype(vartype);
  1217. { symbols which are load are never candidates for a register,
  1218. turn off the regable }
  1219. hvo:=varoptions-[vo_regable,vo_fpuregable];
  1220. ppufile.putsmallset(hvo);
  1221. if (vo_is_C_var in varoptions) then
  1222. ppufile.putstring(_mangledname^);
  1223. ppufile.writeentry(ibvarsym);
  1224. end;
  1225. procedure tvarsym.generate_mangledname;
  1226. begin
  1227. {$ifdef compress}
  1228. _mangledname:=stringdup(minilzw_encode(make_mangledname('U',owner,name)));
  1229. {$else}
  1230. _mangledname:=stringdup(make_mangledname('U',owner,name));
  1231. {$endif}
  1232. end;
  1233. procedure tvarsym.set_mangledname(const s:string);
  1234. begin
  1235. stringdispose(_mangledname);
  1236. {$ifdef compress}
  1237. _mangledname:=stringdup(minilzw_encode(s));
  1238. {$else}
  1239. _mangledname:=stringdup(s);
  1240. {$endif}
  1241. end;
  1242. function tvarsym.getsize : longint;
  1243. begin
  1244. if assigned(vartype.def) then
  1245. getsize:=vartype.def.size
  1246. else
  1247. getsize:=0;
  1248. end;
  1249. function tvarsym.getvaluesize : longint;
  1250. begin
  1251. if assigned(vartype.def) and
  1252. (varspez=vs_value) and
  1253. ((vartype.def.deftype<>arraydef) or
  1254. tarraydef(vartype.def).isDynamicArray or
  1255. (tarraydef(vartype.def).highrange>=tarraydef(vartype.def).lowrange)) then
  1256. getvaluesize:=vartype.def.size
  1257. else
  1258. getvaluesize:=0;
  1259. end;
  1260. procedure Tvarsym.trigger_notifications(what:Tnotification_flag);
  1261. var n:Tnotification;
  1262. begin
  1263. if assigned(notifications) then
  1264. begin
  1265. n:=Tnotification(notifications.first);
  1266. while assigned(n) do
  1267. begin
  1268. if what in n.flags then
  1269. n.callback(what,self);
  1270. n:=Tnotification(n.next);
  1271. end;
  1272. end;
  1273. end;
  1274. function Tvarsym.register_notification(flags:Tnotification_flags;callback:
  1275. Tnotification_callback):cardinal;
  1276. var n:Tnotification;
  1277. begin
  1278. if not assigned(notifications) then
  1279. notifications:=Tlinkedlist.create;
  1280. n:=Tnotification.create(flags,callback);
  1281. register_notification:=n.id;
  1282. notifications.concat(n);
  1283. end;
  1284. procedure Tvarsym.unregister_notification(id:cardinal);
  1285. var n:Tnotification;
  1286. begin
  1287. if not assigned(notifications) then
  1288. internalerror(200212311)
  1289. else
  1290. begin
  1291. n:=Tnotification(notifications.first);
  1292. while assigned(n) do
  1293. begin
  1294. if n.id=id then
  1295. begin
  1296. notifications.remove(n);
  1297. n.destroy;
  1298. exit;
  1299. end;
  1300. n:=Tnotification(n.next);
  1301. end;
  1302. internalerror(200212311)
  1303. end;
  1304. end;
  1305. {$ifdef GDB}
  1306. function Tvarsym.stabstring:Pchar;
  1307. var st:string;
  1308. threadvaroffset:string;
  1309. regidx:Tregisterindex;
  1310. c:char;
  1311. loc: tcgloc;
  1312. begin
  1313. { set loc to LOC_REFERENCE to get somewhat usable debugging info for -Or }
  1314. { while stabs aren't adapted for regvars yet }
  1315. loc := localloc.loc;
  1316. if (vo_is_self in varoptions) then
  1317. begin
  1318. case loc of
  1319. LOC_REGISTER:
  1320. regidx:=findreg_by_number(localloc.register);
  1321. LOC_REFERENCE: ;
  1322. else
  1323. internalerror(2003091815);
  1324. end;
  1325. if (po_classmethod in current_procinfo.procdef.procoptions) or
  1326. (po_staticmethod in current_procinfo.procdef.procoptions) then
  1327. if (loc=LOC_REFERENCE) then
  1328. stabstring:=stabstr_evaluate('"pvmt:p$1",${N_TSYM},0,0,$2',
  1329. [Tstoreddef(pvmttype.def).numberstring,tostr(localloc.reference.offset)])
  1330. else
  1331. stabstring:=stabstr_evaluate('"pvmt:r$1",${N_RSYM},0,0,$2',
  1332. [Tstoreddef(pvmttype.def).numberstring,tostr(regstabs_table[regidx])])
  1333. else
  1334. begin
  1335. if not(is_class(current_procinfo.procdef._class)) then
  1336. c:='v'
  1337. else
  1338. c:='p';
  1339. if (loc=LOC_REFERENCE) then
  1340. stabstring:=stabstr_evaluate('"$$t:$1",${N_TSYM},0,0,$2',
  1341. [c+current_procinfo.procdef._class.numberstring,tostr(localloc.reference.offset)])
  1342. else
  1343. stabstring:=stabstr_evaluate('"$$t:r$1",${N_RSYM},0,0,$2',
  1344. [c+current_procinfo.procdef._class.numberstring,tostr(regstabs_table[regidx])]);
  1345. end;
  1346. end
  1347. else
  1348. begin
  1349. stabstring:=nil;
  1350. st:=tstoreddef(vartype.def).numberstring;
  1351. if (vo_is_thread_var in varoptions) then
  1352. threadvaroffset:='+'+tostr(pointer_size)
  1353. else
  1354. threadvaroffset:='';
  1355. case owner.symtabletype of
  1356. objectsymtable:
  1357. if (sp_static in symoptions) then
  1358. begin
  1359. if (cs_gdb_gsym in aktglobalswitches) then
  1360. st:='G'+st
  1361. else
  1362. st:='S'+st;
  1363. stabstring:=stabstr_evaluate('"${ownername}__${name}:$1",${N_LCSYM},0,${line},${mangledname}$2',
  1364. [st,threadvaroffset]);
  1365. end;
  1366. globalsymtable:
  1367. begin
  1368. { Here we used S instead of
  1369. because with G GDB doesn't look at the address field
  1370. but searches the same name or with a leading underscore
  1371. but these names don't exist in pascal !}
  1372. if (cs_gdb_gsym in aktglobalswitches) then
  1373. st:='G'+st
  1374. else
  1375. st:='S'+st;
  1376. stabstring:=stabstr_evaluate('"${name}:$1",${N_LCSYM},0,${line},${mangledname}$2',[st,threadvaroffset]);
  1377. end;
  1378. staticsymtable :
  1379. stabstring:=stabstr_evaluate('"${name}:S$1",${N_LCSYM},0,${line},${mangledname}$2',[st,threadvaroffset]);
  1380. parasymtable,localsymtable:
  1381. begin
  1382. { There is no space allocated for not referenced locals }
  1383. if (owner.symtabletype=localsymtable) and (refs=0) then
  1384. exit;
  1385. if (vo_is_C_var in varoptions) then
  1386. begin
  1387. stabstring:=stabstr_evaluate('"${name}:S$1",${N_LCSYM},0,${line},${mangledname}',[st]);
  1388. exit;
  1389. end;
  1390. if (owner.symtabletype=parasymtable) then
  1391. begin
  1392. if paramanager.push_addr_param(varspez,vartype.def,tprocdef(owner.defowner).proccalloption) and
  1393. not(vo_has_local_copy in varoptions) then
  1394. st := 'v'+st { should be 'i' but 'i' doesn't work }
  1395. else
  1396. st := 'p'+st;
  1397. end;
  1398. case loc of
  1399. LOC_REGISTER, LOC_FPUREGISTER :
  1400. begin
  1401. regidx:=findreg_by_number(localloc.register);
  1402. { "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eip", "ps", "cs", "ss", "ds", "es", "fs", "gs", }
  1403. { this is the register order for GDB}
  1404. stabstring:=stabstr_evaluate('"${name}:r$1",${N_RSYM},0,${line},$2',[st,tostr(regstabs_table[regidx])]);
  1405. end;
  1406. LOC_REFERENCE :
  1407. { offset to ebp => will not work if the framepointer is esp
  1408. so some optimizing will make things harder to debug }
  1409. stabstring:=stabstr_evaluate('"${name}:$1",${N_TSYM},0,${line},$2',[st,tostr(localloc.reference.offset)])
  1410. else
  1411. internalerror(2003091814);
  1412. end;
  1413. end;
  1414. else
  1415. stabstring := inherited stabstring;
  1416. end;
  1417. end;
  1418. end;
  1419. {$endif GDB}
  1420. procedure tvarsym.setvartype(const newtype: ttype);
  1421. begin
  1422. _vartype := newtype;
  1423. { can we load the value into a register ? }
  1424. if not assigned(owner) or
  1425. (owner.symtabletype in [localsymtable,parasymtable]) then
  1426. begin
  1427. if tstoreddef(vartype.def).is_intregable then
  1428. include(varoptions,vo_regable)
  1429. else
  1430. exclude(varoptions,vo_regable);
  1431. if tstoreddef(vartype.def).is_fpuregable then
  1432. include(varoptions,vo_fpuregable)
  1433. else
  1434. exclude(varoptions,vo_fpuregable);
  1435. end;
  1436. end;
  1437. {****************************************************************************
  1438. TTYPEDCONSTSYM
  1439. *****************************************************************************}
  1440. constructor ttypedconstsym.create(const n : string;p : tdef;writable : boolean);
  1441. begin
  1442. inherited create(n);
  1443. typ:=typedconstsym;
  1444. typedconsttype.setdef(p);
  1445. is_writable:=writable;
  1446. end;
  1447. constructor ttypedconstsym.createtype(const n : string;const tt : ttype;writable : boolean);
  1448. begin
  1449. inherited create(n);
  1450. typ:=typedconstsym;
  1451. typedconsttype:=tt;
  1452. is_writable:=writable;
  1453. end;
  1454. constructor ttypedconstsym.ppuload(ppufile:tcompilerppufile);
  1455. begin
  1456. inherited loadsym(ppufile);
  1457. typ:=typedconstsym;
  1458. ppufile.gettype(typedconsttype);
  1459. is_writable:=boolean(ppufile.getbyte);
  1460. end;
  1461. destructor ttypedconstsym.destroy;
  1462. begin
  1463. inherited destroy;
  1464. end;
  1465. procedure ttypedconstsym.generate_mangledname;
  1466. begin
  1467. {$ifdef compress}
  1468. _mangledname:=stringdup(make_mangledname('TC',owner,name));
  1469. {$else}
  1470. _mangledname:=stringdup(make_mangledname('TC',owner,name));
  1471. {$endif}
  1472. end;
  1473. function ttypedconstsym.getsize : longint;
  1474. begin
  1475. if assigned(typedconsttype.def) then
  1476. getsize:=typedconsttype.def.size
  1477. else
  1478. getsize:=0;
  1479. end;
  1480. procedure ttypedconstsym.buildderef;
  1481. begin
  1482. typedconsttype.buildderef;
  1483. end;
  1484. procedure ttypedconstsym.deref;
  1485. begin
  1486. typedconsttype.resolve;
  1487. end;
  1488. procedure ttypedconstsym.ppuwrite(ppufile:tcompilerppufile);
  1489. begin
  1490. inherited writesym(ppufile);
  1491. ppufile.puttype(typedconsttype);
  1492. ppufile.putbyte(byte(is_writable));
  1493. ppufile.writeentry(ibtypedconstsym);
  1494. end;
  1495. {$ifdef GDB}
  1496. function ttypedconstsym.stabstring : pchar;
  1497. var st:char;
  1498. begin
  1499. if (cs_gdb_gsym in aktglobalswitches) and (owner.symtabletype=globalsymtable) then
  1500. st:='G'
  1501. else
  1502. st:='S';
  1503. stabstring:=stabstr_evaluate('"${name}:$1$2",${N_STSYM},0,${line},${mangledname}',
  1504. [st,Tstoreddef(typedconsttype.def).numberstring]);
  1505. end;
  1506. {$endif GDB}
  1507. {****************************************************************************
  1508. TCONSTSYM
  1509. ****************************************************************************}
  1510. constructor tconstsym.create_ord(const n : string;t : tconsttyp;v : TConstExprInt);
  1511. begin
  1512. inherited create(n);
  1513. fillchar(value, sizeof(value), #0);
  1514. typ:=constsym;
  1515. consttyp:=t;
  1516. value.valueord:=v;
  1517. ResStrIndex:=0;
  1518. consttype.reset;
  1519. end;
  1520. constructor tconstsym.create_ord_typed(const n : string;t : tconsttyp;v : tconstexprint;const tt:ttype);
  1521. begin
  1522. inherited create(n);
  1523. fillchar(value, sizeof(value), #0);
  1524. typ:=constsym;
  1525. consttyp:=t;
  1526. value.valueord:=v;
  1527. ResStrIndex:=0;
  1528. consttype:=tt;
  1529. end;
  1530. constructor tconstsym.create_ordptr_typed(const n : string;t : tconsttyp;v : tconstptruint;const tt:ttype);
  1531. begin
  1532. inherited create(n);
  1533. fillchar(value, sizeof(value), #0);
  1534. typ:=constsym;
  1535. consttyp:=t;
  1536. value.valueordptr:=v;
  1537. ResStrIndex:=0;
  1538. consttype:=tt;
  1539. end;
  1540. constructor tconstsym.create_ptr(const n : string;t : tconsttyp;v : pointer);
  1541. begin
  1542. inherited create(n);
  1543. fillchar(value, sizeof(value), #0);
  1544. typ:=constsym;
  1545. consttyp:=t;
  1546. value.valueptr:=v;
  1547. ResStrIndex:=0;
  1548. consttype.reset;
  1549. end;
  1550. constructor tconstsym.create_ptr_typed(const n : string;t : tconsttyp;v : pointer;const tt:ttype);
  1551. begin
  1552. inherited create(n);
  1553. fillchar(value, sizeof(value), #0);
  1554. typ:=constsym;
  1555. consttyp:=t;
  1556. value.valueptr:=v;
  1557. ResStrIndex:=0;
  1558. consttype:=tt;
  1559. end;
  1560. constructor tconstsym.create_string(const n : string;t : tconsttyp;str:pchar;l:longint);
  1561. begin
  1562. inherited create(n);
  1563. fillchar(value, sizeof(value), #0);
  1564. typ:=constsym;
  1565. consttyp:=t;
  1566. value.valueptr:=str;
  1567. consttype.reset;
  1568. value.len:=l;
  1569. if t=constresourcestring then
  1570. ResStrIndex:=ResourceStrings.Register(name,pchar(value.valueptr),value.len);
  1571. end;
  1572. constructor tconstsym.ppuload(ppufile:tcompilerppufile);
  1573. var
  1574. pd : pbestreal;
  1575. ps : pnormalset;
  1576. pc : pchar;
  1577. begin
  1578. inherited loadsym(ppufile);
  1579. typ:=constsym;
  1580. consttype.reset;
  1581. consttyp:=tconsttyp(ppufile.getbyte);
  1582. fillchar(value, sizeof(value), #0);
  1583. case consttyp of
  1584. constint:
  1585. value.valueord:=ppufile.getexprint;
  1586. constwchar,
  1587. constbool,
  1588. constchar :
  1589. value.valueord:=ppufile.getlongint;
  1590. constord :
  1591. begin
  1592. ppufile.gettype(consttype);
  1593. value.valueord:=ppufile.getexprint;
  1594. end;
  1595. constpointer :
  1596. begin
  1597. ppufile.gettype(consttype);
  1598. value.valueordptr:=ppufile.getptruint;
  1599. end;
  1600. conststring,
  1601. constresourcestring :
  1602. begin
  1603. value.len:=ppufile.getlongint;
  1604. getmem(pc,value.len+1);
  1605. ppufile.getdata(pc^,value.len);
  1606. if consttyp=constresourcestring then
  1607. ResStrIndex:=ppufile.getlongint;
  1608. value.valueptr:=pc;
  1609. end;
  1610. constreal :
  1611. begin
  1612. new(pd);
  1613. pd^:=ppufile.getreal;
  1614. value.valueptr:=pd;
  1615. end;
  1616. constset :
  1617. begin
  1618. ppufile.gettype(consttype);
  1619. new(ps);
  1620. ppufile.getnormalset(ps^);
  1621. value.valueptr:=ps;
  1622. end;
  1623. constguid :
  1624. begin
  1625. new(pguid(value.valueptr));
  1626. ppufile.getdata(value.valueptr^,sizeof(tguid));
  1627. end;
  1628. constnil : ;
  1629. else
  1630. Message1(unit_f_ppu_invalid_entry,tostr(ord(consttyp)));
  1631. end;
  1632. end;
  1633. destructor tconstsym.destroy;
  1634. begin
  1635. case consttyp of
  1636. conststring,
  1637. constresourcestring :
  1638. freemem(pchar(value.valueptr),value.len+1);
  1639. constreal :
  1640. dispose(pbestreal(value.valueptr));
  1641. constset :
  1642. dispose(pnormalset(value.valueptr));
  1643. constguid :
  1644. dispose(pguid(value.valueptr));
  1645. end;
  1646. inherited destroy;
  1647. end;
  1648. procedure tconstsym.buildderef;
  1649. begin
  1650. if consttyp in [constord,constpointer,constset] then
  1651. consttype.buildderef;
  1652. end;
  1653. procedure tconstsym.deref;
  1654. begin
  1655. if consttyp in [constord,constpointer,constset] then
  1656. consttype.resolve;
  1657. end;
  1658. procedure tconstsym.ppuwrite(ppufile:tcompilerppufile);
  1659. begin
  1660. inherited writesym(ppufile);
  1661. ppufile.putbyte(byte(consttyp));
  1662. case consttyp of
  1663. constnil : ;
  1664. constint:
  1665. ppufile.putexprint(value.valueord);
  1666. constbool,
  1667. constchar,
  1668. constwchar :
  1669. ppufile.putlongint(value.valueord);
  1670. constord :
  1671. begin
  1672. ppufile.puttype(consttype);
  1673. ppufile.putexprint(value.valueord);
  1674. end;
  1675. constpointer :
  1676. begin
  1677. ppufile.puttype(consttype);
  1678. ppufile.putptruint(value.valueordptr);
  1679. end;
  1680. conststring,
  1681. constresourcestring :
  1682. begin
  1683. ppufile.putlongint(value.len);
  1684. ppufile.putdata(pchar(value.valueptr)^,value.len);
  1685. if consttyp=constresourcestring then
  1686. ppufile.putlongint(ResStrIndex);
  1687. end;
  1688. constreal :
  1689. ppufile.putreal(pbestreal(value.valueptr)^);
  1690. constset :
  1691. begin
  1692. ppufile.puttype(consttype);
  1693. ppufile.putnormalset(value.valueptr^);
  1694. end;
  1695. constguid :
  1696. ppufile.putdata(value.valueptr^,sizeof(tguid));
  1697. else
  1698. internalerror(13);
  1699. end;
  1700. ppufile.writeentry(ibconstsym);
  1701. end;
  1702. {$ifdef GDB}
  1703. function Tconstsym.stabstring:Pchar;
  1704. var st : string;
  1705. begin
  1706. {even GDB v4.16 only now 'i' 'r' and 'e' !!!}
  1707. case consttyp of
  1708. conststring:
  1709. st:='s'''+backspace_quote(strpas(pchar(value.valueptr)),['''','"','\',#10,#13])+'''';
  1710. constbool,
  1711. constint,
  1712. constord,
  1713. constwchar,
  1714. constchar:
  1715. st:='i'+int64tostr(value.valueord);
  1716. constpointer:
  1717. st:='i'+int64tostr(value.valueordptr);
  1718. constreal:
  1719. begin
  1720. system.str(pbestreal(value.valueptr)^,st);
  1721. st := 'r'+st;
  1722. end;
  1723. { if we don't know just put zero !! }
  1724. else st:='i0';
  1725. {***SETCONST}
  1726. {constset:;} {*** I don't know what to do with a set.}
  1727. { sets are not recognized by GDB}
  1728. {***}
  1729. end;
  1730. stabstring:=stabstr_evaluate('"${name}:c=$1;",${N_FUNCTION},0,${line},0',[st]);
  1731. end;
  1732. {$endif GDB}
  1733. {****************************************************************************
  1734. TENUMSYM
  1735. ****************************************************************************}
  1736. constructor tenumsym.create(const n : string;def : tenumdef;v : longint);
  1737. begin
  1738. inherited create(n);
  1739. typ:=enumsym;
  1740. definition:=def;
  1741. value:=v;
  1742. { check for jumps }
  1743. if v>def.max+1 then
  1744. def.has_jumps:=true;
  1745. { update low and high }
  1746. if def.min>v then
  1747. def.setmin(v);
  1748. if def.max<v then
  1749. def.setmax(v);
  1750. order;
  1751. { nextenum:=Tenumsym(def.firstenum);
  1752. def.firstenum:=self;}
  1753. end;
  1754. constructor tenumsym.ppuload(ppufile:tcompilerppufile);
  1755. begin
  1756. inherited loadsym(ppufile);
  1757. typ:=enumsym;
  1758. ppufile.getderef(definitionderef);
  1759. value:=ppufile.getlongint;
  1760. nextenum := Nil;
  1761. end;
  1762. procedure tenumsym.buildderef;
  1763. begin
  1764. definitionderef.build(definition);
  1765. end;
  1766. procedure tenumsym.deref;
  1767. begin
  1768. definition:=tenumdef(definitionderef.resolve);
  1769. order;
  1770. end;
  1771. procedure tenumsym.order;
  1772. var
  1773. sym : tenumsym;
  1774. begin
  1775. sym := tenumsym(definition.firstenum);
  1776. if sym = nil then
  1777. begin
  1778. definition.firstenum := self;
  1779. nextenum := nil;
  1780. exit;
  1781. end;
  1782. { reorder the symbols in increasing value }
  1783. if value < sym.value then
  1784. begin
  1785. nextenum := sym;
  1786. definition.firstenum := self;
  1787. end
  1788. else
  1789. begin
  1790. while (sym.value <= value) and assigned(sym.nextenum) do
  1791. sym := sym.nextenum;
  1792. nextenum := sym.nextenum;
  1793. sym.nextenum := self;
  1794. end;
  1795. end;
  1796. procedure tenumsym.ppuwrite(ppufile:tcompilerppufile);
  1797. begin
  1798. inherited writesym(ppufile);
  1799. ppufile.putderef(definitionderef);
  1800. ppufile.putlongint(value);
  1801. ppufile.writeentry(ibenumsym);
  1802. end;
  1803. {****************************************************************************
  1804. TTYPESYM
  1805. ****************************************************************************}
  1806. constructor ttypesym.create(const n : string;const tt : ttype);
  1807. begin
  1808. inherited create(n);
  1809. typ:=typesym;
  1810. restype:=tt;
  1811. {$ifdef GDB}
  1812. isusedinstab := false;
  1813. {$endif GDB}
  1814. { register the typesym for the definition }
  1815. if assigned(restype.def) and
  1816. (restype.def.deftype<>errordef) and
  1817. not(assigned(restype.def.typesym)) then
  1818. restype.def.typesym:=self;
  1819. end;
  1820. constructor ttypesym.ppuload(ppufile:tcompilerppufile);
  1821. begin
  1822. inherited loadsym(ppufile);
  1823. typ:=typesym;
  1824. {$ifdef GDB}
  1825. isusedinstab := false;
  1826. {$endif GDB}
  1827. ppufile.gettype(restype);
  1828. end;
  1829. function ttypesym.gettypedef:tdef;
  1830. begin
  1831. gettypedef:=restype.def;
  1832. end;
  1833. procedure ttypesym.buildderef;
  1834. begin
  1835. restype.buildderef;
  1836. end;
  1837. procedure ttypesym.deref;
  1838. begin
  1839. restype.resolve;
  1840. end;
  1841. procedure ttypesym.ppuwrite(ppufile:tcompilerppufile);
  1842. begin
  1843. inherited writesym(ppufile);
  1844. ppufile.puttype(restype);
  1845. ppufile.writeentry(ibtypesym);
  1846. end;
  1847. procedure ttypesym.load_references(ppufile:tcompilerppufile;locals:boolean);
  1848. begin
  1849. inherited load_references(ppufile,locals);
  1850. if (restype.def.deftype=recorddef) then
  1851. tstoredsymtable(trecorddef(restype.def).symtable).load_references(ppufile,locals);
  1852. if (restype.def.deftype=objectdef) then
  1853. tstoredsymtable(tobjectdef(restype.def).symtable).load_references(ppufile,locals);
  1854. end;
  1855. function ttypesym.write_references(ppufile:tcompilerppufile;locals:boolean):boolean;
  1856. var
  1857. d : tderef;
  1858. begin
  1859. d.reset;
  1860. if not inherited write_references(ppufile,locals) then
  1861. begin
  1862. { write address of this symbol if record or object
  1863. even if no real refs are there
  1864. because we need it for the symtable }
  1865. if (restype.def.deftype in [recorddef,objectdef]) then
  1866. begin
  1867. d.build(self);
  1868. ppufile.putderef(d);
  1869. ppufile.writeentry(ibsymref);
  1870. end;
  1871. end;
  1872. write_references:=true;
  1873. if (restype.def.deftype=recorddef) then
  1874. tstoredsymtable(trecorddef(restype.def).symtable).write_references(ppufile,locals);
  1875. if (restype.def.deftype=objectdef) then
  1876. tstoredsymtable(tobjectdef(restype.def).symtable).write_references(ppufile,locals);
  1877. end;
  1878. {$ifdef GDB}
  1879. function ttypesym.stabstring : pchar;
  1880. var stabchar:string[2];
  1881. begin
  1882. stabstring:=nil;
  1883. if restype.def<>nil then
  1884. begin
  1885. if restype.def.deftype in tagtypes then
  1886. stabchar:='Tt'
  1887. else
  1888. stabchar:='t';
  1889. stabstring:=stabstr_evaluate('"${name}:$1$2",${N_LSYM},0,${line},0',[stabchar,tstoreddef(restype.def).numberstring]);
  1890. end;
  1891. end;
  1892. {$endif GDB}
  1893. {****************************************************************************
  1894. TSYSSYM
  1895. ****************************************************************************}
  1896. constructor tsyssym.create(const n : string;l : longint);
  1897. begin
  1898. inherited create(n);
  1899. typ:=syssym;
  1900. number:=l;
  1901. end;
  1902. constructor tsyssym.ppuload(ppufile:tcompilerppufile);
  1903. begin
  1904. inherited loadsym(ppufile);
  1905. typ:=syssym;
  1906. number:=ppufile.getlongint;
  1907. end;
  1908. destructor tsyssym.destroy;
  1909. begin
  1910. inherited destroy;
  1911. end;
  1912. procedure tsyssym.ppuwrite(ppufile:tcompilerppufile);
  1913. begin
  1914. inherited writesym(ppufile);
  1915. ppufile.putlongint(number);
  1916. ppufile.writeentry(ibsyssym);
  1917. end;
  1918. {****************************************************************************
  1919. TRTTISYM
  1920. ****************************************************************************}
  1921. constructor trttisym.create(const n:string;rt:trttitype);
  1922. const
  1923. prefix : array[trttitype] of string[5]=('$rtti','$init');
  1924. begin
  1925. inherited create(prefix[rt]+n);
  1926. include(symoptions,sp_internal);
  1927. typ:=rttisym;
  1928. lab:=nil;
  1929. rttityp:=rt;
  1930. end;
  1931. constructor trttisym.ppuload(ppufile:tcompilerppufile);
  1932. begin
  1933. inherited loadsym(ppufile);
  1934. typ:=rttisym;
  1935. lab:=nil;
  1936. rttityp:=trttitype(ppufile.getbyte);
  1937. end;
  1938. procedure trttisym.ppuwrite(ppufile:tcompilerppufile);
  1939. begin
  1940. inherited writesym(ppufile);
  1941. ppufile.putbyte(byte(rttityp));
  1942. ppufile.writeentry(ibrttisym);
  1943. end;
  1944. function trttisym.mangledname : string;
  1945. const
  1946. prefix : array[trttitype] of string[5]=('RTTI_','INIT_');
  1947. begin
  1948. result:=make_mangledname(prefix[rttityp],owner,Copy(name,5,255));
  1949. end;
  1950. function trttisym.get_label:tasmsymbol;
  1951. begin
  1952. { the label is always a global label }
  1953. if not assigned(lab) then
  1954. lab:=objectlibrary.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA);
  1955. get_label:=lab;
  1956. end;
  1957. end.
  1958. {
  1959. $Log$
  1960. Revision 1.163 2004-03-02 17:32:12 florian
  1961. * make cycle fixed
  1962. + pic support for darwin
  1963. + support of importing vars from shared libs on darwin implemented
  1964. Revision 1.162 2004/03/02 00:36:33 olle
  1965. * big transformation of Tai_[const_]Symbol.Create[data]name*
  1966. Revision 1.161 2004/02/24 16:12:39 peter
  1967. * operator overload chooses rewrite
  1968. * overload choosing is now generic and moved to htypechk
  1969. Revision 1.160 2004/02/22 22:13:27 daniel
  1970. * Escape newlines in constant string stabs
  1971. Revision 1.159 2004/02/20 21:54:47 peter
  1972. * use sp_internal flag to silence unused internal variable
  1973. Revision 1.158 2004/02/13 15:42:21 peter
  1974. * compare_defs_ext has now a options argument
  1975. * fixes for variants
  1976. Revision 1.157 2004/02/11 19:59:06 peter
  1977. * fix compilation without GDB
  1978. Revision 1.156 2004/02/08 18:08:59 jonas
  1979. * fixed regvars support. Needs -doldregvars to activate. Only tested with
  1980. ppc, other processors should however only require maxregvars and
  1981. maxfpuregvars constants in cpubase.pas. Remember to take scratch-
  1982. registers into account when defining that value.
  1983. Revision 1.155 2004/02/05 14:13:53 daniel
  1984. * Tvarsym.highvarsym removed
  1985. Revision 1.154 2004/02/04 23:01:36 daniel
  1986. * Empty destructor Tlabelsym.destroy removed
  1987. Revision 1.153 2004/02/04 22:54:57 daniel
  1988. * Tvarsym.highvarsym commented out (unused by compiler, purpose unknown)
  1989. Revision 1.152 2004/02/04 22:15:15 daniel
  1990. * Rtti generation moved to ncgutil
  1991. * Assmtai usage of symsym removed
  1992. * operator overloading cleanup up
  1993. Revision 1.151 2004/01/31 22:48:31 daniel
  1994. * Fix stabs generation problem reported by Jonas
  1995. Revision 1.150 2004/01/31 21:09:58 daniel
  1996. * Stabs lineinfo problem fixed
  1997. Revision 1.149 2004/01/31 18:40:15 daniel
  1998. * Last steps before removal of aasmtai dependency in symsym can be
  1999. accomplished.
  2000. Revision 1.148 2004/01/31 17:45:17 peter
  2001. * Change several $ifdef i386 to x86
  2002. * Change several OS_32 to OS_INT/OS_ADDR
  2003. Revision 1.147 2004/01/27 22:45:30 daniel
  2004. * Stab generation bug fixed
  2005. Revision 1.146 2004/01/26 22:08:20 daniel
  2006. * Bugfix on constant strings stab generation. Never worked and still
  2007. doesn't work for unknown reasons.
  2008. Revision 1.145 2004/01/26 16:12:28 daniel
  2009. * reginfo now also only allocated during register allocation
  2010. * third round of gdb cleanups: kick out most of concatstabto
  2011. Revision 1.144 2004/01/25 11:33:48 daniel
  2012. * 2nd round of gdb cleanup
  2013. Revision 1.143 2004/01/16 18:08:39 daniel
  2014. * Applied Peters patch
  2015. Revision 1.142 2004/01/15 23:16:32 daniel
  2016. + Cleanup of stabstring generation code. Cleaner, faster, and compiler
  2017. executable reduced by 50 kb,
  2018. Revision 1.141 2004/01/11 23:56:20 daniel
  2019. * Experiment: Compress strings to save memory
  2020. Did not save a single byte of mem; clearly the core size is boosted by
  2021. temporary memory usage...
  2022. Revision 1.140 2004/01/06 15:46:12 peter
  2023. * fix stabs for locals
  2024. Revision 1.139 2003/12/23 22:13:26 peter
  2025. * don't generate rtti for errordef
  2026. Revision 1.138 2003/12/12 12:09:40 marco
  2027. * always generate RTTI patch from peter
  2028. Revision 1.137 2003/12/01 18:44:15 peter
  2029. * fixed some crashes
  2030. * fixed varargs and register calling probs
  2031. Revision 1.136 2003/11/29 18:16:39 jonas
  2032. * don't internalerror when emitting debuginfo for LOC_FPUREGISTER
  2033. Revision 1.135 2003/11/23 17:05:16 peter
  2034. * register calling is left-right
  2035. * parameter ordering
  2036. * left-right calling inserts result parameter last
  2037. Revision 1.134 2003/10/30 16:23:13 peter
  2038. * don't search for overloads in parents for constructors
  2039. Revision 1.133 2003/10/29 21:56:28 peter
  2040. * procsym.deref derefs only own procdefs
  2041. * reset paracount in procdef.deref so a second deref doesn't increase
  2042. the paracounts to invalid values
  2043. Revision 1.132 2003/10/29 19:48:51 peter
  2044. * renamed mangeldname_prefix to make_mangledname and made it more
  2045. generic
  2046. * make_mangledname is now also used for internal threadvar/resstring
  2047. lists
  2048. * Add P$ in front of program modulename to prevent duplicated symbols
  2049. at assembler level, because the main program can have the same name
  2050. as a unit, see webtbs/tw1251b
  2051. Revision 1.131 2003/10/28 15:36:01 peter
  2052. * absolute to object field supported, fixes tb0458
  2053. Revision 1.130 2003/10/22 20:40:00 peter
  2054. * write derefdata in a separate ppu entry
  2055. Revision 1.129 2003/10/22 15:22:33 peter
  2056. * fixed unitsym-globalsymtable relation so the uses of a unit
  2057. is counted correctly
  2058. Revision 1.128 2003/10/21 18:14:30 peter
  2059. * fix writing of widechar to ppu
  2060. Revision 1.127 2003/10/17 14:38:32 peter
  2061. * 64k registers supported
  2062. * fixed some memory leaks
  2063. Revision 1.126 2003/10/13 14:05:12 peter
  2064. * removed is_visible_for_proc
  2065. * search also for class overloads when finding interface
  2066. implementations
  2067. Revision 1.125 2003/10/08 19:19:45 peter
  2068. * set_varstate cleanup
  2069. Revision 1.124 2003/10/07 21:14:33 peter
  2070. * compare_paras() has a parameter to ignore hidden parameters
  2071. * cross unit overload searching ignores hidden parameters when
  2072. comparing parameter lists. Now function(string):string is
  2073. not overriden with procedure(string) which has the same visible
  2074. parameter list
  2075. Revision 1.123 2003/10/07 15:17:07 peter
  2076. * inline supported again, LOC_REFERENCEs are used to pass the
  2077. parameters
  2078. * inlineparasymtable,inlinelocalsymtable removed
  2079. * exitlabel inserting fixed
  2080. Revision 1.122 2003/10/01 20:34:49 peter
  2081. * procinfo unit contains tprocinfo
  2082. * cginfo renamed to cgbase
  2083. * moved cgmessage to verbose
  2084. * fixed ppc and sparc compiles
  2085. Revision 1.121 2003/09/25 21:25:37 peter
  2086. * has_local_copy gdb fix
  2087. Revision 1.120 2003/09/25 16:18:54 peter
  2088. * fixed stabs for globals,static
  2089. Revision 1.119 2003/09/23 17:56:06 peter
  2090. * locals and paras are allocated in the code generation
  2091. * tvarsym.localloc contains the location of para/local when
  2092. generating code for the current procedure
  2093. Revision 1.118 2003/09/16 16:17:01 peter
  2094. * varspez in calls to push_addr_param
  2095. Revision 1.117 2003/09/14 13:20:12 peter
  2096. * fix previous commit, also include objectsymtable
  2097. Revision 1.116 2003/09/14 12:58:00 peter
  2098. * support mulitple overloads in implementation, this is delphi
  2099. compatible
  2100. * procsym only stores the overloads available in the interface
  2101. Revision 1.115 2003/09/03 15:55:01 peter
  2102. * NEWRA branch merged
  2103. Revision 1.114 2003/09/03 11:18:37 florian
  2104. * fixed arm concatcopy
  2105. + arm support in the common compiler sources added
  2106. * moved some generic cg code around
  2107. + tfputype added
  2108. * ...
  2109. Revision 1.113.2.2 2003/08/29 17:28:59 peter
  2110. * next batch of updates
  2111. Revision 1.113.2.1 2003/08/27 19:55:54 peter
  2112. * first tregister patch
  2113. Revision 1.113 2003/08/20 20:29:06 daniel
  2114. * Some more R_NO changes
  2115. * Preventive code to loadref added
  2116. Revision 1.112 2003/07/05 22:41:59 peter
  2117. * check if owner.defowner is valid when checking private/protected
  2118. Revision 1.111 2003/07/04 22:41:41 pierre
  2119. * single threadvar debugging support
  2120. Revision 1.110 2003/06/13 21:19:31 peter
  2121. * current_procdef removed, use current_procinfo.procdef instead
  2122. Revision 1.109 2003/06/07 20:26:32 peter
  2123. * re-resolving added instead of reloading from ppu
  2124. * tderef object added to store deref info for resolving
  2125. Revision 1.108 2003/06/05 17:53:30 peter
  2126. * fix to compile without gdb
  2127. Revision 1.107 2003/06/02 22:59:17 florian
  2128. * absolutesyms aren't fpuregable either
  2129. Revision 1.106 2003/05/30 18:48:17 jonas
  2130. * fixed intregister bug
  2131. * fixed error in my previous commit: vo_(fpu)regable should only be set
  2132. for (inline)localsymtable and (inline)parasymtable entries
  2133. Revision 1.105 2003/05/30 13:35:10 jonas
  2134. * the vartype field of tvarsym is now a property, because is_XXXregable
  2135. must be updated when the vartype is changed
  2136. Revision 1.104 2003/05/15 18:58:53 peter
  2137. * removed selfpointer_offset, vmtpointer_offset
  2138. * tvarsym.adjusted_address
  2139. * address in localsymtable is now in the real direction
  2140. * removed some obsolete globals
  2141. Revision 1.103 2003/05/12 18:13:57 peter
  2142. * create rtti label using newasmsymboldata and update binding
  2143. only when calling tai_symbol.create
  2144. * tai_symbol.create_global added
  2145. Revision 1.102 2003/05/09 17:47:03 peter
  2146. * self moved to hidden parameter
  2147. * removed hdisposen,hnewn,selfn
  2148. Revision 1.101 2003/05/05 14:53:16 peter
  2149. * vs_hidden replaced by is_hidden boolean
  2150. Revision 1.100 2003/04/27 11:21:34 peter
  2151. * aktprocdef renamed to current_procinfo.procdef
  2152. * procinfo renamed to current_procinfo
  2153. * procinfo will now be stored in current_module so it can be
  2154. cleaned up properly
  2155. * gen_main_procsym changed to create_main_proc and release_main_proc
  2156. to also generate a tprocinfo structure
  2157. * fixed unit implicit initfinal
  2158. Revision 1.99 2003/04/27 10:03:18 jonas
  2159. * fixed stabs generation for local variables on systems where they have
  2160. a positive offset relative to the stack/framepointer
  2161. Revision 1.98 2003/04/27 07:29:51 peter
  2162. * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
  2163. a new procdef declaration
  2164. * aktprocsym removed
  2165. * lexlevel removed, use symtable.symtablelevel instead
  2166. * implicit init/final code uses the normal genentry/genexit
  2167. * funcret state checking updated for new funcret handling
  2168. Revision 1.97 2003/04/25 20:59:35 peter
  2169. * removed funcretn,funcretsym, function result is now in varsym
  2170. and aliases for result and function name are added using absolutesym
  2171. * vs_hidden parameter for funcret passed in parameter
  2172. * vs_hidden fixes
  2173. * writenode changed to printnode and released from extdebug
  2174. * -vp option added to generate a tree.log with the nodetree
  2175. * nicer printnode for statements, callnode
  2176. Revision 1.96 2003/04/23 13:13:58 peter
  2177. * fix operator overload search parameter order
  2178. Revision 1.95 2003/04/10 17:57:53 peter
  2179. * vs_hidden released
  2180. Revision 1.94 2003/03/17 15:54:22 peter
  2181. * store symoptions also for procdef
  2182. * check symoptions (private,public) when calculating possible
  2183. overload candidates
  2184. Revision 1.93 2003/01/15 01:44:33 peter
  2185. * merged methodpointer fixes from 1.0.x
  2186. Revision 1.92 2003/01/09 21:52:38 peter
  2187. * merged some verbosity options.
  2188. * V_LineInfo is a verbosity flag to include line info
  2189. Revision 1.91 2003/01/08 18:43:57 daniel
  2190. * Tregister changed into a record
  2191. Revision 1.90 2003/01/03 12:15:56 daniel
  2192. * Removed ifdefs around notifications
  2193. ifdefs around for loop optimizations remain
  2194. Revision 1.89 2003/01/02 11:14:02 michael
  2195. + Patch from peter to support initial values for local variables
  2196. Revision 1.88 2003/01/01 22:51:03 peter
  2197. * high value insertion changed so it works also when 2 parameters
  2198. are passed
  2199. Revision 1.87 2002/12/31 09:55:58 daniel
  2200. + Notification implementation complete
  2201. + Add for loop code optimization using notifications
  2202. results in 1.5-1.9% speed improvement in nestloop benchmark
  2203. Optimization incomplete, compiler does not cycle yet with
  2204. notifications enabled.
  2205. Revision 1.86 2002/12/30 22:44:53 daniel
  2206. * Some work on notifications
  2207. Revision 1.85 2002/12/27 18:07:44 peter
  2208. * fix crashes when searching symbols
  2209. Revision 1.84 2002/12/20 16:02:22 peter
  2210. * fix stupid copy&paste bug in binary operator search
  2211. Revision 1.83 2002/12/16 22:08:31 peter
  2212. * fix order of procdefs in procsym, procdefs are now always appended
  2213. so that loading from a ppu will keep the same order. This is
  2214. important for the generation of VMTs
  2215. Revision 1.82 2002/12/11 22:39:23 peter
  2216. * better error message when no operator is found for equal
  2217. Revision 1.81 2002/12/07 14:27:10 carl
  2218. * 3% memory optimization
  2219. * changed some types
  2220. + added type checking with different size for call node and for
  2221. parameters
  2222. Revision 1.80 2002/12/06 17:51:11 peter
  2223. * merged cdecl and array fixes
  2224. Revision 1.79 2002/11/27 20:04:10 peter
  2225. * tvarsym.get_push_size replaced by paramanager.push_size
  2226. Revision 1.78 2002/11/27 02:34:20 peter
  2227. * only find real equal procvars
  2228. Revision 1.77 2002/11/25 18:43:34 carl
  2229. - removed the invalid if <> checking (Delphi is strange on this)
  2230. + implemented abstract warning on instance creation of class with
  2231. abstract methods.
  2232. * some error message cleanups
  2233. Revision 1.76 2002/11/25 17:43:26 peter
  2234. * splitted defbase in defutil,symutil,defcmp
  2235. * merged isconvertable and is_equal into compare_defs(_ext)
  2236. * made operator search faster by walking the list only once
  2237. Revision 1.75 2002/11/23 22:50:09 carl
  2238. * some small speed optimizations
  2239. + added several new warnings/hints
  2240. Revision 1.74 2002/11/22 22:48:11 carl
  2241. * memory optimization with tconstsym (1.5%)
  2242. Revision 1.73 2002/11/18 17:31:59 peter
  2243. * pass proccalloption to ret_in_xxx and push_xxx functions
  2244. Revision 1.72 2002/11/17 16:31:57 carl
  2245. * memory optimization (3-4%) : cleanup of tai fields,
  2246. cleanup of tdef and tsym fields.
  2247. * make it work for m68k
  2248. Revision 1.71 2002/11/09 15:30:07 carl
  2249. + align RTTI tables
  2250. Revision 1.70 2002/10/13 21:33:37 peter
  2251. * give correct fileposition for undefined forward procs
  2252. Revision 1.69 2002/10/05 12:43:29 carl
  2253. * fixes for Delphi 6 compilation
  2254. (warning : Some features do not work under Delphi)
  2255. Revision 1.68 2002/10/05 00:52:20 peter
  2256. * split boolean check in two lines for easier debugging
  2257. Revision 1.67 2002/09/26 12:04:53 florian
  2258. + constsym with type=constguid can be written to ppu now,
  2259. fixes web bug 1820
  2260. Revision 1.66 2002/09/16 14:11:13 peter
  2261. * add argument to equal_paras() to support default values or not
  2262. Revision 1.65 2002/09/09 17:34:16 peter
  2263. * tdicationary.replace added to replace and item in a dictionary. This
  2264. is only allowed for the same name
  2265. * varsyms are inserted in symtable before the types are parsed. This
  2266. fixes the long standing "var longint : longint" bug
  2267. - consume_idlist and idstringlist removed. The loops are inserted
  2268. at the callers place and uses the symtable for duplicate id checking
  2269. Revision 1.64 2002/09/08 11:10:17 carl
  2270. * bugfix 2109 (bad imho, but only way)
  2271. Revision 1.63 2002/09/07 18:17:41 florian
  2272. + tvarsym.paraitem added
  2273. Revision 1.62 2002/09/07 15:25:10 peter
  2274. * old logs removed and tabs fixed
  2275. Revision 1.61 2002/09/05 19:29:45 peter
  2276. * memdebug enhancements
  2277. Revision 1.60 2002/09/05 14:51:42 peter
  2278. * internalerror instead of crash in getprocdef
  2279. Revision 1.59 2002/09/03 16:26:27 daniel
  2280. * Make Tprocdef.defs protected
  2281. Revision 1.58 2002/09/01 08:01:16 daniel
  2282. * Removed sets from Tcallnode.det_resulttype
  2283. + Added read/write notifications of variables. These will be usefull
  2284. for providing information for several optimizations. For example
  2285. the value of the loop variable of a for loop does matter is the
  2286. variable is read after the for loop, but if it's no longer used
  2287. or written, it doesn't matter and this can be used to optimize
  2288. the loop code generation.
  2289. Revision 1.57 2002/08/25 19:25:21 peter
  2290. * sym.insert_in_data removed
  2291. * symtable.insertvardata/insertconstdata added
  2292. * removed insert_in_data call from symtable.insert, it needs to be
  2293. called separatly. This allows to deref the address calculation
  2294. * procedures now calculate the parast addresses after the procedure
  2295. directives are parsed. This fixes the cdecl parast problem
  2296. * push_addr_param has an extra argument that specifies if cdecl is used
  2297. or not
  2298. Revision 1.56 2002/08/25 09:06:21 peter
  2299. * fixed loop in concat_procdefs
  2300. Revision 1.55 2002/08/20 16:54:40 peter
  2301. * write address of varsym always
  2302. Revision 1.54 2002/08/20 10:31:26 daniel
  2303. * Tcallnode.det_resulttype rewritten
  2304. Revision 1.53 2002/08/18 20:06:27 peter
  2305. * inlining is now also allowed in interface
  2306. * renamed write/load to ppuwrite/ppuload
  2307. * tnode storing in ppu
  2308. * nld,ncon,nbas are already updated for storing in ppu
  2309. Revision 1.52 2002/08/17 09:23:42 florian
  2310. * first part of procinfo rewrite
  2311. Revision 1.51 2002/08/16 14:24:59 carl
  2312. * issameref() to test if two references are the same (then emit no opcodes)
  2313. + ret_in_reg to replace ret_in_acc
  2314. (fix some register allocation bugs at the same time)
  2315. + save_std_register now has an extra parameter which is the
  2316. usedinproc registers
  2317. Revision 1.50 2002/08/13 21:40:57 florian
  2318. * more fixes for ppc calling conventions
  2319. Revision 1.49 2002/08/12 15:08:40 carl
  2320. + stab register indexes for powerpc (moved from gdb to cpubase)
  2321. + tprocessor enumeration moved to cpuinfo
  2322. + linker in target_info is now a class
  2323. * many many updates for m68k (will soon start to compile)
  2324. - removed some ifdef or correct them for correct cpu
  2325. Revision 1.48 2002/08/11 14:32:28 peter
  2326. * renamed current_library to objectlibrary
  2327. Revision 1.47 2002/08/11 13:24:14 peter
  2328. * saving of asmsymbols in ppu supported
  2329. * asmsymbollist global is removed and moved into a new class
  2330. tasmlibrarydata that will hold the info of a .a file which
  2331. corresponds with a single module. Added librarydata to tmodule
  2332. to keep the library info stored for the module. In the future the
  2333. objectfiles will also be stored to the tasmlibrarydata class
  2334. * all getlabel/newasmsymbol and friends are moved to the new class
  2335. Revision 1.46 2002/07/23 10:13:23 daniel
  2336. * Added important comment
  2337. Revision 1.45 2002/07/23 09:51:26 daniel
  2338. * Tried to make Tprocsym.defs protected. I didn't succeed but the cleanups
  2339. are worth comitting.
  2340. Revision 1.44 2002/07/20 17:45:29 daniel
  2341. * Register variables are now possible for global variables too. This is
  2342. important for small programs without procedures.
  2343. Revision 1.43 2002/07/20 11:57:58 florian
  2344. * types.pas renamed to defbase.pas because D6 contains a types
  2345. unit so this would conflicts if D6 programms are compiled
  2346. + Willamette/SSE2 instructions to assembler added
  2347. Revision 1.42 2002/07/11 14:41:31 florian
  2348. * start of the new generic parameter handling
  2349. }