symsym.pas 82 KB

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