tccal.pas 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478
  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.65 1999-09-16 23:05:56 florian
  1164. * m68k compiler is again compilable (only gas writer, no assembler reader)
  1165. Revision 1.64 1999/09/14 07:59:48 florian
  1166. * finally!? fixed
  1167. with <function with result in temp> do
  1168. My last and also Peter's fix before were wrong :(
  1169. Revision 1.63 1999/09/10 18:48:11 florian
  1170. * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
  1171. * most things for stored properties fixed
  1172. Revision 1.62 1999/08/23 23:42:52 pierre
  1173. * hnewn reg allocation corrected
  1174. Revision 1.61 1999/08/17 13:26:08 peter
  1175. * arrayconstructor -> arrayofconst fixed when arraycosntructor was not
  1176. variant.
  1177. Revision 1.60 1999/08/16 23:23:39 peter
  1178. * arrayconstructor -> openarray type conversions for element types
  1179. Revision 1.59 1999/08/13 21:33:16 peter
  1180. * support for array constructors extended and more error checking
  1181. Revision 1.58 1999/08/12 14:34:28 peter
  1182. * tp_procvar mode call->loadn fixed
  1183. Revision 1.57 1999/08/05 16:53:19 peter
  1184. * V_Fatal=1, all other V_ are also increased
  1185. * Check for local procedure when assigning procvar
  1186. * fixed comment parsing because directives
  1187. * oldtp mode directives better supported
  1188. * added some messages to errore.msg
  1189. Revision 1.56 1999/08/04 00:23:34 florian
  1190. * renamed i386asm and i386base to cpuasm and cpubase
  1191. Revision 1.55 1999/08/03 22:03:27 peter
  1192. * moved bitmask constants to sets
  1193. * some other type/const renamings
  1194. Revision 1.54 1999/07/01 21:33:58 peter
  1195. * merged
  1196. Revision 1.53 1999/06/29 14:02:33 peter
  1197. * merged file pos fixes
  1198. Revision 1.52 1999/06/29 12:16:22 pierre
  1199. * mereg from fixes-0_99_12
  1200. Revision 1.51.2.3 1999/07/01 21:32:01 peter
  1201. * procvar fixes again
  1202. Revision 1.51.2.2 1999/06/29 12:12:13 pierre
  1203. * fix for bug0272
  1204. Revision 1.51.2.1 1999/06/28 00:33:47 pierre
  1205. * better error position bug0269
  1206. Revision 1.51 1999/06/01 19:27:57 peter
  1207. * better checks for procvar and methodpointer
  1208. Revision 1.50 1999/06/01 14:46:00 peter
  1209. * @procvar is now always needed for FPC
  1210. Revision 1.49 1999/05/31 20:34:51 peter
  1211. * fixed hightree generation when loading highSYM
  1212. Revision 1.48 1999/05/27 19:45:13 peter
  1213. * removed oldasm
  1214. * plabel -> pasmlabel
  1215. * -a switches to source writing automaticly
  1216. * assembler readers OOPed
  1217. * asmsymbol automaticly external
  1218. * jumptables and other label fixes for asm readers
  1219. Revision 1.47 1999/05/23 18:42:19 florian
  1220. * better error recovering in typed constants
  1221. * some problems with arrays of const fixed, some problems
  1222. due my previous
  1223. - the location type of array constructor is now LOC_MEM
  1224. - the pushing of high fixed
  1225. - parameter copying fixed
  1226. - zero temp. allocation removed
  1227. * small problem in the assembler writers fixed:
  1228. ref to nil wasn't written correctly
  1229. Revision 1.46 1999/05/20 14:58:27 peter
  1230. * fixed arrayconstruct->set conversion which didn't work for enum sets
  1231. Revision 1.45 1999/05/19 10:31:54 florian
  1232. * two bugs reported by Romio (bugs 13) are fixed:
  1233. - empty array constructors are now handled correctly (e.g. for sysutils.format)
  1234. - comparsion of ansistrings was sometimes coded wrong
  1235. Revision 1.44 1999/05/18 21:58:33 florian
  1236. * fixed some bugs related to temp. ansistrings and functions results
  1237. which return records/objects/arrays which need init/final.
  1238. Revision 1.43 1999/05/18 14:15:58 peter
  1239. * containsself fixes
  1240. * checktypes()
  1241. Revision 1.42 1999/05/17 23:51:43 peter
  1242. * with temp vars now use a reference with a persistant temp instead
  1243. of setting datasize
  1244. Revision 1.41 1999/05/13 21:59:50 peter
  1245. * removed oldppu code
  1246. * warning if objpas is loaded from uses
  1247. * first things for new deref writing
  1248. Revision 1.40 1999/05/10 09:01:45 peter
  1249. * small message fixes
  1250. Revision 1.39 1999/05/02 09:35:46 florian
  1251. + method message handlers which contain an explicit self can't be called
  1252. directly anymore
  1253. + self is now loaded at the start of the an message handler with an explicit
  1254. self
  1255. + $useoverlay fixed: i386 was renamed to i386base
  1256. Revision 1.38 1999/05/01 13:24:47 peter
  1257. * merged nasm compiler
  1258. * old asm moved to oldasm/
  1259. Revision 1.37 1999/04/26 13:31:57 peter
  1260. * release storenumber,double_checksum
  1261. Revision 1.36 1999/04/26 09:30:46 peter
  1262. * small tp7 fix
  1263. * fix void pointer with formaldef
  1264. Revision 1.35 1999/04/21 21:49:18 pierre
  1265. * previous log corrected
  1266. Revision 1.34 1999/04/21 16:31:46 pierre
  1267. * checks for untyped var or const args
  1268. (refuse procsyms as var, types or voiddef as const)
  1269. Revision 1.33 1999/04/21 09:44:00 peter
  1270. * storenumber works
  1271. * fixed some typos in double_checksum
  1272. + incompatible types type1 and type2 message (with storenumber)
  1273. Revision 1.32 1999/04/14 09:11:22 peter
  1274. * fixed tp proc -> procvar
  1275. Revision 1.31 1999/04/01 21:59:56 peter
  1276. * type error for array constructor with array,record as argument
  1277. Revision 1.30 1999/03/31 13:55:27 peter
  1278. * assembler inlining working for ag386bin
  1279. Revision 1.29 1999/03/24 23:17:34 peter
  1280. * fixed bugs 212,222,225,227,229,231,233
  1281. Revision 1.28 1999/03/23 14:43:03 peter
  1282. * fixed crash with array of const in procvar
  1283. Revision 1.27 1999/03/19 17:31:54 pierre
  1284. * lost reference because refcount not increased fixed
  1285. Revision 1.26 1999/03/02 18:24:22 peter
  1286. * fixed overloading of array of char
  1287. Revision 1.25 1999/02/22 15:09:44 florian
  1288. * behaviaor of PROTECTED and PRIVATE fixed, works now like TP/Delphi
  1289. Revision 1.24 1999/02/22 02:15:45 peter
  1290. * updates for ag386bin
  1291. Revision 1.23 1999/02/09 17:15:52 florian
  1292. * some false warnings "function result doesn't seems to be set" are
  1293. avoided
  1294. Revision 1.22 1999/01/29 11:34:55 pierre
  1295. + better info for impossible type conversion in calln
  1296. Revision 1.21 1999/01/21 22:10:49 peter
  1297. * fixed array of const
  1298. * generic platform independent high() support
  1299. Revision 1.20 1999/01/21 16:41:06 pierre
  1300. * fix for constructor inside with statements
  1301. Revision 1.19 1999/01/19 14:20:16 peter
  1302. * fixed [char] crash
  1303. Revision 1.18 1999/01/12 14:25:40 peter
  1304. + BrowserLog for browser.log generation
  1305. + BrowserCol for browser info in TCollections
  1306. * released all other UseBrowser
  1307. Revision 1.17 1998/12/11 00:03:52 peter
  1308. + globtype,tokens,version unit splitted from globals
  1309. Revision 1.16 1998/12/10 14:57:52 pierre
  1310. * fix for operators
  1311. Revision 1.15 1998/12/10 09:47:32 florian
  1312. + basic operations with int64/qord (compiler with -dint64)
  1313. + rtti of enumerations extended: names are now written
  1314. Revision 1.14 1998/11/27 14:50:52 peter
  1315. + open strings, $P switch support
  1316. Revision 1.13 1998/11/24 17:03:51 peter
  1317. * fixed exactmatch removings
  1318. Revision 1.12 1998/11/16 10:18:10 peter
  1319. * fixes for ansistrings
  1320. Revision 1.11 1998/11/10 10:09:17 peter
  1321. * va_list -> array of const
  1322. Revision 1.10 1998/11/09 11:44:41 peter
  1323. + va_list for printf support
  1324. Revision 1.9 1998/10/28 18:26:22 pierre
  1325. * removed some erros after other errors (introduced by useexcept)
  1326. * stabs works again correctly (for how long !)
  1327. Revision 1.8 1998/10/09 16:36:09 pierre
  1328. * some memory leaks specific to usebrowser define fixed
  1329. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  1330. Revision 1.7 1998/10/06 20:49:09 peter
  1331. * m68k compiler compiles again
  1332. Revision 1.6 1998/10/02 09:24:22 peter
  1333. * more constant expression evaluators
  1334. Revision 1.5 1998/09/28 11:22:17 pierre
  1335. * did not compile for browser
  1336. * merge from fixes
  1337. Revision 1.4 1998/09/27 10:16:24 florian
  1338. * type casts pchar<->ansistring fixed
  1339. * ansistring[..] calls does now an unique call
  1340. Revision 1.3 1998/09/24 14:27:40 peter
  1341. * some better support for openarray
  1342. Revision 1.2 1998/09/24 09:02:16 peter
  1343. * rewritten isconvertable to use case
  1344. * array of .. and single variable are compatible
  1345. Revision 1.1 1998/09/23 20:42:24 peter
  1346. * splitted pass_1
  1347. }