ncal.pas 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This file implements the node for sub procedure calling.
  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 ncal;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. cutils,cclasses,
  23. globtype,cpuinfo,
  24. paramgr,parabase,
  25. node,nbas,nutils,
  26. {$ifdef state_tracking}
  27. nstate,
  28. {$endif state_tracking}
  29. symbase,symtype,symsym,symdef,symtable;
  30. type
  31. tcallnodeflag = (
  32. cnf_restypeset,
  33. cnf_return_value_used,
  34. cnf_inherited,
  35. cnf_anon_inherited,
  36. cnf_new_call,
  37. cnf_dispose_call,
  38. cnf_member_call { called with implicit methodpointer tree }
  39. );
  40. tcallnodeflags = set of tcallnodeflag;
  41. tcallnode = class(tbinarynode)
  42. private
  43. {$ifndef VER1_0}
  44. { info for inlining }
  45. inlinelocals: array of tnode;
  46. {$endif VER1_0}
  47. { number of parameters passed from the source, this does not include the hidden parameters }
  48. paralength : smallint;
  49. function gen_self_tree_methodpointer:tnode;
  50. function gen_self_tree:tnode;
  51. function gen_vmt_tree:tnode;
  52. procedure bind_paraitem;
  53. { function return node, this is used to pass the data for a
  54. ret_in_param return value }
  55. _funcretnode : tnode;
  56. procedure setfuncretnode(const returnnode: tnode);
  57. procedure convert_carg_array_of_const;
  58. procedure order_parameters;
  59. procedure createinlineparas(var createstatement, deletestatement: tstatementnode);
  60. function replaceparaload(var n: tnode; arg: pointer): foreachnoderesult;
  61. {$ifndef VER1_0}
  62. procedure createlocaltemps(p:TNamedIndexItem;arg:pointer);
  63. {$endif VER1_0}
  64. protected
  65. pushedparasize : longint;
  66. public
  67. { the symbol containing the definition of the procedure }
  68. { to call }
  69. symtableprocentry : tprocsym;
  70. symtableprocentryderef : tderef;
  71. { symtable where the entry was found, needed for with support }
  72. symtableproc : tsymtable;
  73. { the definition of the procedure to call }
  74. procdefinition : tabstractprocdef;
  75. procdefinitionderef : tderef;
  76. { tree that contains the pointer to the object for this method }
  77. methodpointerinit,
  78. methodpointerdone : tblocknode;
  79. methodpointer : tnode;
  80. { inline function body }
  81. inlinecode : tnode;
  82. { varargs tparaitems }
  83. varargsparas : tvarargspara;
  84. { node that specifies where the result should be put for calls }
  85. { that return their result in a parameter }
  86. property funcretnode: tnode read _funcretnode write setfuncretnode;
  87. { separately specified resulttype for some compilerprocs (e.g. }
  88. { you can't have a function with an "array of char" resulttype }
  89. { the RTL) (JM) }
  90. restype: ttype;
  91. callnodeflags : tcallnodeflags;
  92. { only the processor specific nodes need to override this }
  93. { constructor }
  94. constructor create(l:tnode; v : tprocsym;st : tsymtable; mp: tnode; callflags:tcallnodeflags);virtual;
  95. constructor create_procvar(l,r:tnode);
  96. constructor createintern(const name: string; params: tnode);
  97. constructor createinternres(const name: string; params: tnode; const res: ttype);
  98. constructor createinternreturn(const name: string; params: tnode; returnnode : tnode);
  99. destructor destroy;override;
  100. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  101. procedure ppuwrite(ppufile:tcompilerppufile);override;
  102. procedure buildderefimpl;override;
  103. procedure derefimpl;override;
  104. function getcopy : tnode;override;
  105. { Goes through all symbols in a class and subclasses and calls
  106. verify abstract for each .
  107. }
  108. procedure verifyabstractcalls;
  109. { called for each definition in a class and verifies if a method
  110. is abstract or not, if it is abstract, give out a warning
  111. }
  112. procedure verifyabstract(p : tnamedindexitem;arg:pointer);
  113. procedure insertintolist(l : tnodelist);override;
  114. function pass_1 : tnode;override;
  115. function det_resulttype:tnode;override;
  116. {$ifdef state_tracking}
  117. function track_state_pass(exec_known:boolean):boolean;override;
  118. {$endif state_tracking}
  119. function docompare(p: tnode): boolean; override;
  120. procedure printnodedata(var t:text);override;
  121. function para_count:longint;
  122. private
  123. AbstractMethodsList : TStringList;
  124. end;
  125. tcallnodeclass = class of tcallnode;
  126. tcallparaflag = (
  127. cpf_is_colon_para,
  128. cpf_varargs_para { belongs this para to varargs }
  129. );
  130. tcallparaflags = set of tcallparaflag;
  131. tcallparanode = class(tbinarynode)
  132. public
  133. callparaflags : tcallparaflags;
  134. paraitem : tparaitem;
  135. used_by_callnode : boolean;
  136. { only the processor specific nodes need to override this }
  137. { constructor }
  138. constructor create(expr,next : tnode);virtual;
  139. destructor destroy;override;
  140. constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
  141. procedure ppuwrite(ppufile:tcompilerppufile);override;
  142. function getcopy : tnode;override;
  143. procedure insertintolist(l : tnodelist);override;
  144. procedure get_paratype;
  145. procedure insert_typeconv(do_count : boolean);
  146. procedure det_registers;
  147. procedure firstcallparan;
  148. procedure secondcallparan;virtual;abstract;
  149. function docompare(p: tnode): boolean; override;
  150. procedure printnodetree(var t:text);override;
  151. end;
  152. tcallparanodeclass = class of tcallparanode;
  153. function reverseparameters(p: tcallparanode): tcallparanode;
  154. var
  155. ccallnode : tcallnodeclass;
  156. ccallparanode : tcallparanodeclass;
  157. { Current callnode, this is needed for having a link
  158. between the callparanodes and the callnode they belong to }
  159. aktcallnode : tcallnode;
  160. implementation
  161. uses
  162. systems,
  163. verbose,globals,
  164. symconst,defutil,defcmp,
  165. htypechk,pass_1,
  166. ncnv,nld,ninl,nadd,ncon,nmem,
  167. procinfo,
  168. cgbase
  169. ;
  170. type
  171. tobjectinfoitem = class(tlinkedlistitem)
  172. objinfo : tobjectdef;
  173. constructor create(def : tobjectdef);
  174. end;
  175. {****************************************************************************
  176. HELPERS
  177. ****************************************************************************}
  178. function reverseparameters(p: tcallparanode): tcallparanode;
  179. var
  180. hp1, hp2: tcallparanode;
  181. begin
  182. hp1:=nil;
  183. while assigned(p) do
  184. begin
  185. { pull out }
  186. hp2:=p;
  187. p:=tcallparanode(p.right);
  188. { pull in }
  189. hp2.right:=hp1;
  190. hp1:=hp2;
  191. end;
  192. reverseparameters:=hp1;
  193. end;
  194. procedure maybe_load_para_in_temp(var p:tnode);
  195. var
  196. hp : tnode;
  197. ptemp : ttempcreatenode;
  198. newinitstatement,
  199. newdonestatement : tstatementnode;
  200. begin
  201. if not assigned(aktcallnode) then
  202. internalerror(200410121);
  203. hp:=p;
  204. while assigned(hp) and
  205. (hp.nodetype=typeconvn) do
  206. hp:=tunarynode(hp).left;
  207. if assigned(hp) and
  208. (
  209. { call result must always be loaded in temp to prevent
  210. double creation }
  211. (hp.nodetype=calln)
  212. { Also optimize also complex loads }
  213. {$warning Complex loads can also be optimized}
  214. // or not(hp.nodetype in [typen,loadvmtaddrn,loadn])
  215. ) then
  216. begin
  217. if not assigned(aktcallnode.methodpointerinit) then
  218. begin
  219. aktcallnode.methodpointerinit:=internalstatements(newinitstatement);
  220. aktcallnode.methodpointerdone:=internalstatements(newdonestatement);
  221. end
  222. else
  223. begin
  224. newinitstatement:=laststatement(aktcallnode.methodpointerinit);
  225. newdonestatement:=laststatement(aktcallnode.methodpointerdone);
  226. end;
  227. { temp create }
  228. ptemp:=ctempcreatenode.create_reg(p.resulttype,p.resulttype.def.size,tt_persistent);
  229. addstatement(newinitstatement,ptemp);
  230. addstatement(newinitstatement,cassignmentnode.create(
  231. ctemprefnode.create(ptemp),
  232. p));
  233. resulttypepass(aktcallnode.methodpointerinit);
  234. { new tree is only a temp reference }
  235. p:=ctemprefnode.create(ptemp);
  236. resulttypepass(p);
  237. { temp release }
  238. addstatement(newdonestatement,ctempdeletenode.create(ptemp));
  239. resulttypepass(aktcallnode.methodpointerdone);
  240. end;
  241. end;
  242. function gen_high_tree(var p:tnode;paradef:tdef):tnode;
  243. var
  244. temp: tnode;
  245. len : integer;
  246. loadconst : boolean;
  247. hightree : tnode;
  248. begin
  249. len:=-1;
  250. loadconst:=true;
  251. hightree:=nil;
  252. case p.resulttype.def.deftype of
  253. arraydef :
  254. begin
  255. if (paradef.deftype<>arraydef) then
  256. internalerror(200405241);
  257. { handle special case of passing an single array to an array of array }
  258. if compare_defs(tarraydef(paradef).elementtype.def,p.resulttype.def,nothingn)>=te_equal then
  259. len:=0
  260. else
  261. begin
  262. maybe_load_para_in_temp(p);
  263. { handle via a normal inline in_high_x node }
  264. loadconst := false;
  265. hightree := geninlinenode(in_high_x,false,p.getcopy);
  266. resulttypepass(hightree);
  267. { only substract low(array) if it's <> 0 }
  268. temp := geninlinenode(in_low_x,false,p.getcopy);
  269. resulttypepass(temp);
  270. if (temp.nodetype <> ordconstn) or
  271. (tordconstnode(temp).value <> 0) then
  272. hightree := caddnode.create(subn,hightree,temp)
  273. else
  274. temp.free;
  275. end;
  276. end;
  277. stringdef :
  278. begin
  279. if is_open_string(paradef) then
  280. begin
  281. maybe_load_para_in_temp(p);
  282. { handle via a normal inline in_high_x node }
  283. loadconst := false;
  284. hightree := geninlinenode(in_high_x,false,p.getcopy);
  285. end
  286. else
  287. begin
  288. { passing a string to an array of char }
  289. if (p.nodetype=stringconstn) then
  290. begin
  291. len:=str_length(p);
  292. if len>0 then
  293. dec(len);
  294. end
  295. else
  296. begin
  297. maybe_load_para_in_temp(p);
  298. hightree:=caddnode.create(subn,geninlinenode(in_length_x,false,p.getcopy),
  299. cordconstnode.create(1,s32inttype,false));
  300. loadconst:=false;
  301. end;
  302. end;
  303. end;
  304. else
  305. len:=0;
  306. end;
  307. if loadconst then
  308. hightree:=cordconstnode.create(len,s32inttype,true)
  309. else
  310. begin
  311. if not assigned(hightree) then
  312. internalerror(200304071);
  313. { Need to use explicit, because it can also be a enum }
  314. hightree:=ctypeconvnode.create_explicit(hightree,s32inttype);
  315. end;
  316. result:=hightree;
  317. end;
  318. {****************************************************************************
  319. TOBJECTINFOITEM
  320. ****************************************************************************}
  321. constructor tobjectinfoitem.create(def : tobjectdef);
  322. begin
  323. inherited create;
  324. objinfo := def;
  325. end;
  326. {****************************************************************************
  327. TCALLPARANODE
  328. ****************************************************************************}
  329. constructor tcallparanode.create(expr,next : tnode);
  330. begin
  331. inherited create(callparan,expr,next);
  332. if not assigned(expr) then
  333. internalerror(200305091);
  334. expr.set_file_line(self);
  335. callparaflags:=[];
  336. end;
  337. destructor tcallparanode.destroy;
  338. begin
  339. { When the node is used by callnode then
  340. we don't destroy left, the callnode takes care of it }
  341. if used_by_callnode then
  342. left:=nil;
  343. inherited destroy;
  344. end;
  345. constructor tcallparanode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  346. begin
  347. inherited ppuload(t,ppufile);
  348. ppufile.getsmallset(callparaflags);
  349. end;
  350. procedure tcallparanode.ppuwrite(ppufile:tcompilerppufile);
  351. begin
  352. inherited ppuwrite(ppufile);
  353. ppufile.putsmallset(callparaflags);
  354. end;
  355. function tcallparanode.getcopy : tnode;
  356. var
  357. n : tcallparanode;
  358. begin
  359. n:=tcallparanode(inherited getcopy);
  360. n.callparaflags:=callparaflags;
  361. n.paraitem:=paraitem;
  362. result:=n;
  363. end;
  364. procedure tcallparanode.insertintolist(l : tnodelist);
  365. begin
  366. end;
  367. procedure tcallparanode.get_paratype;
  368. var
  369. old_array_constructor : boolean;
  370. begin
  371. inc(parsing_para_level);
  372. if assigned(right) then
  373. tcallparanode(right).get_paratype;
  374. old_array_constructor:=allow_array_constructor;
  375. allow_array_constructor:=true;
  376. resulttypepass(left);
  377. allow_array_constructor:=old_array_constructor;
  378. if codegenerror then
  379. resulttype:=generrortype
  380. else
  381. resulttype:=left.resulttype;
  382. dec(parsing_para_level);
  383. end;
  384. procedure tcallparanode.insert_typeconv(do_count : boolean);
  385. var
  386. oldtype : ttype;
  387. {$ifdef extdebug}
  388. store_count_ref : boolean;
  389. {$endif def extdebug}
  390. begin
  391. inc(parsing_para_level);
  392. {$ifdef extdebug}
  393. if do_count then
  394. begin
  395. store_count_ref:=count_ref;
  396. count_ref:=true;
  397. end;
  398. {$endif def extdebug}
  399. { Be sure to have the resulttype }
  400. if not assigned(left.resulttype.def) then
  401. resulttypepass(left);
  402. if (left.nodetype<>nothingn) then
  403. begin
  404. { Convert tp procvars, this is needs to be done
  405. here to make the change permanent. in the overload
  406. choosing the changes are only made temporary }
  407. if (left.resulttype.def.deftype=procvardef) and
  408. (paraitem.paratype.def.deftype<>procvardef) then
  409. begin
  410. if maybe_call_procvar(left,true) then
  411. resulttype:=left.resulttype;
  412. end;
  413. { Handle varargs and hidden paras directly, no typeconvs or }
  414. { typechecking needed }
  415. if (cpf_varargs_para in callparaflags) then
  416. begin
  417. { convert pascal to C types }
  418. case left.resulttype.def.deftype of
  419. stringdef :
  420. inserttypeconv(left,charpointertype);
  421. floatdef :
  422. inserttypeconv(left,s64floattype);
  423. end;
  424. set_varstate(left,vs_used,true);
  425. resulttype:=left.resulttype;
  426. { also update paraitem type to get the correct parameter location
  427. for the new types }
  428. paraitem.paratype:=left.resulttype;
  429. end
  430. else
  431. if (paraitem.is_hidden) then
  432. begin
  433. set_varstate(left,vs_used,true);
  434. resulttype:=left.resulttype;
  435. end
  436. else
  437. begin
  438. { Do we need arrayconstructor -> set conversion, then insert
  439. it here before the arrayconstructor node breaks the tree
  440. with its conversions of enum->ord }
  441. if (left.nodetype=arrayconstructorn) and
  442. (paraitem.paratype.def.deftype=setdef) then
  443. inserttypeconv(left,paraitem.paratype);
  444. { set some settings needed for arrayconstructor }
  445. if is_array_constructor(left.resulttype.def) then
  446. begin
  447. if is_array_of_const(paraitem.paratype.def) then
  448. begin
  449. { force variant array }
  450. include(left.flags,nf_forcevaria);
  451. end
  452. else
  453. begin
  454. include(left.flags,nf_novariaallowed);
  455. { now that the resultting type is know we can insert the required
  456. typeconvs for the array constructor }
  457. if paraitem.paratype.def.deftype=arraydef then
  458. tarrayconstructornode(left).force_type(tarraydef(paraitem.paratype.def).elementtype);
  459. end;
  460. end;
  461. { check if local proc/func is assigned to procvar }
  462. if left.resulttype.def.deftype=procvardef then
  463. test_local_to_procvar(tprocvardef(left.resulttype.def),paraitem.paratype.def);
  464. { test conversions }
  465. if not(is_shortstring(left.resulttype.def) and
  466. is_shortstring(paraitem.paratype.def)) and
  467. (paraitem.paratype.def.deftype<>formaldef) then
  468. begin
  469. { Process open parameters }
  470. if paramanager.push_high_param(paraitem.paratyp,paraitem.paratype.def,aktcallnode.procdefinition.proccalloption) then
  471. begin
  472. { insert type conv but hold the ranges of the array }
  473. oldtype:=left.resulttype;
  474. inserttypeconv(left,paraitem.paratype);
  475. left.resulttype:=oldtype;
  476. end
  477. else
  478. begin
  479. { for ordinals, floats and enums, verify if we might cause
  480. some range-check errors. }
  481. if (paraitem.paratype.def.deftype in [enumdef,orddef,floatdef]) and
  482. (left.resulttype.def.deftype in [enumdef,orddef,floatdef]) and
  483. (left.nodetype in [vecn,loadn,calln]) then
  484. begin
  485. if (left.resulttype.def.size>paraitem.paratype.def.size) then
  486. begin
  487. if (cs_check_range in aktlocalswitches) then
  488. Message(type_w_smaller_possible_range_check)
  489. else
  490. Message(type_h_smaller_possible_range_check);
  491. end;
  492. end;
  493. inserttypeconv(left,paraitem.paratype);
  494. end;
  495. if codegenerror then
  496. begin
  497. dec(parsing_para_level);
  498. exit;
  499. end;
  500. end;
  501. { check var strings }
  502. if (cs_strict_var_strings in aktlocalswitches) and
  503. is_shortstring(left.resulttype.def) and
  504. is_shortstring(paraitem.paratype.def) and
  505. (paraitem.paratyp in [vs_out,vs_var]) and
  506. not(is_open_string(paraitem.paratype.def)) and
  507. not(equal_defs(left.resulttype.def,paraitem.paratype.def)) then
  508. begin
  509. aktfilepos:=left.fileinfo;
  510. CGMessage(type_e_strict_var_string_violation);
  511. end;
  512. { Handle formal parameters separate }
  513. if (paraitem.paratype.def.deftype=formaldef) then
  514. begin
  515. { load procvar if a procedure is passed }
  516. if (m_tp_procvar in aktmodeswitches) and
  517. (left.nodetype=calln) and
  518. (is_void(left.resulttype.def)) then
  519. load_procvar_from_calln(left);
  520. case paraitem.paratyp of
  521. vs_var,
  522. vs_out :
  523. begin
  524. if not valid_for_formal_var(left) then
  525. CGMessagePos(left.fileinfo,parser_e_illegal_parameter_list);
  526. end;
  527. vs_const :
  528. begin
  529. if not valid_for_formal_const(left) then
  530. CGMessagePos(left.fileinfo,parser_e_illegal_parameter_list);
  531. end;
  532. end;
  533. end
  534. else
  535. begin
  536. { check if the argument is allowed }
  537. if (paraitem.paratyp in [vs_out,vs_var]) then
  538. valid_for_var(left);
  539. end;
  540. if paraitem.paratyp = vs_var then
  541. set_unique(left);
  542. { When the address needs to be pushed then the register is
  543. not regable. Exception is when the location is also a var
  544. parameter and we can pass the address transparently }
  545. if (
  546. not(
  547. paraitem.is_hidden and
  548. (left.resulttype.def.deftype in [pointerdef,classrefdef])
  549. ) and
  550. paramanager.push_addr_param(paraitem.paratyp,paraitem.paratype.def,
  551. aktcallnode.procdefinition.proccalloption) and
  552. not(
  553. (left.nodetype=loadn) and
  554. (tloadnode(left).is_addr_param_load)
  555. )
  556. ) then
  557. make_not_regable(left);
  558. if do_count then
  559. begin
  560. if paraitem.paratyp in [vs_var,vs_out] then
  561. set_varstate(left,vs_used,false)
  562. else
  563. set_varstate(left,vs_used,true);
  564. end;
  565. { must only be done after typeconv PM }
  566. resulttype:=paraitem.paratype;
  567. end;
  568. end;
  569. { process next node }
  570. if assigned(right) then
  571. tcallparanode(right).insert_typeconv(do_count);
  572. dec(parsing_para_level);
  573. {$ifdef extdebug}
  574. if do_count then
  575. count_ref:=store_count_ref;
  576. {$endif def extdebug}
  577. end;
  578. procedure tcallparanode.det_registers;
  579. begin
  580. if assigned(right) then
  581. begin
  582. tcallparanode(right).det_registers;
  583. registersint:=right.registersint;
  584. registersfpu:=right.registersfpu;
  585. {$ifdef SUPPORT_MMX}
  586. registersmmx:=right.registersmmx;
  587. {$endif}
  588. end;
  589. firstpass(left);
  590. if left.registersint>registersint then
  591. registersint:=left.registersint;
  592. if left.registersfpu>registersfpu then
  593. registersfpu:=left.registersfpu;
  594. {$ifdef SUPPORT_MMX}
  595. if left.registersmmx>registersmmx then
  596. registersmmx:=left.registersmmx;
  597. {$endif SUPPORT_MMX}
  598. end;
  599. procedure tcallparanode.firstcallparan;
  600. begin
  601. if not assigned(left.resulttype.def) then
  602. get_paratype;
  603. det_registers;
  604. end;
  605. function tcallparanode.docompare(p: tnode): boolean;
  606. begin
  607. docompare :=
  608. inherited docompare(p) and
  609. (callparaflags = tcallparanode(p).callparaflags)
  610. ;
  611. end;
  612. procedure tcallparanode.printnodetree(var t:text);
  613. begin
  614. printnodelist(t);
  615. end;
  616. {****************************************************************************
  617. TCALLNODE
  618. ****************************************************************************}
  619. constructor tcallnode.create(l:tnode;v : tprocsym;st : tsymtable; mp: tnode; callflags:tcallnodeflags);
  620. begin
  621. inherited create(calln,l,nil);
  622. symtableprocentry:=v;
  623. symtableproc:=st;
  624. callnodeflags:=callflags+[cnf_return_value_used];
  625. methodpointer:=mp;
  626. methodpointerinit:=nil;
  627. methodpointerdone:=nil;
  628. procdefinition:=nil;
  629. _funcretnode:=nil;
  630. inlinecode:=nil;
  631. paralength:=-1;
  632. varargsparas:=nil;
  633. end;
  634. constructor tcallnode.create_procvar(l,r:tnode);
  635. begin
  636. inherited create(calln,l,r);
  637. symtableprocentry:=nil;
  638. symtableproc:=nil;
  639. methodpointer:=nil;
  640. methodpointerinit:=nil;
  641. methodpointerdone:=nil;
  642. procdefinition:=nil;
  643. callnodeflags:=[cnf_return_value_used];
  644. _funcretnode:=nil;
  645. inlinecode:=nil;
  646. paralength:=-1;
  647. varargsparas:=nil;
  648. end;
  649. constructor tcallnode.createintern(const name: string; params: tnode);
  650. var
  651. srsym: tsym;
  652. symowner: tsymtable;
  653. begin
  654. if not (cs_compilesystem in aktmoduleswitches) then
  655. begin
  656. srsym := searchsymonlyin(systemunit,name);
  657. symowner := systemunit;
  658. end
  659. else
  660. begin
  661. searchsym(name,srsym,symowner);
  662. if not assigned(srsym) then
  663. searchsym(upper(name),srsym,symowner);
  664. end;
  665. if not assigned(srsym) or
  666. (srsym.typ <> procsym) then
  667. begin
  668. {$ifdef EXTDEBUG}
  669. Comment(V_Error,'unknown compilerproc '+name);
  670. {$endif EXTDEBUG}
  671. internalerror(200107271);
  672. end;
  673. self.create(params,tprocsym(srsym),symowner,nil,[]);
  674. end;
  675. constructor tcallnode.createinternres(const name: string; params: tnode; const res: ttype);
  676. begin
  677. self.createintern(name,params);
  678. restype := res;
  679. include(callnodeflags,cnf_restypeset);
  680. { both the normal and specified resulttype either have to be returned via a }
  681. { parameter or not, but no mixing (JM) }
  682. if paramanager.ret_in_param(restype.def,pocall_compilerproc) xor
  683. paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then
  684. internalerror(200108291);
  685. end;
  686. constructor tcallnode.createinternreturn(const name: string; params: tnode; returnnode : tnode);
  687. begin
  688. self.createintern(name,params);
  689. _funcretnode:=returnnode;
  690. if not paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then
  691. internalerror(200204247);
  692. end;
  693. procedure tcallnode.setfuncretnode(const returnnode: tnode);
  694. var
  695. para: tcallparanode;
  696. begin
  697. if assigned(_funcretnode) then
  698. _funcretnode.free;
  699. _funcretnode := returnnode;
  700. { if the resulttype pass hasn't occurred yet, that one will do }
  701. { everything }
  702. if assigned(resulttype.def) then
  703. begin
  704. { these are returned as values, but we can optimize their loading }
  705. { as well }
  706. if is_ansistring(resulttype.def) or
  707. is_widestring(resulttype.def) then
  708. exit;
  709. para := tcallparanode(left);
  710. while assigned(para) do
  711. begin
  712. if para.paraitem.is_hidden and
  713. (vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) then
  714. begin
  715. para.left.free;
  716. para.left := _funcretnode.getcopy;
  717. exit;
  718. end;
  719. para := tcallparanode(para.right);
  720. end;
  721. { no hidden resultpara found, error! }
  722. if not(procdefinition.proccalloption = pocall_inline) then
  723. internalerror(200306087);
  724. end;
  725. end;
  726. destructor tcallnode.destroy;
  727. begin
  728. methodpointer.free;
  729. methodpointerinit.free;
  730. methodpointerdone.free;
  731. _funcretnode.free;
  732. inlinecode.free;
  733. if assigned(varargsparas) then
  734. varargsparas.free;
  735. inherited destroy;
  736. end;
  737. constructor tcallnode.ppuload(t:tnodetype;ppufile:tcompilerppufile);
  738. begin
  739. inherited ppuload(t,ppufile);
  740. ppufile.getderef(symtableprocentryderef);
  741. {$ifdef fpc}
  742. {$warning FIXME: No withsymtable support}
  743. {$endif}
  744. symtableproc:=nil;
  745. ppufile.getderef(procdefinitionderef);
  746. ppufile.getsmallset(callnodeflags);
  747. methodpointer:=ppuloadnode(ppufile);
  748. methodpointerinit:=tblocknode(ppuloadnode(ppufile));
  749. methodpointerdone:=tblocknode(ppuloadnode(ppufile));
  750. _funcretnode:=ppuloadnode(ppufile);
  751. inlinecode:=ppuloadnode(ppufile);
  752. end;
  753. procedure tcallnode.ppuwrite(ppufile:tcompilerppufile);
  754. begin
  755. inherited ppuwrite(ppufile);
  756. ppufile.putderef(symtableprocentryderef);
  757. ppufile.putderef(procdefinitionderef);
  758. ppufile.putsmallset(callnodeflags);
  759. ppuwritenode(ppufile,methodpointer);
  760. ppuwritenode(ppufile,methodpointerinit);
  761. ppuwritenode(ppufile,methodpointerdone);
  762. ppuwritenode(ppufile,_funcretnode);
  763. ppuwritenode(ppufile,inlinecode);
  764. end;
  765. procedure tcallnode.buildderefimpl;
  766. begin
  767. inherited buildderefimpl;
  768. symtableprocentryderef.build(symtableprocentry);
  769. procdefinitionderef.build(procdefinition);
  770. if assigned(methodpointer) then
  771. methodpointer.buildderefimpl;
  772. if assigned(methodpointerinit) then
  773. methodpointerinit.buildderefimpl;
  774. if assigned(methodpointerdone) then
  775. methodpointerdone.buildderefimpl;
  776. if assigned(_funcretnode) then
  777. _funcretnode.buildderefimpl;
  778. if assigned(inlinecode) then
  779. inlinecode.buildderefimpl;
  780. end;
  781. procedure tcallnode.derefimpl;
  782. var
  783. pt : tcallparanode;
  784. currpara : tparaitem;
  785. begin
  786. inherited derefimpl;
  787. symtableprocentry:=tprocsym(symtableprocentryderef.resolve);
  788. symtableproc:=symtableprocentry.owner;
  789. procdefinition:=tprocdef(procdefinitionderef.resolve);
  790. if assigned(methodpointer) then
  791. methodpointer.derefimpl;
  792. if assigned(methodpointerinit) then
  793. methodpointerinit.derefimpl;
  794. if assigned(methodpointerdone) then
  795. methodpointerdone.derefimpl;
  796. if assigned(_funcretnode) then
  797. _funcretnode.derefimpl;
  798. if assigned(inlinecode) then
  799. inlinecode.derefimpl;
  800. { Connect paraitems }
  801. pt:=tcallparanode(left);
  802. while assigned(pt) and
  803. (cpf_varargs_para in pt.callparaflags) do
  804. pt:=tcallparanode(pt.right);
  805. currpara:=tparaitem(procdefinition.Para.last);
  806. while assigned(currpara) do
  807. begin
  808. if not assigned(pt) then
  809. internalerror(200311077);
  810. pt.paraitem:=currpara;
  811. pt:=tcallparanode(pt.right);
  812. currpara:=tparaitem(currpara.previous);
  813. end;
  814. if assigned(currpara) or assigned(pt) then
  815. internalerror(200311078);
  816. end;
  817. function tcallnode.getcopy : tnode;
  818. var
  819. n : tcallnode;
  820. hp : tparaitem;
  821. oldleft : tnode;
  822. begin
  823. { Need to use a hack here to prevent the parameters from being copied.
  824. The parameters must be copied between methodpointerinit/methodpointerdone because
  825. the can reference methodpointer }
  826. oldleft:=left;
  827. left:=nil;
  828. n:=tcallnode(inherited getcopy);
  829. left:=oldleft;
  830. n.symtableprocentry:=symtableprocentry;
  831. n.symtableproc:=symtableproc;
  832. n.procdefinition:=procdefinition;
  833. n.restype := restype;
  834. n.callnodeflags := callnodeflags;
  835. if assigned(methodpointerinit) then
  836. n.methodpointerinit:=tblocknode(methodpointerinit.getcopy)
  837. else
  838. n.methodpointerinit:=nil;
  839. { methodpointerinit is copied, now references to the temp will also be copied
  840. correctly. We can now copy the parameters and methodpointer }
  841. if assigned(left) then
  842. n.left:=left.getcopy
  843. else
  844. n.left:=nil;
  845. if assigned(methodpointer) then
  846. n.methodpointer:=methodpointer.getcopy
  847. else
  848. n.methodpointer:=nil;
  849. if assigned(methodpointerdone) then
  850. n.methodpointerdone:=tblocknode(methodpointerdone.getcopy)
  851. else
  852. n.methodpointerdone:=nil;
  853. if assigned(_funcretnode) then
  854. n._funcretnode:=_funcretnode.getcopy
  855. else
  856. n._funcretnode:=nil;
  857. if assigned(inlinecode) then
  858. n.inlinecode:=inlinecode.getcopy
  859. else
  860. n.inlinecode:=nil;
  861. if assigned(varargsparas) then
  862. begin
  863. n.varargsparas:=tvarargspara.create;
  864. hp:=tparaitem(varargsparas.first);
  865. while assigned(hp) do
  866. begin
  867. n.varargsparas.concat(hp.getcopy);
  868. hp:=tparaitem(hp.next);
  869. end;
  870. end
  871. else
  872. n.varargsparas:=nil;
  873. result:=n;
  874. end;
  875. procedure tcallnode.insertintolist(l : tnodelist);
  876. begin
  877. end;
  878. procedure tcallnode.convert_carg_array_of_const;
  879. var
  880. hp : tarrayconstructornode;
  881. oldleft : tcallparanode;
  882. begin
  883. oldleft:=tcallparanode(left);
  884. if oldleft.left.nodetype<>arrayconstructorn then
  885. begin
  886. CGMessage1(type_e_wrong_type_in_array_constructor,oldleft.left.resulttype.def.typename);
  887. exit;
  888. end;
  889. { Get arrayconstructor node and insert typeconvs }
  890. hp:=tarrayconstructornode(oldleft.left);
  891. hp.insert_typeconvs;
  892. { Add c args parameters }
  893. { It could be an empty set }
  894. if assigned(hp) and
  895. assigned(hp.left) then
  896. begin
  897. while assigned(hp) do
  898. begin
  899. left:=ccallparanode.create(hp.left,left);
  900. { set callparanode resulttype and flags }
  901. left.resulttype:=hp.left.resulttype;
  902. include(tcallparanode(left).callparaflags,cpf_varargs_para);
  903. hp.left:=nil;
  904. hp:=tarrayconstructornode(hp.right);
  905. end;
  906. end;
  907. { Remove value of old array of const parameter, but keep it
  908. in the list because it is required for bind_paraitem.
  909. Generate a nothign to keep callparanoed.left valid }
  910. oldleft.left.free;
  911. oldleft.left:=cnothingnode.create;
  912. end;
  913. procedure tcallnode.verifyabstract(p : tnamedindexitem;arg:pointer);
  914. var
  915. hp : tprocdef;
  916. j: integer;
  917. begin
  918. if (tsym(p).typ=procsym) then
  919. begin
  920. for j:=1 to tprocsym(p).procdef_count do
  921. begin
  922. { index starts at 1 }
  923. hp:=tprocsym(p).procdef[j];
  924. { If this is an abstract method insert into the list }
  925. if (po_abstractmethod in hp.procoptions) then
  926. AbstractMethodsList.Insert(hp.procsym.realname)
  927. else
  928. { If this symbol is a virtual (includes override) method,
  929. then remove it from the list }
  930. if po_virtualmethod in hp.procoptions then
  931. AbstractMethodsList.Remove(hp.procsym.realname);
  932. end;
  933. end;
  934. end;
  935. procedure tcallnode.verifyabstractcalls;
  936. var
  937. objectdf : tobjectdef;
  938. parents : tlinkedlist;
  939. objectinfo : tobjectinfoitem;
  940. stritem : tstringlistitem;
  941. begin
  942. objectdf := nil;
  943. { verify if trying to create an instance of a class which contains
  944. non-implemented abstract methods }
  945. { first verify this class type, no class than exit }
  946. { also, this checking can only be done if the constructor is directly
  947. called, indirect constructor calls cannot be checked.
  948. }
  949. if assigned(methodpointer) then
  950. begin
  951. if (methodpointer.resulttype.def.deftype = objectdef) then
  952. objectdf:=tobjectdef(methodpointer.resulttype.def)
  953. else
  954. if (methodpointer.resulttype.def.deftype = classrefdef) and
  955. (tclassrefdef(methodpointer.resulttype.def).pointertype.def.deftype = objectdef) and
  956. (methodpointer.nodetype in [typen,loadvmtaddrn]) then
  957. objectdf:=tobjectdef(tclassrefdef(methodpointer.resulttype.def).pointertype.def);
  958. end;
  959. if not assigned(objectdf) then
  960. exit;
  961. parents := tlinkedlist.create;
  962. AbstractMethodsList := tstringlist.create;
  963. { insert all parents in this class : the first item in the
  964. list will be the base parent of the class .
  965. }
  966. while assigned(objectdf) do
  967. begin
  968. objectinfo:=tobjectinfoitem.create(objectdf);
  969. parents.insert(objectinfo);
  970. objectdf := objectdf.childof;
  971. end;
  972. { now all parents are in the correct order
  973. insert all abstract methods in the list, and remove
  974. those which are overriden by parent classes.
  975. }
  976. objectinfo:=tobjectinfoitem(parents.first);
  977. while assigned(objectinfo) do
  978. begin
  979. objectdf := objectinfo.objinfo;
  980. if assigned(objectdf.symtable) then
  981. objectdf.symtable.foreach(@verifyabstract,nil);
  982. objectinfo:=tobjectinfoitem(objectinfo.next);
  983. end;
  984. if assigned(parents) then
  985. parents.free;
  986. { Finally give out a warning for each abstract method still in the list }
  987. stritem := tstringlistitem(AbstractMethodsList.first);
  988. if assigned(stritem) then
  989. Message1(type_w_instance_with_abstract,objectdf.objrealname^);
  990. while assigned(stritem) do
  991. begin
  992. if assigned(stritem.fpstr) then
  993. Message1(sym_h_param_list,stritem.str);
  994. stritem := tstringlistitem(stritem.next);
  995. end;
  996. if assigned(AbstractMethodsList) then
  997. AbstractMethodsList.Free;
  998. end;
  999. function tcallnode.gen_self_tree_methodpointer:tnode;
  1000. var
  1001. hsym : tvarsym;
  1002. begin
  1003. { find self field in methodpointer record }
  1004. hsym:=tvarsym(trecorddef(methodpointertype.def).symtable.search('self'));
  1005. if not assigned(hsym) then
  1006. internalerror(200305251);
  1007. { Load tmehodpointer(right).self }
  1008. result:=csubscriptnode.create(
  1009. hsym,
  1010. ctypeconvnode.create_explicit(right.getcopy,methodpointertype));
  1011. end;
  1012. function tcallnode.gen_self_tree:tnode;
  1013. var
  1014. selftree : tnode;
  1015. begin
  1016. selftree:=nil;
  1017. { inherited }
  1018. if (cnf_inherited in callnodeflags) then
  1019. selftree:=load_self_node
  1020. else
  1021. { constructors }
  1022. if (procdefinition.proctypeoption=potype_constructor) then
  1023. begin
  1024. { push 0 as self when allocation is needed }
  1025. if (methodpointer.resulttype.def.deftype=classrefdef) or
  1026. (cnf_new_call in callnodeflags) then
  1027. selftree:=cpointerconstnode.create(0,voidpointertype)
  1028. else
  1029. begin
  1030. if methodpointer.nodetype=typen then
  1031. selftree:=load_self_node
  1032. else
  1033. selftree:=methodpointer.getcopy;
  1034. end;
  1035. end
  1036. else
  1037. { Calling a static/class method }
  1038. if (po_classmethod in procdefinition.procoptions) or
  1039. (po_staticmethod in procdefinition.procoptions) then
  1040. begin
  1041. if (procdefinition.deftype<>procdef) then
  1042. internalerror(200305062);
  1043. if (oo_has_vmt in tprocdef(procdefinition)._class.objectoptions) then
  1044. begin
  1045. { we only need the vmt, loading self is not required and there is no
  1046. need to check for typen, because that will always get the
  1047. loadvmtaddrnode added }
  1048. selftree:=methodpointer.getcopy;
  1049. if methodpointer.resulttype.def.deftype<>classrefdef then
  1050. selftree:=cloadvmtaddrnode.create(selftree);
  1051. end
  1052. else
  1053. selftree:=cpointerconstnode.create(0,voidpointertype);
  1054. end
  1055. else
  1056. begin
  1057. if methodpointer.nodetype=typen then
  1058. selftree:=load_self_node
  1059. else
  1060. selftree:=methodpointer.getcopy;
  1061. end;
  1062. result:=selftree;
  1063. end;
  1064. function tcallnode.gen_vmt_tree:tnode;
  1065. var
  1066. vmttree : tnode;
  1067. begin
  1068. vmttree:=nil;
  1069. if not(procdefinition.proctypeoption in [potype_constructor,potype_destructor]) then
  1070. internalerror(200305051);
  1071. { inherited call, no create/destroy }
  1072. if (cnf_inherited in callnodeflags) then
  1073. vmttree:=cpointerconstnode.create(0,voidpointertype)
  1074. else
  1075. { do not create/destroy when called from member function
  1076. without specifying self explicit }
  1077. if (cnf_member_call in callnodeflags) then
  1078. begin
  1079. if (methodpointer.resulttype.def.deftype=classrefdef) and
  1080. (procdefinition.proctypeoption=potype_constructor) then
  1081. vmttree:=methodpointer.getcopy
  1082. else
  1083. vmttree:=cpointerconstnode.create(0,voidpointertype);
  1084. end
  1085. else
  1086. { constructor with extended syntax called from new }
  1087. if (cnf_new_call in callnodeflags) then
  1088. vmttree:=cloadvmtaddrnode.create(ctypenode.create(methodpointer.resulttype))
  1089. else
  1090. { destructor with extended syntax called from dispose }
  1091. if (cnf_dispose_call in callnodeflags) then
  1092. vmttree:=cloadvmtaddrnode.create(methodpointer.getcopy)
  1093. else
  1094. if (methodpointer.resulttype.def.deftype=classrefdef) then
  1095. begin
  1096. { constructor call via classreference => allocate memory }
  1097. if (procdefinition.proctypeoption=potype_constructor) and
  1098. is_class(tclassrefdef(methodpointer.resulttype.def).pointertype.def) then
  1099. begin
  1100. vmttree:=methodpointer.getcopy;
  1101. { Only a typenode can be passed when it is called with <class of xx>.create }
  1102. if vmttree.nodetype=typen then
  1103. vmttree:=cloadvmtaddrnode.create(vmttree);
  1104. end
  1105. else
  1106. vmttree:=cpointerconstnode.create(0,voidpointertype);
  1107. end
  1108. else
  1109. { class }
  1110. if is_class(methodpointer.resulttype.def) then
  1111. begin
  1112. { destructor: release instance, flag(vmt)=1
  1113. constructor: direct call, do nothing, leave vmt=0 }
  1114. if (procdefinition.proctypeoption=potype_destructor) then
  1115. vmttree:=cpointerconstnode.create(1,voidpointertype)
  1116. else
  1117. vmttree:=cpointerconstnode.create(0,voidpointertype);
  1118. end
  1119. else
  1120. { object }
  1121. begin
  1122. { destructor: direct call, no dispose, vmt=0
  1123. constructor: initialize object, load vmt }
  1124. if (procdefinition.proctypeoption=potype_constructor) then
  1125. { old styled inherited call? }
  1126. if (methodpointer.nodetype=typen) then
  1127. vmttree:=cpointerconstnode.create(0,voidpointertype)
  1128. else
  1129. vmttree:=cloadvmtaddrnode.create(ctypenode.create(methodpointer.resulttype))
  1130. else
  1131. vmttree:=cpointerconstnode.create(0,voidpointertype);
  1132. end;
  1133. result:=vmttree;
  1134. end;
  1135. procedure tcallnode.bind_paraitem;
  1136. var
  1137. i : integer;
  1138. pt : tcallparanode;
  1139. oldppt : ^tcallparanode;
  1140. varargspara,
  1141. currpara : tparaitem;
  1142. used_by_callnode : boolean;
  1143. hiddentree : tnode;
  1144. newstatement : tstatementnode;
  1145. temp : ttempcreatenode;
  1146. begin
  1147. pt:=tcallparanode(left);
  1148. oldppt:=@left;
  1149. { flag all callparanodes that belong to the varargs }
  1150. i:=paralength;
  1151. while (i>procdefinition.maxparacount) do
  1152. begin
  1153. include(pt.callparaflags,cpf_varargs_para);
  1154. oldppt:[email protected];
  1155. pt:=tcallparanode(pt.right);
  1156. dec(i);
  1157. end;
  1158. { skip varargs that are inserted by array of const }
  1159. while assigned(pt) and
  1160. (cpf_varargs_para in pt.callparaflags) do
  1161. pt:=tcallparanode(pt.right);
  1162. { process normal parameters and insert hidden parameters }
  1163. currpara:=tparaitem(procdefinition.Para.last);
  1164. while assigned(currpara) do
  1165. begin
  1166. if currpara.is_hidden then
  1167. begin
  1168. { generate hidden tree }
  1169. used_by_callnode:=false;
  1170. hiddentree:=nil;
  1171. if (vo_is_funcret in tvarsym(currpara.parasym).varoptions) then
  1172. begin
  1173. { Generate funcretnode if not specified }
  1174. if assigned(funcretnode) then
  1175. begin
  1176. hiddentree:=funcretnode.getcopy;
  1177. end
  1178. else
  1179. begin
  1180. hiddentree:=internalstatements(newstatement);
  1181. { need to use resulttype instead of procdefinition.rettype,
  1182. because they can be different }
  1183. temp:=ctempcreatenode.create(resulttype,resulttype.def.size,tt_persistent);
  1184. addstatement(newstatement,temp);
  1185. addstatement(newstatement,ctempdeletenode.create_normal_temp(temp));
  1186. addstatement(newstatement,ctemprefnode.create(temp));
  1187. end;
  1188. end
  1189. else
  1190. if vo_is_high_value in tvarsym(currpara.parasym).varoptions then
  1191. begin
  1192. if not assigned(pt) then
  1193. internalerror(200304082);
  1194. { we need the information of the previous parameter }
  1195. hiddentree:=gen_high_tree(pt.left,tparaitem(currpara.previous).paratype.def);
  1196. end
  1197. else
  1198. if vo_is_self in tvarsym(currpara.parasym).varoptions then
  1199. begin
  1200. if assigned(right) then
  1201. hiddentree:=gen_self_tree_methodpointer
  1202. else
  1203. hiddentree:=gen_self_tree;
  1204. end
  1205. else
  1206. if vo_is_vmt in tvarsym(currpara.parasym).varoptions then
  1207. begin
  1208. hiddentree:=gen_vmt_tree;
  1209. end
  1210. else
  1211. if vo_is_parentfp in tvarsym(currpara.parasym).varoptions then
  1212. begin
  1213. if not(assigned(procdefinition.owner.defowner)) then
  1214. internalerror(200309287);
  1215. hiddentree:=cloadparentfpnode.create(tprocdef(procdefinition.owner.defowner));
  1216. end
  1217. {$ifdef powerpc}
  1218. else
  1219. { lib parameter has no special type but proccalloptions must be a syscall }
  1220. if (target_info.system in [system_powerpc_morphos,system_m68k_amiga]) and
  1221. (procdefinition.proccalloption=pocall_syscall) then
  1222. begin
  1223. hiddentree:=cloadnode.create(tprocdef(procdefinition).libsym,tprocdef(procdefinition).libsym.owner);
  1224. end
  1225. {$endif powerpc}
  1226. else
  1227. { add the hidden parameter }
  1228. if not assigned(hiddentree) then
  1229. internalerror(200304073);
  1230. { Already insert para and let the previous node point to
  1231. this new node }
  1232. pt:=ccallparanode.create(hiddentree,oldppt^);
  1233. pt.used_by_callnode:=used_by_callnode;
  1234. oldppt^:=pt;
  1235. end;
  1236. if not assigned(pt) then
  1237. internalerror(200310052);
  1238. pt.paraitem:=currpara;
  1239. oldppt:[email protected];
  1240. pt:=tcallparanode(pt.right);
  1241. currpara:=tparaitem(currpara.previous)
  1242. end;
  1243. { Create paraitems for varargs }
  1244. pt:=tcallparanode(left);
  1245. while assigned(pt) do
  1246. begin
  1247. if cpf_varargs_para in pt.callparaflags then
  1248. begin
  1249. if not assigned(varargsparas) then
  1250. varargsparas:=tvarargspara.create;
  1251. varargspara:=tparaitem.create;
  1252. varargspara.paratyp:=vs_value;
  1253. varargspara.paratype:=pt.resulttype;
  1254. { varargspara is left-right, use insert
  1255. instead of concat }
  1256. varargsparas.insert(varargspara);
  1257. pt.paraitem:=varargspara;
  1258. end;
  1259. pt:=tcallparanode(pt.right);
  1260. end;
  1261. end;
  1262. function tcallnode.det_resulttype:tnode;
  1263. var
  1264. candidates : tcallcandidates;
  1265. oldcallnode : tcallnode;
  1266. hpt : tnode;
  1267. pt : tcallparanode;
  1268. lastpara : longint;
  1269. currpara : tparaitem;
  1270. cand_cnt : integer;
  1271. i : longint;
  1272. method_must_be_valid,
  1273. is_const : boolean;
  1274. label
  1275. errorexit;
  1276. begin
  1277. result:=nil;
  1278. candidates:=nil;
  1279. oldcallnode:=aktcallnode;
  1280. aktcallnode:=self;
  1281. { determine length of parameter list }
  1282. pt:=tcallparanode(left);
  1283. paralength:=0;
  1284. while assigned(pt) do
  1285. begin
  1286. inc(paralength);
  1287. pt:=tcallparanode(pt.right);
  1288. end;
  1289. { determine the type of the parameters }
  1290. if assigned(left) then
  1291. begin
  1292. tcallparanode(left).get_paratype;
  1293. if codegenerror then
  1294. goto errorexit;
  1295. end;
  1296. if assigned(methodpointer) then
  1297. begin
  1298. resulttypepass(methodpointer);
  1299. maybe_load_para_in_temp(methodpointer);
  1300. end;
  1301. { procedure variable ? }
  1302. if assigned(right) then
  1303. begin
  1304. set_varstate(right,vs_used,true);
  1305. resulttypepass(right);
  1306. if codegenerror then
  1307. exit;
  1308. procdefinition:=tabstractprocdef(right.resulttype.def);
  1309. { Compare parameters from right to left }
  1310. currpara:=tparaitem(procdefinition.Para.last);
  1311. { Skip default parameters }
  1312. if not(po_varargs in procdefinition.procoptions) then
  1313. begin
  1314. { ignore hidden parameters }
  1315. while assigned(currpara) and (currpara.is_hidden) do
  1316. currpara:=tparaitem(currpara.previous);
  1317. for i:=1 to procdefinition.maxparacount-paralength do
  1318. begin
  1319. if not assigned(currpara) then
  1320. internalerror(200402261);
  1321. if not assigned(currpara.defaultvalue) then
  1322. begin
  1323. CGMessage(parser_e_wrong_parameter_size);
  1324. goto errorexit;
  1325. end;
  1326. currpara:=tparaitem(currpara.previous);
  1327. end;
  1328. end;
  1329. while assigned(currpara) and (currpara.is_hidden) do
  1330. currpara:=tparaitem(currpara.previous);
  1331. pt:=tcallparanode(left);
  1332. lastpara:=paralength;
  1333. while assigned(currpara) and assigned(pt) do
  1334. begin
  1335. { only goto next para if we're out of the varargs }
  1336. if not(po_varargs in procdefinition.procoptions) or
  1337. (lastpara<=procdefinition.maxparacount) then
  1338. begin
  1339. repeat
  1340. currpara:=tparaitem(currpara.previous);
  1341. until (not assigned(currpara)) or (not currpara.is_hidden);
  1342. end;
  1343. pt:=tcallparanode(pt.right);
  1344. dec(lastpara);
  1345. end;
  1346. if assigned(pt) or
  1347. (assigned(currpara) and
  1348. not assigned(currpara.defaultvalue)) then
  1349. begin
  1350. if assigned(pt) then
  1351. aktfilepos:=pt.fileinfo;
  1352. CGMessage(parser_e_wrong_parameter_size);
  1353. goto errorexit;
  1354. end;
  1355. end
  1356. else
  1357. { not a procedure variable }
  1358. begin
  1359. { do we know the procedure to call ? }
  1360. if not(assigned(procdefinition)) then
  1361. begin
  1362. candidates:=tcallcandidates.create(symtableprocentry,symtableproc,left,(nf_isproperty in flags));
  1363. { no procedures found? then there is something wrong
  1364. with the parameter size or the procedures are
  1365. not accessible }
  1366. if candidates.count=0 then
  1367. begin
  1368. { when it's an auto inherited call and there
  1369. is no procedure found, but the procedures
  1370. were defined with overload directive and at
  1371. least two procedures are defined then we ignore
  1372. this inherited by inserting a nothingn. Only
  1373. do this ugly hack in Delphi mode as it looks more
  1374. like a bug. It's also not documented }
  1375. if (m_delphi in aktmodeswitches) and
  1376. (cnf_anon_inherited in callnodeflags) and
  1377. (symtableprocentry.owner.symtabletype=objectsymtable) and
  1378. (po_overload in symtableprocentry.first_procdef.procoptions) and
  1379. (symtableprocentry.procdef_count>=2) then
  1380. result:=cnothingnode.create
  1381. else
  1382. begin
  1383. { in tp mode we can try to convert to procvar if
  1384. there are no parameters specified. Only try it
  1385. when there is only one proc definition, else the
  1386. loadnode will give a strange error }
  1387. if not(assigned(left)) and
  1388. not(cnf_inherited in callnodeflags) and
  1389. (m_tp_procvar in aktmodeswitches) and
  1390. (symtableprocentry.procdef_count=1) then
  1391. begin
  1392. hpt:=cloadnode.create(tprocsym(symtableprocentry),symtableproc);
  1393. if assigned(methodpointer) then
  1394. tloadnode(hpt).set_mp(methodpointer.getcopy);
  1395. resulttypepass(hpt);
  1396. result:=hpt;
  1397. end
  1398. else
  1399. begin
  1400. if assigned(left) then
  1401. aktfilepos:=left.fileinfo;
  1402. CGMessage(parser_e_wrong_parameter_size);
  1403. symtableprocentry.write_parameter_lists(nil);
  1404. end;
  1405. end;
  1406. goto errorexit;
  1407. end;
  1408. { Retrieve information about the candidates }
  1409. candidates.get_information;
  1410. {$ifdef EXTDEBUG}
  1411. { Display info when multiple candidates are found }
  1412. if candidates.count>1 then
  1413. candidates.dump_info(V_Debug);
  1414. {$endif EXTDEBUG}
  1415. { Choose the best candidate and count the number of
  1416. candidates left }
  1417. cand_cnt:=candidates.choose_best(procdefinition);
  1418. { All parameters are checked, check if there are any
  1419. procedures left }
  1420. if cand_cnt>0 then
  1421. begin
  1422. { Multiple candidates left? }
  1423. if cand_cnt>1 then
  1424. begin
  1425. CGMessage(type_e_cant_choose_overload_function);
  1426. {$ifdef EXTDEBUG}
  1427. candidates.dump_info(V_Hint);
  1428. {$else EXTDEBUG}
  1429. candidates.list(false);
  1430. {$endif EXTDEBUG}
  1431. { we'll just use the first candidate to make the
  1432. call }
  1433. end;
  1434. { assign procdefinition }
  1435. if symtableproc=nil then
  1436. symtableproc:=procdefinition.owner;
  1437. { update browser information }
  1438. if make_ref then
  1439. begin
  1440. tprocdef(procdefinition).lastref:=tref.create(tprocdef(procdefinition).lastref,@fileinfo);
  1441. inc(tprocdef(procdefinition).refcount);
  1442. if tprocdef(procdefinition).defref=nil then
  1443. tprocdef(procdefinition).defref:=tprocdef(procdefinition).lastref;
  1444. end;
  1445. end
  1446. else
  1447. begin
  1448. { No candidates left, this must be a type error,
  1449. because wrong size is already checked. procdefinition
  1450. is filled with the first (random) definition that is
  1451. found. We use this definition to display a nice error
  1452. message that the wrong type is passed }
  1453. candidates.find_wrong_para;
  1454. candidates.list(true);
  1455. {$ifdef EXTDEBUG}
  1456. candidates.dump_info(V_Hint);
  1457. {$endif EXTDEBUG}
  1458. { We can not proceed, release all procs and exit }
  1459. candidates.free;
  1460. goto errorexit;
  1461. end;
  1462. candidates.free;
  1463. end; { end of procedure to call determination }
  1464. end;
  1465. { add needed default parameters }
  1466. if assigned(procdefinition) and
  1467. (paralength<procdefinition.maxparacount) then
  1468. begin
  1469. currpara:=tparaitem(procdefinition.Para.first);
  1470. i:=0;
  1471. while (i<paralength) do
  1472. begin
  1473. if not assigned(currpara) then
  1474. internalerror(200306181);
  1475. if not currpara.is_hidden then
  1476. inc(i);
  1477. currpara:=tparaitem(currpara.next);
  1478. end;
  1479. while assigned(currpara) and currpara.is_hidden do
  1480. currpara:=tparaitem(currpara.next);
  1481. while assigned(currpara) do
  1482. begin
  1483. if not assigned(currpara.defaultvalue) then
  1484. internalerror(200212142);
  1485. left:=ccallparanode.create(genconstsymtree(tconstsym(currpara.defaultvalue)),left);
  1486. { Ignore vs_hidden parameters }
  1487. repeat
  1488. currpara:=tparaitem(currpara.next);
  1489. until (not assigned(currpara)) or (not currpara.is_hidden);
  1490. end;
  1491. end;
  1492. { handle predefined procedures }
  1493. is_const:=(po_internconst in procdefinition.procoptions) and
  1494. ((block_type in [bt_const,bt_type]) or
  1495. (assigned(left) and (tcallparanode(left).left.nodetype in [realconstn,ordconstn])));
  1496. if (procdefinition.proccalloption=pocall_internproc) or is_const then
  1497. begin
  1498. if assigned(left) then
  1499. begin
  1500. { ptr and settextbuf needs two args }
  1501. if assigned(tcallparanode(left).right) then
  1502. begin
  1503. hpt:=geninlinenode(tprocdef(procdefinition).extnumber,is_const,left);
  1504. left:=nil;
  1505. end
  1506. else
  1507. begin
  1508. hpt:=geninlinenode(tprocdef(procdefinition).extnumber,is_const,tcallparanode(left).left);
  1509. tcallparanode(left).left:=nil;
  1510. end;
  1511. end
  1512. else
  1513. hpt:=geninlinenode(tprocdef(procdefinition).extnumber,is_const,nil);
  1514. result:=hpt;
  1515. goto errorexit;
  1516. end;
  1517. { ensure that the result type is set }
  1518. if not(cnf_restypeset in callnodeflags) then
  1519. begin
  1520. { constructors return their current class type, not the type where the
  1521. constructor is declared, this can be different because of inheritance }
  1522. if (procdefinition.proctypeoption=potype_constructor) and
  1523. assigned(methodpointer) and
  1524. assigned(methodpointer.resulttype.def) and
  1525. (methodpointer.resulttype.def.deftype=classrefdef) then
  1526. resulttype:=tclassrefdef(methodpointer.resulttype.def).pointertype
  1527. else
  1528. resulttype:=procdefinition.rettype;
  1529. end
  1530. else
  1531. resulttype:=restype;
  1532. {if resulttype.def.needs_inittable then
  1533. include(current_procinfo.flags,pi_needs_implicit_finally);}
  1534. if assigned(methodpointer) then
  1535. begin
  1536. { when methodpointer is a callnode we must load it first into a
  1537. temp to prevent the processing callnode twice }
  1538. if (methodpointer.nodetype=calln) then
  1539. internalerror(200405121);
  1540. { direct call to inherited abstract method, then we
  1541. can already give a error in the compiler instead
  1542. of a runtime error }
  1543. if (cnf_inherited in callnodeflags) and
  1544. (po_abstractmethod in procdefinition.procoptions) then
  1545. CGMessage(cg_e_cant_call_abstract_method);
  1546. { if an inherited con- or destructor should be }
  1547. { called in a con- or destructor then a warning }
  1548. { will be made }
  1549. { con- and destructors need a pointer to the vmt }
  1550. if (cnf_inherited in callnodeflags) and
  1551. (procdefinition.proctypeoption in [potype_constructor,potype_destructor]) and
  1552. is_object(methodpointer.resulttype.def) and
  1553. not(current_procinfo.procdef.proctypeoption in [potype_constructor,potype_destructor]) then
  1554. CGMessage(cg_w_member_cd_call_from_method);
  1555. if methodpointer.nodetype<>typen then
  1556. begin
  1557. { Remove all postfix operators }
  1558. hpt:=methodpointer;
  1559. while assigned(hpt) and (hpt.nodetype in [subscriptn,vecn]) do
  1560. hpt:=tunarynode(hpt).left;
  1561. if (procdefinition.proctypeoption=potype_constructor) and
  1562. assigned(symtableproc) and
  1563. (symtableproc.symtabletype=withsymtable) and
  1564. (tnode(twithsymtable(symtableproc).withrefnode).nodetype=temprefn) then
  1565. CGmessage(cg_e_cannot_call_cons_dest_inside_with);
  1566. { R.Init then R will be initialized by the constructor,
  1567. Also allow it for simple loads }
  1568. if (procdefinition.proctypeoption=potype_constructor) or
  1569. ((hpt.nodetype=loadn) and
  1570. (
  1571. (methodpointer.resulttype.def.deftype=classrefdef) or
  1572. (
  1573. (methodpointer.resulttype.def.deftype=objectdef) and
  1574. not(oo_has_virtual in tobjectdef(methodpointer.resulttype.def).objectoptions)
  1575. )
  1576. )
  1577. ) then
  1578. method_must_be_valid:=false
  1579. else
  1580. method_must_be_valid:=true;
  1581. set_varstate(methodpointer,vs_used,method_must_be_valid);
  1582. { The object is already used if it is called once }
  1583. if (hpt.nodetype=loadn) and
  1584. (tloadnode(hpt).symtableentry.typ=varsym) then
  1585. tvarsym(tloadnode(hpt).symtableentry).varstate:=vs_used;
  1586. end;
  1587. { if we are calling the constructor check for abstract
  1588. methods. Ignore inherited and member calls, because the
  1589. class is then already created }
  1590. if (procdefinition.proctypeoption=potype_constructor) and
  1591. not(cnf_inherited in callnodeflags) and
  1592. not(cnf_member_call in callnodeflags) then
  1593. verifyabstractcalls;
  1594. end
  1595. else
  1596. begin
  1597. { When this is method the methodpointer must be available }
  1598. if (right=nil) and
  1599. (procdefinition.owner.symtabletype=objectsymtable) then
  1600. internalerror(200305061);
  1601. end;
  1602. { Change loading of array of const to varargs }
  1603. if assigned(left) and
  1604. is_array_of_const(tparaitem(procdefinition.para.last).paratype.def) and
  1605. (procdefinition.proccalloption in [pocall_cppdecl,pocall_cdecl]) then
  1606. convert_carg_array_of_const;
  1607. { bind paraitems to the callparanodes and insert hidden parameters }
  1608. bind_paraitem;
  1609. { methodpointer is only needed for virtual calls, and
  1610. it should then be loaded with the VMT }
  1611. if (po_virtualmethod in procdefinition.procoptions) and
  1612. not(assigned(methodpointer) and
  1613. (methodpointer.nodetype=typen)) then
  1614. begin
  1615. if not assigned(methodpointer) then
  1616. internalerror(200305063);
  1617. if (methodpointer.resulttype.def.deftype<>classrefdef) then
  1618. begin
  1619. methodpointer:=cloadvmtaddrnode.create(methodpointer);
  1620. resulttypepass(methodpointer);
  1621. end;
  1622. end
  1623. else
  1624. begin
  1625. { not needed anymore }
  1626. methodpointer.free;
  1627. methodpointer:=nil;
  1628. end;
  1629. { insert type conversions for parameters }
  1630. if assigned(left) then
  1631. tcallparanode(left).insert_typeconv(true);
  1632. errorexit:
  1633. aktcallnode:=oldcallnode;
  1634. end;
  1635. procedure tcallnode.order_parameters;
  1636. var
  1637. hp,hpcurr,hpnext,hpfirst,hpprev : tcallparanode;
  1638. currloc : tcgloc;
  1639. begin
  1640. hpfirst:=nil;
  1641. hpcurr:=tcallparanode(left);
  1642. while assigned(hpcurr) do
  1643. begin
  1644. { pull out }
  1645. hpnext:=tcallparanode(hpcurr.right);
  1646. { pull in at the correct place.
  1647. Used order:
  1648. 1. LOC_REFERENCE with smallest offset (x86 only)
  1649. 2. LOC_REFERENCE with most registers
  1650. 3. LOC_REGISTER with most registers
  1651. For the moment we only look at the first parameter field. Combining it
  1652. with multiple parameter fields will make things a lot complexer (PFV) }
  1653. currloc:=hpcurr.paraitem.paraloc[callerside].location^.loc;
  1654. hpprev:=nil;
  1655. hp:=hpfirst;
  1656. while assigned(hp) do
  1657. begin
  1658. case currloc of
  1659. LOC_REFERENCE :
  1660. begin
  1661. case hp.paraitem.paraloc[callerside].location^.loc of
  1662. LOC_REFERENCE :
  1663. begin
  1664. { Offset is calculated like:
  1665. sub esp,12
  1666. mov [esp+8],para3
  1667. mov [esp+4],para2
  1668. mov [esp],para1
  1669. call function
  1670. That means the for pushes the para with the
  1671. highest offset (see para3) needs to be pushed first
  1672. }
  1673. if (hpcurr.registersint>hp.registersint)
  1674. {$ifdef x86}
  1675. or (hpcurr.paraitem.paraloc[callerside].location^.reference.offset>hp.paraitem.paraloc[callerside].location^.reference.offset)
  1676. {$endif x86}
  1677. then
  1678. break;
  1679. end;
  1680. LOC_REGISTER,
  1681. LOC_FPUREGISTER :
  1682. break;
  1683. end;
  1684. end;
  1685. LOC_FPUREGISTER,
  1686. LOC_REGISTER :
  1687. begin
  1688. if (hp.paraitem.paraloc[callerside].location^.loc=currloc) and
  1689. (hpcurr.registersint>hp.registersint) then
  1690. break;
  1691. end;
  1692. end;
  1693. hpprev:=hp;
  1694. hp:=tcallparanode(hp.right);
  1695. end;
  1696. hpcurr.right:=hp;
  1697. if assigned(hpprev) then
  1698. hpprev.right:=hpcurr
  1699. else
  1700. hpfirst:=hpcurr;
  1701. { next }
  1702. hpcurr:=hpnext;
  1703. end;
  1704. left:=hpfirst;
  1705. end;
  1706. function tcallnode.replaceparaload(var n: tnode; arg: pointer): foreachnoderesult;
  1707. var
  1708. paras: tcallparanode;
  1709. temp: tnode;
  1710. begin
  1711. result := fen_false;
  1712. n.fileinfo := pfileposinfo(arg)^;
  1713. if (n.nodetype = loadn) then
  1714. begin
  1715. paras := tcallparanode(left);
  1716. while assigned(paras) and
  1717. (paras.paraitem.parasym <> tloadnode(n).symtableentry) do
  1718. paras := tcallparanode(paras.right);
  1719. if assigned(paras) then
  1720. begin
  1721. n.free;
  1722. n := paras.left.getcopy;
  1723. resulttypepass(n);
  1724. result := fen_true;
  1725. end
  1726. {$ifndef VER1_0}
  1727. else
  1728. begin
  1729. { local? }
  1730. if (tloadnode(n).symtableentry.typ <> varsym) or
  1731. (tloadnode(n).symtableentry.owner <> tprocdef(procdefinition).localst) then
  1732. exit;
  1733. if (tloadnode(n).symtableentry.indexnr > high(inlinelocals)) or
  1734. not assigned(inlinelocals[tloadnode(n).symtableentry.indexnr]) then
  1735. internalerror(20040720);
  1736. temp := inlinelocals[tloadnode(n).symtableentry.indexnr].getcopy;
  1737. n.free;
  1738. n := temp;
  1739. resulttypepass(n);
  1740. result := fen_true;
  1741. end;
  1742. {$endif ndef VER1_0}
  1743. end;
  1744. end;
  1745. {$ifndef VER1_0}
  1746. type
  1747. ptempnodes = ^ttempnodes;
  1748. ttempnodes = record
  1749. createstatement, deletestatement: tstatementnode;
  1750. end;
  1751. procedure tcallnode.createlocaltemps(p:TNamedIndexItem;arg:pointer);
  1752. var
  1753. tempinfo: ptempnodes absolute ptempnodes(arg);
  1754. tempnode: ttempcreatenode;
  1755. begin
  1756. if (tsymentry(p).typ <> varsym) then
  1757. exit;
  1758. if (p.indexnr > high(inlinelocals)) then
  1759. setlength(inlinelocals,p.indexnr+10);
  1760. {$ifndef VER1_0}
  1761. if (vo_is_funcret in tvarsym(p).varoptions) and
  1762. assigned(funcretnode) then
  1763. begin
  1764. if node_complexity(funcretnode) > 1 then
  1765. begin
  1766. { can this happen? }
  1767. { we may have to replace the funcretnode with the address of funcretnode }
  1768. { loaded in a temp in this case, because the expression may e.g. contain }
  1769. { a global variable that gets changed inside the function }
  1770. internalerror(2004072101);
  1771. end;
  1772. inlinelocals[tvarsym(p).indexnr] := funcretnode.getcopy
  1773. end
  1774. else
  1775. {$endif ndef VER1_0}
  1776. begin
  1777. if (cs_regvars in aktglobalswitches) and
  1778. (tvarsym(p).varregable<>vr_none) and
  1779. (not tvarsym(p).vartype.def.needs_inittable) then
  1780. tempnode := ctempcreatenode.create_reg(tvarsym(p).vartype,tvarsym(p).vartype.def.size,tt_persistent)
  1781. else
  1782. tempnode := ctempcreatenode.create(tvarsym(p).vartype,tvarsym(p).vartype.def.size,tt_persistent);
  1783. addstatement(tempinfo^.createstatement,tempnode);
  1784. if assigned(tvarsym(p).defaultconstsym) then
  1785. begin
  1786. { warning: duplicate from psub.pas:initializevars() -> must refactor }
  1787. addstatement(tempinfo^.createstatement,cassignmentnode.create(
  1788. ctemprefnode.create(tempnode),
  1789. cloadnode.create(tvarsym(p).defaultconstsym,tvarsym(p).defaultconstsym.owner)));
  1790. end;
  1791. if (vo_is_funcret in tvarsym(p).varoptions) then
  1792. begin
  1793. funcretnode := ctemprefnode.create(tempnode);
  1794. addstatement(tempinfo^.deletestatement,ctempdeletenode.create_normal_temp(tempnode));
  1795. end
  1796. else
  1797. addstatement(tempinfo^.deletestatement,ctempdeletenode.create(tempnode));
  1798. inlinelocals[p.indexnr] := ctemprefnode.create(tempnode);
  1799. end;
  1800. end;
  1801. {$endif ndef VER1_0}
  1802. procedure tcallnode.createinlineparas(var createstatement, deletestatement: tstatementnode);
  1803. var
  1804. para: tcallparanode;
  1805. tempnode: ttempcreatenode;
  1806. hp: tnode;
  1807. {$ifndef VER1_0}
  1808. tempnodes: ttempnodes;
  1809. {$endif ndef VER1_0}
  1810. begin
  1811. { parameters }
  1812. para := tcallparanode(left);
  1813. while assigned(para) do
  1814. begin
  1815. if (para.paraitem.parasym.typ = varsym) and
  1816. { para.left will already be the same as funcretnode in the following case, so don't change }
  1817. (not(vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) or
  1818. (not assigned(funcretnode))) then
  1819. begin
  1820. { create temps for value parameters, function result and also for }
  1821. { const parameters which are passed by value instead of by reference }
  1822. if (vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) or
  1823. (para.paraitem.paratyp = vs_value) or
  1824. ((para.paraitem.paratyp = vs_const) and
  1825. (not paramanager.push_addr_param(vs_const,para.left.resulttype.def,procdefinition.proccalloption) or
  1826. { the problem is that we can't take the address of a function result :( }
  1827. (node_complexity(para.left) >= NODE_COMPLEXITY_INF))) then
  1828. begin
  1829. if (cs_regvars in aktglobalswitches) and
  1830. (tvarsym(para.paraitem.parasym).varregable<>vr_none) and
  1831. (not tvarsym(para.paraitem.parasym).vartype.def.needs_inittable) then
  1832. tempnode := ctempcreatenode.create_reg(para.left.resulttype,para.left.resulttype.def.size,tt_persistent)
  1833. else
  1834. tempnode := ctempcreatenode.create(para.left.resulttype,para.left.resulttype.def.size,tt_persistent);
  1835. addstatement(createstatement,tempnode);
  1836. { assign the value of the parameter to the temp, except in case of the function result }
  1837. { (in that case, para.left is a block containing the creation of a new temp, while we }
  1838. { only need a temprefnode, so delete the old stuff) }
  1839. if not(vo_is_funcret in tvarsym(para.paraitem.parasym).varoptions) then
  1840. begin
  1841. addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
  1842. para.left));
  1843. para.left := ctemprefnode.create(tempnode);
  1844. addstatement(deletestatement,ctempdeletenode.create(tempnode));
  1845. end
  1846. else
  1847. begin
  1848. if not(assigned(funcretnode)) then
  1849. funcretnode := ctemprefnode.create(tempnode);
  1850. para.left.free;
  1851. para.left := ctemprefnode.create(tempnode);
  1852. addstatement(deletestatement,ctempdeletenode.create_normal_temp(tempnode));
  1853. end
  1854. end
  1855. else if node_complexity(para.left) > 1 then
  1856. begin
  1857. if (cs_regvars in aktglobalswitches) and
  1858. not tvarsym(para.paraitem.parasym).vartype.def.needs_inittable then
  1859. tempnode := ctempcreatenode.create_reg(voidpointertype,voidpointertype.def.size,tt_persistent)
  1860. else
  1861. tempnode := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent);
  1862. addstatement(createstatement,tempnode);
  1863. addstatement(createstatement,cassignmentnode.create(ctemprefnode.create(tempnode),
  1864. caddrnode.create(para.left)));
  1865. hp := cderefnode.create(ctemprefnode.create(tempnode));
  1866. inserttypeconv_explicit(hp,para.left.resulttype);
  1867. para.left := hp;
  1868. addstatement(deletestatement,ctempdeletenode.create(tempnode));
  1869. end;
  1870. para := tcallparanode(para.right);
  1871. end;
  1872. end;
  1873. {$ifndef VER1_0}
  1874. { local variables }
  1875. if not assigned(tprocdef(procdefinition).localst) or
  1876. (tprocdef(procdefinition).localst.symindex.count = 0) then
  1877. exit;
  1878. tempnodes.createstatement := createstatement;
  1879. tempnodes.deletestatement := deletestatement;
  1880. setlength(inlinelocals,tprocdef(procdefinition).localst.symindex.count);
  1881. tprocdef(procdefinition).localst.foreach(@createlocaltemps,@tempnodes);
  1882. createstatement := tempnodes.createstatement;
  1883. deletestatement := tempnodes.deletestatement;
  1884. {$endif ndef VER1_0}
  1885. end;
  1886. function tcallnode.pass_1 : tnode;
  1887. var
  1888. createstatement,deletestatement: tstatementnode;
  1889. createblock,deleteblock: tblocknode;
  1890. i: longint;
  1891. label
  1892. errorexit;
  1893. begin
  1894. result:=nil;
  1895. (*
  1896. if (procdefinition.proccalloption=pocall_inline) and
  1897. { can we inline this procedure at the node level? }
  1898. (tprocdef(procdefinition).inlininginfo^.inlinenode) then
  1899. begin
  1900. { inherit flags }
  1901. current_procinfo.flags := current_procinfo.flags + ((procdefinition as tprocdef).inlininginfo^.flags*inherited_inlining_flags);
  1902. if assigned(methodpointer) then
  1903. CGMessage(cg_e_unable_inline_object_methods);
  1904. if assigned(right) then
  1905. CGMessage(cg_e_unable_inline_procvar);
  1906. if assigned(inlinecode) then
  1907. internalerror(2004071110);
  1908. if assigned(tprocdef(procdefinition).inlininginfo^.code) then
  1909. result:=tprocdef(procdefinition).inlininginfo^.code.getcopy
  1910. else
  1911. CGMessage(cg_e_no_code_for_inline_stored);
  1912. if assigned(result) then
  1913. begin
  1914. createblock := internalstatements(createstatement);
  1915. deleteblock := internalstatements(deletestatement);
  1916. { replace complex parameters with temps }
  1917. createinlineparas(createstatement,deletestatement);
  1918. { replace the parameter loads with the parameter values }
  1919. foreachnode(result,replaceparaload,@fileinfo);
  1920. { free the temps for the locals }
  1921. for i := 0 to high(inlinelocals) do
  1922. if assigned(inlinelocals[i]) then
  1923. inlinelocals[i].free;
  1924. setlength(inlinelocals,0);
  1925. addstatement(createstatement,result);
  1926. addstatement(createstatement,deleteblock);
  1927. { set function result location if necessary }
  1928. if assigned(funcretnode) and
  1929. (cnf_return_value_used in callnodeflags) then
  1930. addstatement(createstatement,funcretnode.getcopy);
  1931. result := createblock;
  1932. { consider it must not be inlined if called
  1933. again inside the args or itself }
  1934. procdefinition.proccalloption:=pocall_default;
  1935. firstpass(result);
  1936. procdefinition.proccalloption:=pocall_inline;
  1937. exit;
  1938. end;
  1939. end;
  1940. *)
  1941. { calculate the parameter info for the procdef }
  1942. if not procdefinition.has_paraloc_info then
  1943. begin
  1944. procdefinition.requiredargarea:=paramanager.create_paraloc_info(procdefinition,callerside);
  1945. procdefinition.has_paraloc_info:=true;
  1946. end;
  1947. { calculate the parameter size needed for this call include varargs if they are available }
  1948. if assigned(varargsparas) then
  1949. pushedparasize:=paramanager.create_varargs_paraloc_info(procdefinition,varargsparas)
  1950. else
  1951. pushedparasize:=procdefinition.requiredargarea;
  1952. { record maximum parameter size used in this proc }
  1953. current_procinfo.allocate_push_parasize(pushedparasize);
  1954. { work trough all parameters to get the register requirements }
  1955. if assigned(left) then
  1956. tcallparanode(left).det_registers;
  1957. { order parameters }
  1958. order_parameters;
  1959. if assigned(methodpointerinit) then
  1960. firstpass(methodpointerinit);
  1961. if assigned(methodpointerdone) then
  1962. firstpass(methodpointerdone);
  1963. { function result node }
  1964. if assigned(_funcretnode) then
  1965. firstpass(_funcretnode);
  1966. { procedure variable ? }
  1967. if assigned(right) then
  1968. begin
  1969. firstpass(right);
  1970. { procedure does a call }
  1971. if not (block_type in [bt_const,bt_type]) then
  1972. include(current_procinfo.flags,pi_do_call);
  1973. end
  1974. else
  1975. { not a procedure variable }
  1976. begin
  1977. { calc the correture value for the register }
  1978. { handle predefined procedures }
  1979. if (procdefinition.proccalloption=pocall_inline) then
  1980. begin
  1981. { inherit flags }
  1982. current_procinfo.flags := current_procinfo.flags + ((procdefinition as tprocdef).inlininginfo^.flags*inherited_inlining_flags);
  1983. if assigned(methodpointer) then
  1984. CGMessage(cg_e_unable_inline_object_methods);
  1985. if assigned(right) then
  1986. CGMessage(cg_e_unable_inline_procvar);
  1987. if not assigned(inlinecode) then
  1988. begin
  1989. if assigned(tprocdef(procdefinition).inlininginfo^.code) then
  1990. inlinecode:=tprocdef(procdefinition).inlininginfo^.code.getcopy
  1991. else
  1992. CGMessage(cg_e_no_code_for_inline_stored);
  1993. if assigned(inlinecode) then
  1994. begin
  1995. { consider it has not inlined if called
  1996. again inside the args }
  1997. procdefinition.proccalloption:=pocall_default;
  1998. firstpass(inlinecode);
  1999. end;
  2000. end;
  2001. end
  2002. else
  2003. begin
  2004. if not (block_type in [bt_const,bt_type]) then
  2005. include(current_procinfo.flags,pi_do_call);
  2006. end;
  2007. end;
  2008. { implicit finally needed ? }
  2009. if resulttype.def.needs_inittable and
  2010. not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and
  2011. not assigned(funcretnode) then
  2012. include(current_procinfo.flags,pi_needs_implicit_finally);
  2013. { get a register for the return value }
  2014. if (not is_void(resulttype.def)) then
  2015. begin
  2016. if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
  2017. begin
  2018. expectloc:=LOC_REFERENCE;
  2019. end
  2020. else
  2021. { for win32 records returned in EDX:EAX, we
  2022. move them to memory after ... }
  2023. if (resulttype.def.deftype=recorddef) then
  2024. begin
  2025. expectloc:=LOC_REFERENCE;
  2026. end
  2027. else
  2028. { ansi/widestrings must be registered, so we can dispose them }
  2029. if is_ansistring(resulttype.def) or
  2030. is_widestring(resulttype.def) then
  2031. begin
  2032. expectloc:=LOC_REFERENCE;
  2033. registersint:=1;
  2034. end
  2035. else
  2036. { we have only to handle the result if it is used }
  2037. if (cnf_return_value_used in callnodeflags) then
  2038. begin
  2039. case resulttype.def.deftype of
  2040. enumdef,
  2041. orddef :
  2042. begin
  2043. if (procdefinition.proctypeoption=potype_constructor) then
  2044. begin
  2045. expectloc:=LOC_REGISTER;
  2046. registersint:=1;
  2047. end
  2048. else
  2049. begin
  2050. expectloc:=LOC_REGISTER;
  2051. if is_64bit(resulttype.def) then
  2052. registersint:=2
  2053. else
  2054. registersint:=1;
  2055. end;
  2056. end;
  2057. floatdef :
  2058. begin
  2059. expectloc:=LOC_FPUREGISTER;
  2060. {$ifdef cpufpemu}
  2061. if (cs_fp_emulation in aktmoduleswitches) then
  2062. registersint:=1
  2063. else
  2064. {$endif cpufpemu}
  2065. {$ifdef m68k}
  2066. if (tfloatdef(resulttype.def).typ=s32real) then
  2067. registersint:=1
  2068. else
  2069. {$endif m68k}
  2070. registersfpu:=1;
  2071. end;
  2072. else
  2073. begin
  2074. expectloc:=LOC_REGISTER;
  2075. registersint:=1;
  2076. end;
  2077. end;
  2078. end
  2079. else
  2080. expectloc:=LOC_VOID;
  2081. end
  2082. else
  2083. expectloc:=LOC_VOID;
  2084. {$ifdef m68k}
  2085. { we need one more address register for virtual calls on m68k }
  2086. if (po_virtualmethod in procdefinition.procoptions) then
  2087. inc(registersint);
  2088. {$endif m68k}
  2089. { a fpu can be used in any procedure !! }
  2090. {$ifdef i386}
  2091. registersfpu:=procdefinition.fpu_used;
  2092. {$endif i386}
  2093. { if this is a call to a method calc the registers }
  2094. if (methodpointer<>nil) then
  2095. begin
  2096. if methodpointer.nodetype<>typen then
  2097. begin
  2098. firstpass(methodpointer);
  2099. registersfpu:=max(methodpointer.registersfpu,registersfpu);
  2100. registersint:=max(methodpointer.registersint,registersint);
  2101. {$ifdef SUPPORT_MMX }
  2102. registersmmx:=max(methodpointer.registersmmx,registersmmx);
  2103. {$endif SUPPORT_MMX}
  2104. end;
  2105. end;
  2106. { determine the registers of the procedure variable }
  2107. { is this OK for inlined procs also ?? (PM) }
  2108. if assigned(inlinecode) then
  2109. begin
  2110. registersfpu:=max(inlinecode.registersfpu,registersfpu);
  2111. registersint:=max(inlinecode.registersint,registersint);
  2112. {$ifdef SUPPORT_MMX}
  2113. registersmmx:=max(inlinecode.registersmmx,registersmmx);
  2114. {$endif SUPPORT_MMX}
  2115. end;
  2116. { determine the registers of the procedure variable }
  2117. { is this OK for inlined procs also ?? (PM) }
  2118. if assigned(right) then
  2119. begin
  2120. registersfpu:=max(right.registersfpu,registersfpu);
  2121. registersint:=max(right.registersint,registersint);
  2122. {$ifdef SUPPORT_MMX}
  2123. registersmmx:=max(right.registersmmx,registersmmx);
  2124. {$endif SUPPORT_MMX}
  2125. end;
  2126. { determine the registers of the procedure }
  2127. if assigned(left) then
  2128. begin
  2129. registersfpu:=max(left.registersfpu,registersfpu);
  2130. registersint:=max(left.registersint,registersint);
  2131. {$ifdef SUPPORT_MMX}
  2132. registersmmx:=max(left.registersmmx,registersmmx);
  2133. {$endif SUPPORT_MMX}
  2134. end;
  2135. errorexit:
  2136. if assigned(inlinecode) then
  2137. procdefinition.proccalloption:=pocall_inline;
  2138. end;
  2139. {$ifdef state_tracking}
  2140. function Tcallnode.track_state_pass(exec_known:boolean):boolean;
  2141. var hp:Tcallparanode;
  2142. value:Tnode;
  2143. begin
  2144. track_state_pass:=false;
  2145. hp:=Tcallparanode(left);
  2146. while assigned(hp) do
  2147. begin
  2148. if left.track_state_pass(exec_known) then
  2149. begin
  2150. left.resulttype.def:=nil;
  2151. do_resulttypepass(left);
  2152. end;
  2153. value:=aktstate.find_fact(hp.left);
  2154. if value<>nil then
  2155. begin
  2156. track_state_pass:=true;
  2157. hp.left.destroy;
  2158. hp.left:=value.getcopy;
  2159. do_resulttypepass(hp.left);
  2160. end;
  2161. hp:=Tcallparanode(hp.right);
  2162. end;
  2163. end;
  2164. {$endif}
  2165. function tcallnode.para_count:longint;
  2166. var
  2167. ppn : tcallparanode;
  2168. begin
  2169. result:=0;
  2170. ppn:=tcallparanode(left);
  2171. while assigned(ppn) do
  2172. begin
  2173. if not(assigned(ppn.paraitem) and
  2174. ppn.paraitem.is_hidden) then
  2175. inc(result);
  2176. ppn:=tcallparanode(ppn.right);
  2177. end;
  2178. end;
  2179. function tcallnode.docompare(p: tnode): boolean;
  2180. begin
  2181. docompare :=
  2182. inherited docompare(p) and
  2183. (symtableprocentry = tcallnode(p).symtableprocentry) and
  2184. (procdefinition = tcallnode(p).procdefinition) and
  2185. (methodpointer.isequal(tcallnode(p).methodpointer)) and
  2186. (((cnf_restypeset in callnodeflags) and (cnf_restypeset in tcallnode(p).callnodeflags) and
  2187. (equal_defs(restype.def,tcallnode(p).restype.def))) or
  2188. (not(cnf_restypeset in callnodeflags) and not(cnf_restypeset in tcallnode(p).callnodeflags)));
  2189. end;
  2190. procedure tcallnode.printnodedata(var t:text);
  2191. begin
  2192. if assigned(procdefinition) and
  2193. (procdefinition.deftype=procdef) then
  2194. writeln(t,printnodeindention,'proc = ',tprocdef(procdefinition).fullprocname(true))
  2195. else
  2196. begin
  2197. if assigned(symtableprocentry) then
  2198. writeln(t,printnodeindention,'proc = ',symtableprocentry.name)
  2199. else
  2200. writeln(t,printnodeindention,'proc = <nil>');
  2201. end;
  2202. printnode(t,methodpointer);
  2203. printnode(t,right);
  2204. printnode(t,left);
  2205. end;
  2206. begin
  2207. ccallnode:=tcallnode;
  2208. ccallparanode:=tcallparanode;
  2209. end.
  2210. {
  2211. $Log$
  2212. Revision 1.253 2004-10-25 15:38:41 peter
  2213. * heap and heapsize removed
  2214. * checkpointer fixes
  2215. Revision 1.252 2004/10/15 09:14:16 mazen
  2216. - remove $IFDEF DELPHI and related code
  2217. - remove $IFDEF FPCPROCVAR and related code
  2218. Revision 1.251 2004/10/12 14:36:38 peter
  2219. * gen high tree makes copy in temp when there is a calln
  2220. Revision 1.250 2004/10/10 20:22:53 peter
  2221. * symtable allocation rewritten
  2222. * loading of parameters to local temps/regs cleanup
  2223. * regvar support for parameters
  2224. * regvar support for staticsymtable (main body)
  2225. Revision 1.249 2004/10/08 17:09:43 peter
  2226. * tvarsym.varregable added, split vo_regable from varoptions
  2227. Revision 1.248 2004/09/21 17:25:12 peter
  2228. * paraloc branch merged
  2229. Revision 1.247 2004/09/13 20:29:00 peter
  2230. * use realname for abstract procs found
  2231. Revision 1.246.4.1 2004/08/31 20:43:06 peter
  2232. * paraloc patch
  2233. Revision 1.246 2004/08/28 20:00:50 peter
  2234. * use objrealname in Message1
  2235. Revision 1.245 2004/08/22 10:17:13 peter
  2236. * fixed crash when passing array constructor to formal parameter
  2237. Revision 1.244 2004/08/14 14:50:42 florian
  2238. * fixed several sparc alignment issues
  2239. + Jonas' inline node patch; non functional yet
  2240. Revision 1.243 2004/07/16 19:45:15 jonas
  2241. + temps can now also hold fpu values in registers (take care with use,
  2242. bacause of the x86 fpu stack)
  2243. * fpu parameters to node-inlined procedures can now also be put in
  2244. a register
  2245. Revision 1.242 2004/07/15 21:02:05 jonas
  2246. * the condition for when to use a temp in case of reference var/const
  2247. parameters was inverse
  2248. Revision 1.241 2004/07/15 19:55:39 jonas
  2249. + (incomplete) node_complexity function to assess the complexity of a
  2250. tree
  2251. + support for inlining value and const parameters at the node level
  2252. (all procedures without local variables and without formal parameters
  2253. can now be inlined at the node level)
  2254. Revision 1.240 2004/07/12 09:14:04 jonas
  2255. * inline procedures at the node tree level, but only under some very
  2256. limited circumstances for now (only procedures, and only if they have
  2257. no or only vs_out/vs_var parameters).
  2258. * fixed ppudump for inline procedures
  2259. * fixed ppudump for ppc
  2260. Revision 1.239 2004/06/20 08:55:29 florian
  2261. * logs truncated
  2262. Revision 1.238 2004/06/16 20:07:08 florian
  2263. * dwarf branch merged
  2264. Revision 1.237 2004/05/25 18:51:49 peter
  2265. * fix tcallnode.getcopy. the parameters need to be copied after
  2266. methodpointerinit is copied
  2267. Revision 1.236 2004/05/24 17:31:51 peter
  2268. * fix passing of array to open array of array (bug 3113)
  2269. Revision 1.235 2004/05/23 18:28:41 peter
  2270. * methodpointer is loaded into a temp when it was a calln
  2271. Revision 1.234 2004/05/23 15:06:20 peter
  2272. * implicit_finally flag must be set in pass1
  2273. * add check whether the implicit frame is generated when expected
  2274. }