tccal.pas 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Type checking and register allocation for call nodes
  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 tccal;
  19. interface
  20. uses
  21. symtable,tree;
  22. procedure gen_high_tree(p:ptree;openstring:boolean);
  23. procedure firstcallparan(var p : ptree;defcoll : pdefcoll);
  24. procedure firstcalln(var p : ptree);
  25. procedure firstprocinline(var p : ptree);
  26. implementation
  27. uses
  28. globtype,systems,
  29. cobjects,verbose,globals,
  30. symconst,aasm,types,
  31. hcodegen,htypechk,pass_1,cpubase
  32. {$ifdef i386}
  33. ,tgeni386
  34. {$endif}
  35. {$ifdef m68k}
  36. ,tgen68k
  37. {$endif m68k}
  38. ;
  39. {*****************************************************************************
  40. FirstCallParaN
  41. *****************************************************************************}
  42. procedure gen_high_tree(p:ptree;openstring:boolean);
  43. var
  44. len : longint;
  45. st : psymtable;
  46. loadconst : boolean;
  47. begin
  48. if assigned(p^.hightree) then
  49. exit;
  50. len:=-1;
  51. loadconst:=true;
  52. case p^.left^.resulttype^.deftype of
  53. arraydef :
  54. begin
  55. if is_open_array(p^.left^.resulttype) or
  56. is_array_of_const(p^.left^.resulttype) then
  57. begin
  58. st:=p^.left^.symtable;
  59. getsymonlyin(st,'high'+pvarsym(p^.left^.symtableentry)^.name);
  60. p^.hightree:=genloadnode(pvarsym(srsym),st);
  61. loadconst:=false;
  62. end
  63. else
  64. begin
  65. { this is an empty constructor }
  66. len:=parraydef(p^.left^.resulttype)^.highrange-
  67. parraydef(p^.left^.resulttype)^.lowrange;
  68. end;
  69. end;
  70. stringdef :
  71. begin
  72. if openstring then
  73. begin
  74. if is_open_string(p^.left^.resulttype) then
  75. begin
  76. st:=p^.left^.symtable;
  77. getsymonlyin(st,'high'+pvarsym(p^.left^.symtableentry)^.name);
  78. p^.hightree:=genloadnode(pvarsym(srsym),st);
  79. loadconst:=false;
  80. end
  81. else
  82. len:=pstringdef(p^.left^.resulttype)^.len;
  83. end
  84. else
  85. { passing a string to an array of char }
  86. begin
  87. if (p^.left^.treetype=stringconstn) then
  88. begin
  89. len:=str_length(p^.left);
  90. if len>0 then
  91. dec(len);
  92. end
  93. else
  94. begin
  95. p^.hightree:=gennode(subn,geninlinenode(in_length_string,false,getcopy(p^.left)),
  96. genordinalconstnode(1,s32bitdef));
  97. firstpass(p^.hightree);
  98. p^.hightree:=gentypeconvnode(p^.hightree,s32bitdef);
  99. loadconst:=false;
  100. end;
  101. end;
  102. end;
  103. else
  104. len:=0;
  105. end;
  106. if loadconst then
  107. p^.hightree:=genordinalconstnode(len,s32bitdef);
  108. firstpass(p^.hightree);
  109. end;
  110. procedure firstcallparan(var p : ptree;defcoll : pdefcoll);
  111. var
  112. old_get_para_resulttype : boolean;
  113. old_array_constructor : boolean;
  114. store_valid : boolean;
  115. oldtype : pdef;
  116. {convtyp : tconverttype;}
  117. begin
  118. inc(parsing_para_level);
  119. if assigned(p^.right) then
  120. begin
  121. if defcoll=nil then
  122. firstcallparan(p^.right,nil)
  123. else
  124. firstcallparan(p^.right,defcoll^.next);
  125. p^.registers32:=p^.right^.registers32;
  126. p^.registersfpu:=p^.right^.registersfpu;
  127. {$ifdef SUPPORT_MMX}
  128. p^.registersmmx:=p^.right^.registersmmx;
  129. {$endif}
  130. end;
  131. if defcoll=nil then
  132. begin
  133. old_array_constructor:=allow_array_constructor;
  134. old_get_para_resulttype:=get_para_resulttype;
  135. get_para_resulttype:=true;
  136. allow_array_constructor:=true;
  137. if not(assigned(p^.resulttype)) or
  138. (p^.left^.treetype=typeconvn) then
  139. firstpass(p^.left);
  140. get_para_resulttype:=old_get_para_resulttype;
  141. allow_array_constructor:=old_array_constructor;
  142. if codegenerror then
  143. begin
  144. dec(parsing_para_level);
  145. exit;
  146. end;
  147. p^.resulttype:=p^.left^.resulttype;
  148. end
  149. { if we know the routine which is called, then the type }
  150. { conversions are inserted }
  151. else
  152. begin
  153. { Do we need arrayconstructor -> set conversion, then insert
  154. it here before the arrayconstructor node breaks the tree
  155. with its conversions of enum->ord }
  156. if (p^.left^.treetype=arrayconstructn) and
  157. (defcoll^.data^.deftype=setdef) then
  158. p^.left:=gentypeconvnode(p^.left,defcoll^.data);
  159. if count_ref then
  160. begin
  161. { not completly proper, but avoids some warnings }
  162. if (p^.left^.treetype=funcretn) and (defcoll^.paratyp=vs_var) then
  163. procinfo^.funcret_is_valid:=true;
  164. store_valid:=must_be_valid;
  165. { protected has nothing to do with read/write
  166. if (defcoll^.paratyp=vs_var) then
  167. test_protected(p^.left);
  168. }
  169. must_be_valid:=(defcoll^.paratyp<>vs_var);
  170. { only process typeconvn and arrayconstructn, else it will
  171. break other trees }
  172. old_array_constructor:=allow_array_constructor;
  173. old_get_para_resulttype:=get_para_resulttype;
  174. allow_array_constructor:=true;
  175. get_para_resulttype:=false;
  176. if (p^.left^.treetype in [arrayconstructn,typeconvn]) then
  177. firstpass(p^.left);
  178. get_para_resulttype:=old_get_para_resulttype;
  179. allow_array_constructor:=old_array_constructor;
  180. must_be_valid:=store_valid;
  181. end;
  182. { check if local proc/func is assigned to procvar }
  183. if p^.left^.resulttype^.deftype=procvardef then
  184. test_local_to_procvar(pprocvardef(p^.left^.resulttype),defcoll^.data);
  185. { property is not allowed as var parameter }
  186. if (defcoll^.paratyp=vs_var) and
  187. (p^.left^.isproperty) then
  188. CGMessagePos(p^.left^.fileinfo,type_e_argument_cant_be_assigned);
  189. { generate the high() value tree }
  190. if push_high_param(defcoll^.data) then
  191. gen_high_tree(p,is_open_string(defcoll^.data));
  192. if not(is_shortstring(p^.left^.resulttype) and
  193. is_shortstring(defcoll^.data)) and
  194. (defcoll^.data^.deftype<>formaldef) then
  195. begin
  196. if (defcoll^.paratyp=vs_var) and
  197. { allows conversion from word to integer and
  198. byte to shortint }
  199. (not(
  200. (p^.left^.resulttype^.deftype=orddef) and
  201. (defcoll^.data^.deftype=orddef) and
  202. (p^.left^.resulttype^.size=defcoll^.data^.size)
  203. ) and
  204. { an implicit pointer conversion is allowed }
  205. not(
  206. (p^.left^.resulttype^.deftype=pointerdef) and
  207. (defcoll^.data^.deftype=pointerdef)
  208. ) and
  209. { child classes can be also passed }
  210. not(
  211. (p^.left^.resulttype^.deftype=objectdef) and
  212. (defcoll^.data^.deftype=objectdef) and
  213. pobjectdef(p^.left^.resulttype)^.is_related(pobjectdef(defcoll^.data))
  214. ) and
  215. { passing a single element to a openarray of the same type }
  216. not(
  217. (is_open_array(defcoll^.data) and
  218. is_equal(parraydef(defcoll^.data)^.definition,p^.left^.resulttype))
  219. ) and
  220. { an implicit file conversion is also allowed }
  221. { from a typed file to an untyped one }
  222. not(
  223. (p^.left^.resulttype^.deftype=filedef) and
  224. (defcoll^.data^.deftype=filedef) and
  225. (pfiledef(defcoll^.data)^.filetype = ft_untyped) and
  226. (pfiledef(p^.left^.resulttype)^.filetype = ft_typed)
  227. ) and
  228. not(is_equal(p^.left^.resulttype,defcoll^.data))) then
  229. begin
  230. CGMessagePos2(p^.left^.fileinfo,parser_e_call_by_ref_without_typeconv,
  231. p^.left^.resulttype^.typename,defcoll^.data^.typename);
  232. end;
  233. { process cargs arrayconstructor }
  234. if is_array_constructor(p^.left^.resulttype) then
  235. begin
  236. if is_array_of_const(defcoll^.data) then
  237. begin
  238. if assigned(aktcallprocsym) and
  239. (pocall_cdecl in aktcallprocsym^.definition^.proccalloptions) and
  240. (po_external in aktcallprocsym^.definition^.procoptions) then
  241. p^.left^.cargs:=true;
  242. { force variant array }
  243. p^.left^.forcevaria:=true;
  244. end
  245. else
  246. begin
  247. p^.left^.novariaallowed:=true;
  248. p^.left^.constructdef:=parraydef(defcoll^.data)^.definition;
  249. end;
  250. old_array_constructor:=allow_array_constructor;
  251. allow_array_constructor:=true;
  252. firstpass(p^.left);
  253. allow_array_constructor:=old_array_constructor;
  254. end;
  255. { process open parameters }
  256. if push_high_param(defcoll^.data) then
  257. begin
  258. { insert type conv but hold the ranges of the array }
  259. oldtype:=p^.left^.resulttype;
  260. p^.left:=gentypeconvnode(p^.left,defcoll^.data);
  261. firstpass(p^.left);
  262. p^.left^.resulttype:=oldtype;
  263. end
  264. else
  265. begin
  266. p^.left:=gentypeconvnode(p^.left,defcoll^.data);
  267. firstpass(p^.left);
  268. end;
  269. if codegenerror then
  270. begin
  271. dec(parsing_para_level);
  272. exit;
  273. end;
  274. end;
  275. { check var strings }
  276. if (cs_strict_var_strings in aktlocalswitches) and
  277. is_shortstring(p^.left^.resulttype) and
  278. is_shortstring(defcoll^.data) and
  279. (defcoll^.paratyp=vs_var) and
  280. not(is_open_string(defcoll^.data)) and
  281. not(is_equal(p^.left^.resulttype,defcoll^.data)) then
  282. begin
  283. aktfilepos:=p^.left^.fileinfo;
  284. CGMessage(type_e_strict_var_string_violation);
  285. end;
  286. { Variablen for call by reference may not be copied }
  287. { into a register }
  288. { is this usefull here ? }
  289. { this was missing in formal parameter list }
  290. if (defcoll^.data=pdef(cformaldef)) then
  291. begin
  292. if defcoll^.paratyp=vs_var then
  293. if not valid_for_formal_var(p^.left) then
  294. begin
  295. aktfilepos:=p^.left^.fileinfo;
  296. CGMessage(parser_e_illegal_parameter_list);
  297. end;
  298. if defcoll^.paratyp=vs_const then
  299. if not valid_for_formal_const(p^.left) then
  300. begin
  301. aktfilepos:=p^.left^.fileinfo;
  302. CGMessage(parser_e_illegal_parameter_list);
  303. end;
  304. end;
  305. if defcoll^.paratyp=vs_var then
  306. begin
  307. set_unique(p^.left);
  308. make_not_regable(p^.left);
  309. end;
  310. p^.resulttype:=defcoll^.data;
  311. end;
  312. if p^.left^.registers32>p^.registers32 then
  313. p^.registers32:=p^.left^.registers32;
  314. if p^.left^.registersfpu>p^.registersfpu then
  315. p^.registersfpu:=p^.left^.registersfpu;
  316. {$ifdef SUPPORT_MMX}
  317. if p^.left^.registersmmx>p^.registersmmx then
  318. p^.registersmmx:=p^.left^.registersmmx;
  319. {$endif SUPPORT_MMX}
  320. dec(parsing_para_level);
  321. end;
  322. {*****************************************************************************
  323. FirstCallN
  324. *****************************************************************************}
  325. procedure firstcalln(var p : ptree);
  326. type
  327. pprocdefcoll = ^tprocdefcoll;
  328. tprocdefcoll = record
  329. data : pprocdef;
  330. nextpara : pdefcoll;
  331. firstpara : pdefcoll;
  332. next : pprocdefcoll;
  333. end;
  334. var
  335. hp,procs,hp2 : pprocdefcoll;
  336. pd : pprocdef;
  337. oldcallprocsym : pprocsym;
  338. nextprocsym : pprocsym;
  339. def_from,def_to,conv_to : pdef;
  340. hpt,pt,inlinecode : ptree;
  341. exactmatch,inlined : boolean;
  342. paralength,l,lastpara : longint;
  343. lastparatype : pdef;
  344. pdc : pdefcoll;
  345. {$ifdef TEST_PROCSYMS}
  346. symt : psymtable;
  347. {$endif TEST_PROCSYMS}
  348. { only Dummy }
  349. hcvt : tconverttype;
  350. regi : tregister;
  351. store_valid, old_count_ref : boolean;
  352. label
  353. errorexit;
  354. { check if the resulttype from tree p is equal with def, needed
  355. for stringconstn and formaldef }
  356. function is_equal(p:ptree;def:pdef) : boolean;
  357. begin
  358. { safety check }
  359. if not (assigned(def) or assigned(p^.resulttype)) then
  360. begin
  361. is_equal:=false;
  362. exit;
  363. end;
  364. { all types can be passed to a formaldef }
  365. is_equal:=(def^.deftype=formaldef) or
  366. (types.is_equal(p^.resulttype,def))
  367. { to support ansi/long/wide strings in a proper way }
  368. { string and string[10] are assumed as equal }
  369. { when searching the correct overloaded procedure }
  370. or
  371. (
  372. (def^.deftype=stringdef) and (p^.resulttype^.deftype=stringdef) and
  373. (pstringdef(def)^.string_typ=pstringdef(p^.resulttype)^.string_typ)
  374. )
  375. or
  376. (
  377. (p^.left^.treetype=stringconstn) and
  378. (is_ansistring(p^.resulttype) and is_pchar(def))
  379. )
  380. or
  381. (
  382. (p^.left^.treetype=ordconstn) and
  383. (is_char(p^.resulttype) and (is_shortstring(def) or is_ansistring(def)))
  384. )
  385. { set can also be a not yet converted array constructor }
  386. or
  387. (
  388. (def^.deftype=setdef) and (p^.resulttype^.deftype=arraydef) and
  389. (parraydef(p^.resulttype)^.IsConstructor) and not(parraydef(p^.resulttype)^.IsVariant)
  390. )
  391. { in tp7 mode proc -> procvar is allowed }
  392. or
  393. (
  394. (m_tp_procvar in aktmodeswitches) and
  395. (def^.deftype=procvardef) and (p^.left^.treetype=calln) and
  396. (proc_to_procvar_equal(pprocdef(p^.left^.procdefinition),pprocvardef(def)))
  397. )
  398. ;
  399. end;
  400. function is_in_limit(def_from,def_to : pdef) : boolean;
  401. begin
  402. is_in_limit:=(def_from^.deftype = orddef) and
  403. (def_to^.deftype = orddef) and
  404. (porddef(def_from)^.low>porddef(def_to)^.low) and
  405. (porddef(def_from)^.high<porddef(def_to)^.high);
  406. end;
  407. var
  408. is_const : boolean;
  409. begin
  410. { release registers! }
  411. { if procdefinition<>nil then we called firstpass already }
  412. { it seems to be bad because of the registers }
  413. { at least we can avoid the overloaded search !! }
  414. procs:=nil;
  415. { made this global for disposing !! }
  416. store_valid:=must_be_valid;
  417. must_be_valid:=false;
  418. oldcallprocsym:=aktcallprocsym;
  419. aktcallprocsym:=nil;
  420. inlined:=false;
  421. if assigned(p^.procdefinition) and
  422. (pocall_inline in p^.procdefinition^.proccalloptions) then
  423. begin
  424. inlinecode:=p^.right;
  425. if assigned(inlinecode) then
  426. begin
  427. inlined:=true;
  428. {$ifdef INCLUDEOK}
  429. exclude(p^.procdefinition^.proccalloptions,pocall_inline);
  430. {$else}
  431. p^.procdefinition^.proccalloptions:=p^.procdefinition^.proccalloptions-[pocall_inline];
  432. {$endif}
  433. end;
  434. p^.right:=nil;
  435. end;
  436. if assigned(p^.procdefinition) and
  437. (po_containsself in p^.procdefinition^.procoptions) then
  438. message(cg_e_cannot_call_message_direct);
  439. { procedure variable ? }
  440. if assigned(p^.right) then
  441. begin
  442. { procedure does a call }
  443. procinfo^.flags:=procinfo^.flags or pi_do_call;
  444. { calc the correture value for the register }
  445. {$ifdef i386}
  446. for regi:=R_EAX to R_EDI do
  447. inc(reg_pushes[regi],t_times*2);
  448. {$endif}
  449. {$ifdef m68k}
  450. for regi:=R_D0 to R_A6 do
  451. inc(reg_pushes[regi],t_times*2);
  452. {$endif}
  453. { calculate the type of the parameters }
  454. if assigned(p^.left) then
  455. begin
  456. old_count_ref:=count_ref;
  457. count_ref:=false;
  458. firstcallparan(p^.left,nil);
  459. count_ref:=old_count_ref;
  460. if codegenerror then
  461. goto errorexit;
  462. end;
  463. firstpass(p^.right);
  464. { check the parameters }
  465. pdc:=pprocvardef(p^.right^.resulttype)^.para1;
  466. pt:=p^.left;
  467. while assigned(pdc) and assigned(pt) do
  468. begin
  469. pt:=pt^.right;
  470. pdc:=pdc^.next;
  471. end;
  472. if assigned(pt) or assigned(pdc) then
  473. begin
  474. if assigned(pt) then
  475. aktfilepos:=pt^.fileinfo;
  476. CGMessage(parser_e_illegal_parameter_list);
  477. end;
  478. { insert type conversions }
  479. if assigned(p^.left) then
  480. begin
  481. old_count_ref:=count_ref;
  482. count_ref:=true;
  483. firstcallparan(p^.left,pprocvardef(p^.right^.resulttype)^.para1);
  484. count_ref:=old_count_ref;
  485. if codegenerror then
  486. goto errorexit;
  487. end;
  488. p^.resulttype:=pprocvardef(p^.right^.resulttype)^.retdef;
  489. { this was missing, leads to a bug below if
  490. the procvar is a function }
  491. p^.procdefinition:=pabstractprocdef(p^.right^.resulttype);
  492. end
  493. else
  494. { not a procedure variable }
  495. begin
  496. { determine the type of the parameters }
  497. if assigned(p^.left) then
  498. begin
  499. old_count_ref:=count_ref;
  500. count_ref:=false;
  501. { must be valid is already false!
  502. store_valid:=must_be_valid;
  503. must_be_valid:=false; }
  504. firstcallparan(p^.left,nil);
  505. count_ref:=old_count_ref;
  506. {
  507. must_be_valid:=store_valid;
  508. }
  509. if codegenerror then
  510. goto errorexit;
  511. end;
  512. aktcallprocsym:=pprocsym(p^.symtableprocentry);
  513. { do we know the procedure to call ? }
  514. if not(assigned(p^.procdefinition)) then
  515. begin
  516. {$ifdef TEST_PROCSYMS}
  517. if (p^.unit_specific) or
  518. assigned(p^.methodpointer) then
  519. nextprocsym:=nil
  520. else while not assigned(procs) do
  521. begin
  522. symt:=p^.symtableproc;
  523. srsym:=nil;
  524. while assigned(symt^.next) and not assigned(srsym) do
  525. begin
  526. symt:=symt^.next;
  527. getsymonlyin(symt,actprocsym^.name);
  528. if assigned(srsym) then
  529. if srsym^.typ<>procsym then
  530. begin
  531. { reject all that is not a procedure }
  532. srsym:=nil;
  533. { don't search elsewhere }
  534. while assigned(symt^.next) do
  535. symt:=symt^.next;
  536. end;
  537. end;
  538. nextprocsym:=srsym;
  539. end;
  540. {$else TEST_PROCSYMS}
  541. nextprocsym:=nil;
  542. {$endif TEST_PROCSYMS}
  543. { determine length of parameter list }
  544. pt:=p^.left;
  545. paralength:=0;
  546. while assigned(pt) do
  547. begin
  548. inc(paralength);
  549. pt:=pt^.right;
  550. end;
  551. { link all procedures which have the same # of parameters }
  552. pd:=aktcallprocsym^.definition;
  553. while assigned(pd) do
  554. begin
  555. pdc:=pd^.para1;
  556. l:=0;
  557. while assigned(pdc) do
  558. begin
  559. inc(l);
  560. pdc:=pdc^.next;
  561. end;
  562. { only when the # of parameter are equal }
  563. if (l=paralength) then
  564. begin
  565. new(hp);
  566. hp^.data:=pd;
  567. hp^.next:=procs;
  568. hp^.nextpara:=pd^.para1;
  569. hp^.firstpara:=pd^.para1;
  570. procs:=hp;
  571. end;
  572. pd:=pd^.nextoverloaded;
  573. end;
  574. { no procedures found? then there is something wrong
  575. with the parameter size }
  576. if not assigned(procs) then
  577. begin
  578. { in tp mode we can try to convert to procvar if
  579. there are no parameters specified }
  580. if not(assigned(p^.left)) and
  581. (m_tp_procvar in aktmodeswitches) then
  582. begin
  583. if (p^.symtableprocentry^.owner^.symtabletype=objectsymtable) and
  584. (pobjectdef(p^.symtableprocentry^.owner^.defowner)^.is_class) then
  585. hpt:=genloadmethodcallnode(pprocsym(p^.symtableprocentry),p^.symtableproc,
  586. getcopy(p^.methodpointer))
  587. else
  588. hpt:=genloadcallnode(pprocsym(p^.symtableprocentry),p^.symtableproc);
  589. disposetree(p);
  590. firstpass(hpt);
  591. p:=hpt;
  592. end
  593. else
  594. begin
  595. if assigned(p^.left) then
  596. aktfilepos:=p^.left^.fileinfo;
  597. CGMessage(parser_e_wrong_parameter_size);
  598. aktcallprocsym^.write_parameter_lists;
  599. end;
  600. goto errorexit;
  601. end;
  602. { now we can compare parameter after parameter }
  603. pt:=p^.left;
  604. { we start with the last parameter }
  605. lastpara:=paralength+1;
  606. lastparatype:=nil;
  607. while assigned(pt) do
  608. begin
  609. dec(lastpara);
  610. { walk all procedures and determine how this parameter matches and set:
  611. 1. pt^.exact_match_found if one parameter has an exact match
  612. 2. exactmatch if an equal or exact match is found
  613. 3. para^.argconvtyp to exact,equal or convertable
  614. (when convertable then also convertlevel is set)
  615. 4. pt^.convlevel1found if there is a convertlevel=1
  616. 5. pt^.convlevel2found if there is a convertlevel=2
  617. }
  618. exactmatch:=false;
  619. hp:=procs;
  620. while assigned(hp) do
  621. begin
  622. if is_equal(pt,hp^.nextpara^.data) then
  623. begin
  624. if hp^.nextpara^.data=pt^.resulttype then
  625. begin
  626. pt^.exact_match_found:=true;
  627. hp^.nextpara^.argconvtyp:=act_exact;
  628. end
  629. else
  630. hp^.nextpara^.argconvtyp:=act_equal;
  631. exactmatch:=true;
  632. end
  633. else
  634. begin
  635. hp^.nextpara^.argconvtyp:=act_convertable;
  636. hp^.nextpara^.convertlevel:=isconvertable(pt^.resulttype,hp^.nextpara^.data,
  637. hcvt,pt^.left^.treetype,false);
  638. case hp^.nextpara^.convertlevel of
  639. 1 : pt^.convlevel1found:=true;
  640. 2 : pt^.convlevel2found:=true;
  641. end;
  642. end;
  643. hp:=hp^.next;
  644. end;
  645. { If there was an exactmatch then delete all convertables }
  646. if exactmatch then
  647. begin
  648. hp:=procs;
  649. procs:=nil;
  650. while assigned(hp) do
  651. begin
  652. hp2:=hp^.next;
  653. { keep if not convertable }
  654. if (hp^.nextpara^.argconvtyp<>act_convertable) then
  655. begin
  656. hp^.next:=procs;
  657. procs:=hp;
  658. end
  659. else
  660. dispose(hp);
  661. hp:=hp2;
  662. end;
  663. end
  664. else
  665. { No exact match was found, remove all procedures that are
  666. not convertable (convertlevel=0) }
  667. begin
  668. hp:=procs;
  669. procs:=nil;
  670. while assigned(hp) do
  671. begin
  672. hp2:=hp^.next;
  673. { keep if not convertable }
  674. if (hp^.nextpara^.convertlevel<>0) then
  675. begin
  676. hp^.next:=procs;
  677. procs:=hp;
  678. end
  679. else
  680. begin
  681. { save the type for nice error message }
  682. lastparatype:=hp^.nextpara^.data;
  683. dispose(hp);
  684. end;
  685. hp:=hp2;
  686. end;
  687. end;
  688. { update nextpara for all procedures }
  689. hp:=procs;
  690. while assigned(hp) do
  691. begin
  692. hp^.nextpara:=hp^.nextpara^.next;
  693. hp:=hp^.next;
  694. end;
  695. { load next parameter or quit loop if no procs left }
  696. if assigned(procs) then
  697. pt:=pt^.right
  698. else
  699. break;
  700. end;
  701. { All parameters are checked, check if there are any
  702. procedures left }
  703. if not assigned(procs) then
  704. begin
  705. { there is an error, must be wrong type, because
  706. wrong size is already checked (PFV) }
  707. if (not assigned(lastparatype)) or
  708. (not assigned(pt)) or
  709. (not assigned(pt^.resulttype)) then
  710. internalerror(39393)
  711. else
  712. begin
  713. aktfilepos:=pt^.fileinfo;
  714. CGMessage3(type_e_wrong_parameter_type,tostr(lastpara),
  715. pt^.resulttype^.typename,lastparatype^.typename);
  716. end;
  717. aktcallprocsym^.write_parameter_lists;
  718. goto errorexit;
  719. end;
  720. { if there are several choices left then for orddef }
  721. { if a type is totally included in the other }
  722. { we don't fear an overflow , }
  723. { so we can do as if it is an exact match }
  724. { this will convert integer to longint }
  725. { rather than to words }
  726. { conversion of byte to integer or longint }
  727. {would still not be solved }
  728. if assigned(procs) and assigned(procs^.next) then
  729. begin
  730. hp:=procs;
  731. while assigned(hp) do
  732. begin
  733. hp^.nextpara:=hp^.firstpara;
  734. hp:=hp^.next;
  735. end;
  736. pt:=p^.left;
  737. while assigned(pt) do
  738. begin
  739. { matches a parameter of one procedure exact ? }
  740. exactmatch:=false;
  741. def_from:=pt^.resulttype;
  742. hp:=procs;
  743. while assigned(hp) do
  744. begin
  745. if not is_equal(pt,hp^.nextpara^.data) then
  746. begin
  747. def_to:=hp^.nextpara^.data;
  748. if ((def_from^.deftype=orddef) and (def_to^.deftype=orddef)) and
  749. (is_in_limit(def_from,def_to) or
  750. ((hp^.nextpara^.paratyp=vs_var) and
  751. (def_from^.size=def_to^.size))) then
  752. begin
  753. exactmatch:=true;
  754. conv_to:=def_to;
  755. end;
  756. end;
  757. hp:=hp^.next;
  758. end;
  759. { .... if yes, del all the other procedures }
  760. if exactmatch then
  761. begin
  762. { the first .... }
  763. while (assigned(procs)) and not(is_in_limit(def_from,procs^.nextpara^.data)) do
  764. begin
  765. hp:=procs^.next;
  766. dispose(procs);
  767. procs:=hp;
  768. end;
  769. { and the others }
  770. hp:=procs;
  771. while (assigned(hp)) and assigned(hp^.next) do
  772. begin
  773. if not(is_in_limit(def_from,hp^.next^.nextpara^.data)) then
  774. begin
  775. hp2:=hp^.next^.next;
  776. dispose(hp^.next);
  777. hp^.next:=hp2;
  778. end
  779. else
  780. begin
  781. def_to:=hp^.next^.nextpara^.data;
  782. if (conv_to^.size>def_to^.size) or
  783. ((porddef(conv_to)^.low<porddef(def_to)^.low) and
  784. (porddef(conv_to)^.high>porddef(def_to)^.high)) then
  785. begin
  786. hp2:=procs;
  787. procs:=hp;
  788. conv_to:=def_to;
  789. dispose(hp2);
  790. end
  791. else
  792. hp:=hp^.next;
  793. end;
  794. end;
  795. end;
  796. { update nextpara for all procedures }
  797. hp:=procs;
  798. while assigned(hp) do
  799. begin
  800. hp^.nextpara:=hp^.nextpara^.next;
  801. hp:=hp^.next;
  802. end;
  803. pt:=pt^.right;
  804. end;
  805. end;
  806. { let's try to eliminate equal if there is an exact match
  807. is there }
  808. if assigned(procs) and assigned(procs^.next) then
  809. begin
  810. { reset nextpara for all procs left }
  811. hp:=procs;
  812. while assigned(hp) do
  813. begin
  814. hp^.nextpara:=hp^.firstpara;
  815. hp:=hp^.next;
  816. end;
  817. pt:=p^.left;
  818. while assigned(pt) do
  819. begin
  820. if pt^.exact_match_found then
  821. begin
  822. hp:=procs;
  823. procs:=nil;
  824. while assigned(hp) do
  825. begin
  826. hp2:=hp^.next;
  827. { keep the exact matches, dispose the others }
  828. if (hp^.nextpara^.argconvtyp=act_exact) then
  829. begin
  830. hp^.next:=procs;
  831. procs:=hp;
  832. end
  833. else
  834. dispose(hp);
  835. hp:=hp2;
  836. end;
  837. end;
  838. { update nextpara for all procedures }
  839. hp:=procs;
  840. while assigned(hp) do
  841. begin
  842. hp^.nextpara:=hp^.nextpara^.next;
  843. hp:=hp^.next;
  844. end;
  845. pt:=pt^.right;
  846. end;
  847. end;
  848. { Check if there are convertlevel 1 and 2 differences
  849. left for the parameters, then discard all convertlevel
  850. 2 procedures. The value of convlevelXfound can still
  851. be used, because all convertables are still here or
  852. not }
  853. if assigned(procs) and assigned(procs^.next) then
  854. begin
  855. { reset nextpara for all procs left }
  856. hp:=procs;
  857. while assigned(hp) do
  858. begin
  859. hp^.nextpara:=hp^.firstpara;
  860. hp:=hp^.next;
  861. end;
  862. pt:=p^.left;
  863. while assigned(pt) do
  864. begin
  865. if pt^.convlevel1found and pt^.convlevel2found then
  866. begin
  867. hp:=procs;
  868. procs:=nil;
  869. while assigned(hp) do
  870. begin
  871. hp2:=hp^.next;
  872. { keep all not act_convertable and all convertlevels=1 }
  873. if (hp^.nextpara^.argconvtyp<>act_convertable) or
  874. (hp^.nextpara^.convertlevel=1) then
  875. begin
  876. hp^.next:=procs;
  877. procs:=hp;
  878. end
  879. else
  880. dispose(hp);
  881. hp:=hp2;
  882. end;
  883. end;
  884. { update nextpara for all procedures }
  885. hp:=procs;
  886. while assigned(hp) do
  887. begin
  888. hp^.nextpara:=hp^.nextpara^.next;
  889. hp:=hp^.next;
  890. end;
  891. pt:=pt^.right;
  892. end;
  893. end;
  894. if not(assigned(procs)) or assigned(procs^.next) then
  895. begin
  896. CGMessage(cg_e_cant_choose_overload_function);
  897. aktcallprocsym^.write_parameter_lists;
  898. goto errorexit;
  899. end;
  900. {$ifdef TEST_PROCSYMS}
  901. if (procs=nil) and assigned(nextprocsym) then
  902. begin
  903. p^.symtableprocentry:=nextprocsym;
  904. p^.symtableproc:=symt;
  905. end;
  906. end ; { of while assigned(p^.symtableprocentry) do }
  907. {$endif TEST_PROCSYMS}
  908. if make_ref then
  909. begin
  910. procs^.data^.lastref:=new(pref,init(procs^.data^.lastref,@p^.fileinfo));
  911. inc(procs^.data^.refcount);
  912. if procs^.data^.defref=nil then
  913. procs^.data^.defref:=procs^.data^.lastref;
  914. end;
  915. p^.procdefinition:=procs^.data;
  916. p^.resulttype:=procs^.data^.retdef;
  917. { big error for with statements
  918. p^.symtableproc:=p^.procdefinition^.owner;
  919. but neede for overloaded operators !! }
  920. if p^.symtableproc=nil then
  921. p^.symtableproc:=p^.procdefinition^.owner;
  922. p^.location.loc:=LOC_MEM;
  923. {$ifdef CHAINPROCSYMS}
  924. { object with method read;
  925. call to read(x) will be a usual procedure call }
  926. if assigned(p^.methodpointer) and
  927. (p^.procdefinition^._class=nil) then
  928. begin
  929. { not ok for extended }
  930. case p^.methodpointer^.treetype of
  931. typen,hnewn : fatalerror(no_para_match);
  932. end;
  933. disposetree(p^.methodpointer);
  934. p^.methodpointer:=nil;
  935. end;
  936. {$endif CHAINPROCSYMS}
  937. end; { end of procedure to call determination }
  938. is_const:=(pocall_internconst in p^.procdefinition^.proccalloptions) and
  939. ((block_type=bt_const) or
  940. (assigned(p^.left) and (p^.left^.left^.treetype in [realconstn,ordconstn])));
  941. { handle predefined procedures }
  942. if (pocall_internproc in p^.procdefinition^.proccalloptions) or is_const then
  943. begin
  944. if assigned(p^.left) then
  945. begin
  946. { settextbuf needs two args }
  947. if assigned(p^.left^.right) then
  948. pt:=geninlinenode(pprocdef(p^.procdefinition)^.extnumber,is_const,p^.left)
  949. else
  950. begin
  951. pt:=geninlinenode(pprocdef(p^.procdefinition)^.extnumber,is_const,p^.left^.left);
  952. putnode(p^.left);
  953. end;
  954. end
  955. else
  956. begin
  957. pt:=geninlinenode(pprocdef(p^.procdefinition)^.extnumber,is_const,nil);
  958. end;
  959. putnode(p);
  960. firstpass(pt);
  961. p:=pt;
  962. goto errorexit;
  963. end
  964. else
  965. { no intern procedure => we do a call }
  966. { calc the correture value for the register }
  967. { handle predefined procedures }
  968. if (pocall_inline in p^.procdefinition^.proccalloptions) then
  969. begin
  970. if assigned(p^.methodpointer) then
  971. CGMessage(cg_e_unable_inline_object_methods);
  972. if assigned(p^.right) and (p^.right^.treetype<>procinlinen) then
  973. CGMessage(cg_e_unable_inline_procvar);
  974. { p^.treetype:=procinlinen; }
  975. if not assigned(p^.right) then
  976. begin
  977. if assigned(pprocdef(p^.procdefinition)^.code) then
  978. inlinecode:=genprocinlinenode(p,ptree(pprocdef(p^.procdefinition)^.code))
  979. else
  980. CGMessage(cg_e_no_code_for_inline_stored);
  981. if assigned(inlinecode) then
  982. begin
  983. { consider it has not inlined if called
  984. again inside the args }
  985. {$ifdef INCLUDEOK}
  986. exclude(p^.procdefinition^.proccalloptions,pocall_inline);
  987. {$else}
  988. p^.procdefinition^.proccalloptions:=p^.procdefinition^.proccalloptions-[pocall_inline];
  989. {$endif}
  990. firstpass(inlinecode);
  991. inlined:=true;
  992. end;
  993. end;
  994. end
  995. else
  996. procinfo^.flags:=procinfo^.flags or pi_do_call;
  997. if (po_interrupt in p^.procdefinition^.procoptions) then
  998. CGmessage1(cg_e_no_call_to_interrupt,p^.symtableprocentry^.name);
  999. { work trough all parameters to insert the type conversions }
  1000. { !!! done now after internproc !! (PM) }
  1001. if assigned(p^.left) then
  1002. begin
  1003. old_count_ref:=count_ref;
  1004. count_ref:=true;
  1005. firstcallparan(p^.left,p^.procdefinition^.para1);
  1006. count_ref:=old_count_ref;
  1007. end;
  1008. {$ifdef i386}
  1009. for regi:=R_EAX to R_EDI do
  1010. begin
  1011. if (pprocdef(p^.procdefinition)^.usedregisters and ($80 shr word(regi)))<>0 then
  1012. inc(reg_pushes[regi],t_times*2);
  1013. end;
  1014. {$endif}
  1015. {$ifdef m68k}
  1016. for regi:=R_D0 to R_A6 do
  1017. begin
  1018. if (pprocdef(p^.procdefinition)^.usedregisters and ($800 shr word(regi)))<>0 then
  1019. inc(reg_pushes[regi],t_times*2);
  1020. end;
  1021. {$endif}
  1022. end;
  1023. { ensure that the result type is set }
  1024. p^.resulttype:=p^.procdefinition^.retdef;
  1025. { get a register for the return value }
  1026. if (p^.resulttype<>pdef(voiddef)) then
  1027. begin
  1028. if (p^.procdefinition^.proctypeoption=potype_constructor) then
  1029. begin
  1030. { extra handling of classes }
  1031. { p^.methodpointer should be assigned! }
  1032. if assigned(p^.methodpointer) and assigned(p^.methodpointer^.resulttype) and
  1033. (p^.methodpointer^.resulttype^.deftype=classrefdef) then
  1034. begin
  1035. p^.location.loc:=LOC_REGISTER;
  1036. p^.registers32:=1;
  1037. { the result type depends on the classref }
  1038. p^.resulttype:=pclassrefdef(p^.methodpointer^.resulttype)^.definition;
  1039. end
  1040. { a object constructor returns the result with the flags }
  1041. else
  1042. p^.location.loc:=LOC_FLAGS;
  1043. end
  1044. else
  1045. begin
  1046. {$ifdef SUPPORT_MMX}
  1047. if (cs_mmx in aktlocalswitches) and
  1048. is_mmx_able_array(p^.resulttype) then
  1049. begin
  1050. p^.location.loc:=LOC_MMXREGISTER;
  1051. p^.registersmmx:=1;
  1052. end
  1053. else
  1054. {$endif SUPPORT_MMX}
  1055. if ret_in_acc(p^.resulttype) then
  1056. begin
  1057. p^.location.loc:=LOC_REGISTER;
  1058. if is_64bitint(p^.resulttype) then
  1059. p^.registers32:=2
  1060. else
  1061. p^.registers32:=1;
  1062. { wide- and ansistrings are returned in EAX }
  1063. { but they are imm. moved to a memory location }
  1064. if is_widestring(p^.resulttype) or
  1065. is_ansistring(p^.resulttype) then
  1066. begin
  1067. p^.location.loc:=LOC_MEM;
  1068. { this is wrong we still need one register PM
  1069. p^.registers32:=0; }
  1070. p^.registers32:=1;
  1071. end;
  1072. end
  1073. else if (p^.resulttype^.deftype=floatdef) then
  1074. begin
  1075. p^.location.loc:=LOC_FPU;
  1076. p^.registersfpu:=1;
  1077. end
  1078. else
  1079. p^.location.loc:=LOC_MEM;
  1080. end;
  1081. end;
  1082. must_be_valid:=store_valid;
  1083. { a fpu can be used in any procedure !! }
  1084. p^.registersfpu:=p^.procdefinition^.fpu_used;
  1085. { if this is a call to a method calc the registers }
  1086. if (p^.methodpointer<>nil) then
  1087. begin
  1088. case p^.methodpointer^.treetype of
  1089. { but only, if this is not a supporting node }
  1090. typen: ;
  1091. { we need one register for new return value PM }
  1092. hnewn : if p^.registers32=0 then
  1093. p^.registers32:=1;
  1094. else
  1095. begin
  1096. if (p^.procdefinition^.proctypeoption in [potype_constructor,potype_destructor]) and
  1097. assigned(p^.symtable) and (p^.symtable^.symtabletype=withsymtable) and
  1098. not pwithsymtable(p^.symtable)^.direct_with then
  1099. begin
  1100. CGmessage(cg_e_cannot_call_cons_dest_inside_with);
  1101. end; { Is accepted by Delphi !! }
  1102. { this is not a good reason to accept it in FPC if we produce
  1103. wrong code for it !!! (PM) }
  1104. { R.Assign is not a constructor !!! }
  1105. { but for R^.Assign, R must be valid !! }
  1106. if (p^.procdefinition^.proctypeoption=potype_constructor) or
  1107. ((p^.methodpointer^.treetype=loadn) and
  1108. (not(oo_has_virtual in pobjectdef(p^.methodpointer^.resulttype)^.objectoptions))) then
  1109. must_be_valid:=false;
  1110. {
  1111. else
  1112. must_be_valid:=true;
  1113. }
  1114. firstpass(p^.methodpointer);
  1115. p^.registersfpu:=max(p^.methodpointer^.registersfpu,p^.registersfpu);
  1116. p^.registers32:=max(p^.methodpointer^.registers32,p^.registers32);
  1117. {$ifdef SUPPORT_MMX}
  1118. p^.registersmmx:=max(p^.methodpointer^.registersmmx,p^.registersmmx);
  1119. {$endif SUPPORT_MMX}
  1120. end;
  1121. end;
  1122. end;
  1123. if inlined then
  1124. p^.right:=inlinecode;
  1125. { determine the registers of the procedure variable }
  1126. { is this OK for inlined procs also ?? (PM) }
  1127. if assigned(p^.right) then
  1128. begin
  1129. p^.registersfpu:=max(p^.right^.registersfpu,p^.registersfpu);
  1130. p^.registers32:=max(p^.right^.registers32,p^.registers32);
  1131. {$ifdef SUPPORT_MMX}
  1132. p^.registersmmx:=max(p^.right^.registersmmx,p^.registersmmx);
  1133. {$endif SUPPORT_MMX}
  1134. end;
  1135. { determine the registers of the procedure }
  1136. if assigned(p^.left) then
  1137. begin
  1138. p^.registersfpu:=max(p^.left^.registersfpu,p^.registersfpu);
  1139. p^.registers32:=max(p^.left^.registers32,p^.registers32);
  1140. {$ifdef SUPPORT_MMX}
  1141. p^.registersmmx:=max(p^.left^.registersmmx,p^.registersmmx);
  1142. {$endif SUPPORT_MMX}
  1143. end;
  1144. errorexit:
  1145. { Reset some settings back }
  1146. if assigned(procs) then
  1147. dispose(procs);
  1148. if inlined then
  1149. {$ifdef INCLUDEOK}
  1150. include(p^.procdefinition^.proccalloptions,pocall_inline);
  1151. {$else}
  1152. p^.procdefinition^.proccalloptions:=p^.procdefinition^.proccalloptions+[pocall_inline];
  1153. {$endif}
  1154. aktcallprocsym:=oldcallprocsym;
  1155. end;
  1156. {*****************************************************************************
  1157. FirstProcInlineN
  1158. *****************************************************************************}
  1159. procedure firstprocinline(var p : ptree);
  1160. begin
  1161. { left contains the code in tree form }
  1162. { but it has already been firstpassed }
  1163. { so firstpass(p^.left); does not seem required }
  1164. { might be required later if we change the arg handling !! }
  1165. end;
  1166. end.
  1167. {
  1168. $Log$
  1169. Revision 1.69 1999-10-22 14:37:30 peter
  1170. * error when properties are passed to var parameters
  1171. Revision 1.68 1999/10/13 10:35:27 peter
  1172. * var must match exactly error msg extended with got and expected type
  1173. * array constructor type check now gives error on wrong types
  1174. Revision 1.67 1999/10/12 15:50:54 pierre
  1175. * error if calling interrupt procedure
  1176. Revision 1.66 1999/09/27 23:45:00 peter
  1177. * procinfo is now a pointer
  1178. * support for result setting in sub procedure
  1179. Revision 1.65 1999/09/16 23:05:56 florian
  1180. * m68k compiler is again compilable (only gas writer, no assembler reader)
  1181. Revision 1.64 1999/09/14 07:59:48 florian
  1182. * finally!? fixed
  1183. with <function with result in temp> do
  1184. My last and also Peter's fix before were wrong :(
  1185. Revision 1.63 1999/09/10 18:48:11 florian
  1186. * some bug fixes (e.g. must_be_valid and procinfo^.funcret_is_valid)
  1187. * most things for stored properties fixed
  1188. Revision 1.62 1999/08/23 23:42:52 pierre
  1189. * hnewn reg allocation corrected
  1190. Revision 1.61 1999/08/17 13:26:08 peter
  1191. * arrayconstructor -> arrayofconst fixed when arraycosntructor was not
  1192. variant.
  1193. Revision 1.60 1999/08/16 23:23:39 peter
  1194. * arrayconstructor -> openarray type conversions for element types
  1195. Revision 1.59 1999/08/13 21:33:16 peter
  1196. * support for array constructors extended and more error checking
  1197. Revision 1.58 1999/08/12 14:34:28 peter
  1198. * tp_procvar mode call->loadn fixed
  1199. Revision 1.57 1999/08/05 16:53:19 peter
  1200. * V_Fatal=1, all other V_ are also increased
  1201. * Check for local procedure when assigning procvar
  1202. * fixed comment parsing because directives
  1203. * oldtp mode directives better supported
  1204. * added some messages to errore.msg
  1205. Revision 1.56 1999/08/04 00:23:34 florian
  1206. * renamed i386asm and i386base to cpuasm and cpubase
  1207. Revision 1.55 1999/08/03 22:03:27 peter
  1208. * moved bitmask constants to sets
  1209. * some other type/const renamings
  1210. Revision 1.54 1999/07/01 21:33:58 peter
  1211. * merged
  1212. Revision 1.53 1999/06/29 14:02:33 peter
  1213. * merged file pos fixes
  1214. Revision 1.52 1999/06/29 12:16:22 pierre
  1215. * mereg from fixes-0_99_12
  1216. Revision 1.51.2.3 1999/07/01 21:32:01 peter
  1217. * procvar fixes again
  1218. Revision 1.51.2.2 1999/06/29 12:12:13 pierre
  1219. * fix for bug0272
  1220. Revision 1.51.2.1 1999/06/28 00:33:47 pierre
  1221. * better error position bug0269
  1222. Revision 1.51 1999/06/01 19:27:57 peter
  1223. * better checks for procvar and methodpointer
  1224. Revision 1.50 1999/06/01 14:46:00 peter
  1225. * @procvar is now always needed for FPC
  1226. Revision 1.49 1999/05/31 20:34:51 peter
  1227. * fixed hightree generation when loading highSYM
  1228. Revision 1.48 1999/05/27 19:45:13 peter
  1229. * removed oldasm
  1230. * plabel -> pasmlabel
  1231. * -a switches to source writing automaticly
  1232. * assembler readers OOPed
  1233. * asmsymbol automaticly external
  1234. * jumptables and other label fixes for asm readers
  1235. Revision 1.47 1999/05/23 18:42:19 florian
  1236. * better error recovering in typed constants
  1237. * some problems with arrays of const fixed, some problems
  1238. due my previous
  1239. - the location type of array constructor is now LOC_MEM
  1240. - the pushing of high fixed
  1241. - parameter copying fixed
  1242. - zero temp. allocation removed
  1243. * small problem in the assembler writers fixed:
  1244. ref to nil wasn't written correctly
  1245. Revision 1.46 1999/05/20 14:58:27 peter
  1246. * fixed arrayconstruct->set conversion which didn't work for enum sets
  1247. Revision 1.45 1999/05/19 10:31:54 florian
  1248. * two bugs reported by Romio (bugs 13) are fixed:
  1249. - empty array constructors are now handled correctly (e.g. for sysutils.format)
  1250. - comparsion of ansistrings was sometimes coded wrong
  1251. Revision 1.44 1999/05/18 21:58:33 florian
  1252. * fixed some bugs related to temp. ansistrings and functions results
  1253. which return records/objects/arrays which need init/final.
  1254. Revision 1.43 1999/05/18 14:15:58 peter
  1255. * containsself fixes
  1256. * checktypes()
  1257. Revision 1.42 1999/05/17 23:51:43 peter
  1258. * with temp vars now use a reference with a persistant temp instead
  1259. of setting datasize
  1260. Revision 1.41 1999/05/13 21:59:50 peter
  1261. * removed oldppu code
  1262. * warning if objpas is loaded from uses
  1263. * first things for new deref writing
  1264. Revision 1.40 1999/05/10 09:01:45 peter
  1265. * small message fixes
  1266. Revision 1.39 1999/05/02 09:35:46 florian
  1267. + method message handlers which contain an explicit self can't be called
  1268. directly anymore
  1269. + self is now loaded at the start of the an message handler with an explicit
  1270. self
  1271. + $useoverlay fixed: i386 was renamed to i386base
  1272. Revision 1.38 1999/05/01 13:24:47 peter
  1273. * merged nasm compiler
  1274. * old asm moved to oldasm/
  1275. Revision 1.37 1999/04/26 13:31:57 peter
  1276. * release storenumber,double_checksum
  1277. Revision 1.36 1999/04/26 09:30:46 peter
  1278. * small tp7 fix
  1279. * fix void pointer with formaldef
  1280. Revision 1.35 1999/04/21 21:49:18 pierre
  1281. * previous log corrected
  1282. Revision 1.34 1999/04/21 16:31:46 pierre
  1283. * checks for untyped var or const args
  1284. (refuse procsyms as var, types or voiddef as const)
  1285. Revision 1.33 1999/04/21 09:44:00 peter
  1286. * storenumber works
  1287. * fixed some typos in double_checksum
  1288. + incompatible types type1 and type2 message (with storenumber)
  1289. Revision 1.32 1999/04/14 09:11:22 peter
  1290. * fixed tp proc -> procvar
  1291. Revision 1.31 1999/04/01 21:59:56 peter
  1292. * type error for array constructor with array,record as argument
  1293. Revision 1.30 1999/03/31 13:55:27 peter
  1294. * assembler inlining working for ag386bin
  1295. Revision 1.29 1999/03/24 23:17:34 peter
  1296. * fixed bugs 212,222,225,227,229,231,233
  1297. Revision 1.28 1999/03/23 14:43:03 peter
  1298. * fixed crash with array of const in procvar
  1299. Revision 1.27 1999/03/19 17:31:54 pierre
  1300. * lost reference because refcount not increased fixed
  1301. Revision 1.26 1999/03/02 18:24:22 peter
  1302. * fixed overloading of array of char
  1303. Revision 1.25 1999/02/22 15:09:44 florian
  1304. * behaviaor of PROTECTED and PRIVATE fixed, works now like TP/Delphi
  1305. Revision 1.24 1999/02/22 02:15:45 peter
  1306. * updates for ag386bin
  1307. Revision 1.23 1999/02/09 17:15:52 florian
  1308. * some false warnings "function result doesn't seems to be set" are
  1309. avoided
  1310. Revision 1.22 1999/01/29 11:34:55 pierre
  1311. + better info for impossible type conversion in calln
  1312. Revision 1.21 1999/01/21 22:10:49 peter
  1313. * fixed array of const
  1314. * generic platform independent high() support
  1315. Revision 1.20 1999/01/21 16:41:06 pierre
  1316. * fix for constructor inside with statements
  1317. Revision 1.19 1999/01/19 14:20:16 peter
  1318. * fixed [char] crash
  1319. Revision 1.18 1999/01/12 14:25:40 peter
  1320. + BrowserLog for browser.log generation
  1321. + BrowserCol for browser info in TCollections
  1322. * released all other UseBrowser
  1323. Revision 1.17 1998/12/11 00:03:52 peter
  1324. + globtype,tokens,version unit splitted from globals
  1325. Revision 1.16 1998/12/10 14:57:52 pierre
  1326. * fix for operators
  1327. Revision 1.15 1998/12/10 09:47:32 florian
  1328. + basic operations with int64/qord (compiler with -dint64)
  1329. + rtti of enumerations extended: names are now written
  1330. Revision 1.14 1998/11/27 14:50:52 peter
  1331. + open strings, $P switch support
  1332. Revision 1.13 1998/11/24 17:03:51 peter
  1333. * fixed exactmatch removings
  1334. Revision 1.12 1998/11/16 10:18:10 peter
  1335. * fixes for ansistrings
  1336. Revision 1.11 1998/11/10 10:09:17 peter
  1337. * va_list -> array of const
  1338. Revision 1.10 1998/11/09 11:44:41 peter
  1339. + va_list for printf support
  1340. Revision 1.9 1998/10/28 18:26:22 pierre
  1341. * removed some erros after other errors (introduced by useexcept)
  1342. * stabs works again correctly (for how long !)
  1343. Revision 1.8 1998/10/09 16:36:09 pierre
  1344. * some memory leaks specific to usebrowser define fixed
  1345. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  1346. Revision 1.7 1998/10/06 20:49:09 peter
  1347. * m68k compiler compiles again
  1348. Revision 1.6 1998/10/02 09:24:22 peter
  1349. * more constant expression evaluators
  1350. Revision 1.5 1998/09/28 11:22:17 pierre
  1351. * did not compile for browser
  1352. * merge from fixes
  1353. Revision 1.4 1998/09/27 10:16:24 florian
  1354. * type casts pchar<->ansistring fixed
  1355. * ansistring[..] calls does now an unique call
  1356. Revision 1.3 1998/09/24 14:27:40 peter
  1357. * some better support for openarray
  1358. Revision 1.2 1998/09/24 09:02:16 peter
  1359. * rewritten isconvertable to use case
  1360. * array of .. and single variable are compatible
  1361. Revision 1.1 1998/09/23 20:42:24 peter
  1362. * splitted pass_1
  1363. }