symsym.pas 83 KB

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