symsym.pas 82 KB

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