tccal.pas 60 KB

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