symsym.pas 83 KB

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