tccal.pas 58 KB

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