symsym.pas 83 KB

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