tccal.pas 59 KB

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