cg386flw.pas 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Generate i386 assembler for nodes that influence the flow
  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 cg386flw;
  19. interface
  20. uses
  21. tree;
  22. procedure second_while_repeatn(var p : ptree);
  23. procedure secondifn(var p : ptree);
  24. procedure secondfor(var p : ptree);
  25. procedure secondexitn(var p : ptree);
  26. procedure secondbreakn(var p : ptree);
  27. procedure secondcontinuen(var p : ptree);
  28. procedure secondgoto(var p : ptree);
  29. procedure secondlabel(var p : ptree);
  30. procedure secondraise(var p : ptree);
  31. procedure secondtryexcept(var p : ptree);
  32. procedure secondtryfinally(var p : ptree);
  33. procedure secondon(var p : ptree);
  34. procedure secondfail(var p : ptree);
  35. type
  36. tenumflowcontrol = (fc_exit,fc_break,fc_continue);
  37. tflowcontrol = set of tenumflowcontrol;
  38. var
  39. flowcontrol : tflowcontrol;
  40. implementation
  41. uses
  42. cobjects,verbose,globtype,globals,systems,
  43. symconst,symtable,aasm,types,
  44. hcodegen,temp_gen,pass_2,
  45. cpubase,cpuasm,
  46. cgai386,tgeni386,tcflw;
  47. {*****************************************************************************
  48. Second_While_RepeatN
  49. *****************************************************************************}
  50. procedure second_while_repeatn(var p : ptree);
  51. var
  52. lcont,lbreak,lloop,
  53. oldclabel,oldblabel : pasmlabel;
  54. otlabel,oflabel : pasmlabel;
  55. begin
  56. getlabel(lloop);
  57. getlabel(lcont);
  58. getlabel(lbreak);
  59. { arrange continue and breaklabels: }
  60. oldclabel:=aktcontinuelabel;
  61. oldblabel:=aktbreaklabel;
  62. { handling code at the end as it is much more efficient, and makes
  63. while equal to repeat loop, only the end true/false is swapped (PFV) }
  64. if p^.treetype=whilen then
  65. emitjmp(C_None,lcont);
  66. emitlab(lloop);
  67. aktcontinuelabel:=lcont;
  68. aktbreaklabel:=lbreak;
  69. cleartempgen;
  70. if assigned(p^.right) then
  71. secondpass(p^.right);
  72. emitlab(lcont);
  73. otlabel:=truelabel;
  74. oflabel:=falselabel;
  75. if p^.treetype=whilen then
  76. begin
  77. truelabel:=lloop;
  78. falselabel:=lbreak;
  79. end
  80. { repeatn }
  81. else
  82. begin
  83. truelabel:=lbreak;
  84. falselabel:=lloop;
  85. end;
  86. cleartempgen;
  87. secondpass(p^.left);
  88. maketojumpbool(p^.left);
  89. emitlab(lbreak);
  90. truelabel:=otlabel;
  91. falselabel:=oflabel;
  92. aktcontinuelabel:=oldclabel;
  93. aktbreaklabel:=oldblabel;
  94. { a break/continue in a while/repeat block can't be seen outside }
  95. flowcontrol:=flowcontrol-[fc_break,fc_continue];
  96. end;
  97. {*****************************************************************************
  98. SecondIfN
  99. *****************************************************************************}
  100. procedure secondifn(var p : ptree);
  101. var
  102. hl,otlabel,oflabel : pasmlabel;
  103. begin
  104. otlabel:=truelabel;
  105. oflabel:=falselabel;
  106. getlabel(truelabel);
  107. getlabel(falselabel);
  108. cleartempgen;
  109. secondpass(p^.left);
  110. maketojumpbool(p^.left);
  111. if assigned(p^.right) then
  112. begin
  113. emitlab(truelabel);
  114. cleartempgen;
  115. secondpass(p^.right);
  116. end;
  117. if assigned(p^.t1) then
  118. begin
  119. if assigned(p^.right) then
  120. begin
  121. getlabel(hl);
  122. { do go back to if line !! }
  123. aktfilepos:=exprasmlist^.getlasttaifilepos^;
  124. emitjmp(C_None,hl);
  125. end;
  126. emitlab(falselabel);
  127. cleartempgen;
  128. secondpass(p^.t1);
  129. if assigned(p^.right) then
  130. emitlab(hl);
  131. end
  132. else
  133. begin
  134. emitlab(falselabel);
  135. end;
  136. if not(assigned(p^.right)) then
  137. begin
  138. emitlab(truelabel);
  139. end;
  140. truelabel:=otlabel;
  141. falselabel:=oflabel;
  142. end;
  143. {*****************************************************************************
  144. SecondFor
  145. *****************************************************************************}
  146. procedure secondfor(var p : ptree);
  147. var
  148. l3,oldclabel,oldblabel : pasmlabel;
  149. omitfirstcomp,temptovalue : boolean;
  150. hs : byte;
  151. temp1 : treference;
  152. hop : tasmop;
  153. hcond : tasmcond;
  154. cmpreg,cmp32 : tregister;
  155. opsize : topsize;
  156. count_var_is_signed : boolean;
  157. begin
  158. oldclabel:=aktcontinuelabel;
  159. oldblabel:=aktbreaklabel;
  160. getlabel(aktcontinuelabel);
  161. getlabel(aktbreaklabel);
  162. getlabel(l3);
  163. { could we spare the first comparison ? }
  164. omitfirstcomp:=false;
  165. if p^.right^.treetype=ordconstn then
  166. if p^.left^.right^.treetype=ordconstn then
  167. omitfirstcomp:=(p^.backward and (p^.left^.right^.value>=p^.right^.value))
  168. or (not(p^.backward) and (p^.left^.right^.value<=p^.right^.value));
  169. { only calculate reference }
  170. cleartempgen;
  171. secondpass(p^.t2);
  172. hs:=p^.t2^.resulttype^.size;
  173. cmp32:=getregister32;
  174. case hs of
  175. 1 : begin
  176. opsize:=S_B;
  177. cmpreg:=reg32toreg8(cmp32);
  178. end;
  179. 2 : begin
  180. opsize:=S_W;
  181. cmpreg:=reg32toreg16(cmp32);
  182. end;
  183. 4 : begin
  184. opsize:=S_L;
  185. cmpreg:=cmp32;
  186. end;
  187. end;
  188. { first set the to value
  189. because the count var can be in the expression !! }
  190. cleartempgen;
  191. secondpass(p^.right);
  192. { calculate pointer value and check if changeable and if so }
  193. { load into temporary variable }
  194. if p^.right^.treetype<>ordconstn then
  195. begin
  196. temp1.symbol:=nil;
  197. gettempofsizereference(hs,temp1);
  198. temptovalue:=true;
  199. if (p^.right^.location.loc=LOC_REGISTER) or
  200. (p^.right^.location.loc=LOC_CREGISTER) then
  201. begin
  202. emit_reg_ref(A_MOV,opsize,p^.right^.location.register,
  203. newreference(temp1));
  204. end
  205. else
  206. concatcopy(p^.right^.location.reference,temp1,hs,false,false);
  207. end
  208. else
  209. temptovalue:=false;
  210. { produce start assignment }
  211. cleartempgen;
  212. secondpass(p^.left);
  213. count_var_is_signed:=is_signed(porddef(p^.t2^.resulttype));
  214. if temptovalue then
  215. begin
  216. if p^.t2^.location.loc=LOC_CREGISTER then
  217. begin
  218. emit_ref_reg(A_CMP,opsize,newreference(temp1),
  219. p^.t2^.location.register);
  220. end
  221. else
  222. begin
  223. emit_ref_reg(A_MOV,opsize,newreference(p^.t2^.location.reference),
  224. cmpreg);
  225. emit_ref_reg(A_CMP,opsize,newreference(temp1),
  226. cmpreg);
  227. end;
  228. end
  229. else
  230. begin
  231. if not(omitfirstcomp) then
  232. begin
  233. if p^.t2^.location.loc=LOC_CREGISTER then
  234. emit_const_reg(A_CMP,opsize,p^.right^.value,
  235. p^.t2^.location.register)
  236. else
  237. emit_const_ref(A_CMP,opsize,p^.right^.value,
  238. newreference(p^.t2^.location.reference));
  239. end;
  240. end;
  241. if p^.backward then
  242. if count_var_is_signed then
  243. hcond:=C_L
  244. else
  245. hcond:=C_B
  246. else
  247. if count_var_is_signed then
  248. hcond:=C_G
  249. else
  250. hcond:=C_A;
  251. if not(omitfirstcomp) or temptovalue then
  252. emitjmp(hcond,aktbreaklabel);
  253. { align loop target }
  254. if not(cs_littlesize in aktglobalswitches) then
  255. exprasmlist^.concat(new(pai_align,init_op(4,$90)));
  256. emitlab(l3);
  257. { help register must not be in instruction block }
  258. cleartempgen;
  259. if assigned(p^.t1) then
  260. secondpass(p^.t1);
  261. emitlab(aktcontinuelabel);
  262. { makes no problems there }
  263. cleartempgen;
  264. { demand help register again }
  265. cmp32:=getregister32;
  266. case hs of
  267. 1 : begin
  268. opsize:=S_B;
  269. cmpreg:=reg32toreg8(cmp32);
  270. end;
  271. 2 : begin
  272. opsize:=S_W;
  273. cmpreg:=reg32toreg16(cmp32);
  274. end;
  275. 4 : opsize:=S_L;
  276. end;
  277. { produce comparison and the corresponding }
  278. { jump }
  279. if temptovalue then
  280. begin
  281. if p^.t2^.location.loc=LOC_CREGISTER then
  282. begin
  283. emit_ref_reg(A_CMP,opsize,newreference(temp1),
  284. p^.t2^.location.register);
  285. end
  286. else
  287. begin
  288. emit_ref_reg(A_MOV,opsize,newreference(p^.t2^.location.reference),
  289. cmpreg);
  290. emit_ref_reg(A_CMP,opsize,newreference(temp1),
  291. cmpreg);
  292. end;
  293. end
  294. else
  295. begin
  296. if p^.t2^.location.loc=LOC_CREGISTER then
  297. emit_const_reg(A_CMP,opsize,p^.right^.value,
  298. p^.t2^.location.register)
  299. else
  300. emit_const_ref(A_CMP,opsize,p^.right^.value,
  301. newreference(p^.t2^.location.reference));
  302. end;
  303. if p^.backward then
  304. if count_var_is_signed then
  305. hcond:=C_LE
  306. else
  307. hcond:=C_BE
  308. else
  309. if count_var_is_signed then
  310. hcond:=C_GE
  311. else
  312. hcond:=C_AE;
  313. emitjmp(hcond,aktbreaklabel);
  314. { according to count direction DEC or INC... }
  315. { must be after the test because of 0to 255 for bytes !! }
  316. if p^.backward then
  317. hop:=A_DEC
  318. else
  319. hop:=A_INC;
  320. if p^.t2^.location.loc=LOC_CREGISTER then
  321. emit_reg(hop,opsize,p^.t2^.location.register)
  322. else
  323. emit_ref(hop,opsize,newreference(p^.t2^.location.reference));
  324. emitjmp(C_None,l3);
  325. { this is the break label: }
  326. emitlab(aktbreaklabel);
  327. ungetregister32(cmp32);
  328. if temptovalue then
  329. ungetiftemp(temp1);
  330. aktcontinuelabel:=oldclabel;
  331. aktbreaklabel:=oldblabel;
  332. { a break/continue in a for block can't be seen outside }
  333. flowcontrol:=flowcontrol-[fc_break,fc_continue];
  334. end;
  335. {*****************************************************************************
  336. SecondExitN
  337. *****************************************************************************}
  338. procedure secondexitn(var p : ptree);
  339. var
  340. is_mem : boolean;
  341. {op : tasmop;
  342. s : topsize;}
  343. otlabel,oflabel : pasmlabel;
  344. label
  345. do_jmp;
  346. begin
  347. include(flowcontrol,fc_exit);
  348. if assigned(p^.left) then
  349. if p^.left^.treetype=assignn then
  350. begin
  351. { just do a normal assignment followed by exit }
  352. secondpass(p^.left);
  353. emitjmp(C_None,aktexitlabel);
  354. end
  355. else
  356. begin
  357. otlabel:=truelabel;
  358. oflabel:=falselabel;
  359. getlabel(truelabel);
  360. getlabel(falselabel);
  361. secondpass(p^.left);
  362. case p^.left^.location.loc of
  363. LOC_FPU : goto do_jmp;
  364. LOC_MEM,
  365. LOC_REFERENCE : is_mem:=true;
  366. LOC_CREGISTER,
  367. LOC_REGISTER : is_mem:=false;
  368. LOC_FLAGS : begin
  369. emit_flag2reg(p^.left^.location.resflags,R_AL);
  370. goto do_jmp;
  371. end;
  372. LOC_JUMP : begin
  373. emitlab(truelabel);
  374. emit_const_reg(A_MOV,S_B,1,R_AL);
  375. emitjmp(C_None,aktexit2label);
  376. emitlab(falselabel);
  377. emit_reg_reg(A_XOR,S_B,R_AL,R_AL);
  378. goto do_jmp;
  379. end;
  380. else
  381. internalerror(2001);
  382. end;
  383. case procinfo^.returntype.def^.deftype of
  384. pointerdef,
  385. procvardef : begin
  386. if is_mem then
  387. emit_ref_reg(A_MOV,S_L,
  388. newreference(p^.left^.location.reference),R_EAX)
  389. else
  390. emit_reg_reg(A_MOV,S_L,
  391. p^.left^.location.register,R_EAX);
  392. end;
  393. floatdef : begin
  394. if pfloatdef(procinfo^.returntype.def)^.typ=f32bit then
  395. begin
  396. if is_mem then
  397. emit_ref_reg(A_MOV,S_L,
  398. newreference(p^.left^.location.reference),R_EAX)
  399. else
  400. emit_reg_reg(A_MOV,S_L,p^.left^.location.register,R_EAX);
  401. end
  402. else
  403. if is_mem then
  404. floatload(pfloatdef(procinfo^.returntype.def)^.typ,p^.left^.location.reference);
  405. end;
  406. { orddef,
  407. enumdef : }
  408. else
  409. { it can be anything shorter than 4 bytes PM
  410. this caused form bug 711 }
  411. begin
  412. case procinfo^.returntype.def^.size of
  413. { if its 3 bytes only we can still
  414. copy one of garbage ! PM }
  415. 4,3 : if is_mem then
  416. emit_ref_reg(A_MOV,S_L,
  417. newreference(p^.left^.location.reference),R_EAX)
  418. else
  419. emit_reg_reg(A_MOV,S_L,p^.left^.location.register,R_EAX);
  420. 2 : if is_mem then
  421. emit_ref_reg(A_MOV,S_W,
  422. newreference(p^.left^.location.reference),R_AX)
  423. else
  424. emit_reg_reg(A_MOV,S_W,makereg16(p^.left^.location.register),R_AX);
  425. 1 : if is_mem then
  426. emit_ref_reg(A_MOV,S_B,
  427. newreference(p^.left^.location.reference),R_AL)
  428. else
  429. emit_reg_reg(A_MOV,S_B,makereg8(p^.left^.location.register),R_AL);
  430. end;
  431. end;
  432. end;
  433. do_jmp:
  434. truelabel:=otlabel;
  435. falselabel:=oflabel;
  436. emitjmp(C_None,aktexit2label);
  437. end
  438. else
  439. begin
  440. emitjmp(C_None,aktexitlabel);
  441. end;
  442. end;
  443. {*****************************************************************************
  444. SecondBreakN
  445. *****************************************************************************}
  446. procedure secondbreakn(var p : ptree);
  447. begin
  448. include(flowcontrol,fc_break);
  449. if aktbreaklabel<>nil then
  450. emitjmp(C_None,aktbreaklabel)
  451. else
  452. CGMessage(cg_e_break_not_allowed);
  453. end;
  454. {*****************************************************************************
  455. SecondContinueN
  456. *****************************************************************************}
  457. procedure secondcontinuen(var p : ptree);
  458. begin
  459. include(flowcontrol,fc_continue);
  460. if aktcontinuelabel<>nil then
  461. emitjmp(C_None,aktcontinuelabel)
  462. else
  463. CGMessage(cg_e_continue_not_allowed);
  464. end;
  465. {*****************************************************************************
  466. SecondGoto
  467. *****************************************************************************}
  468. procedure secondgoto(var p : ptree);
  469. begin
  470. emitjmp(C_None,p^.labelnr);
  471. { the assigned avoids only crashes if the label isn't defined }
  472. if assigned(p^.labsym) and
  473. assigned(p^.labsym^.code) and
  474. (aktexceptblock<>ptree(p^.labsym^.code)^.exceptionblock) then
  475. CGMessage(cg_e_goto_inout_of_exception_block);
  476. end;
  477. {*****************************************************************************
  478. SecondLabel
  479. *****************************************************************************}
  480. procedure secondlabel(var p : ptree);
  481. begin
  482. emitlab(p^.labelnr);
  483. cleartempgen;
  484. secondpass(p^.left);
  485. end;
  486. {*****************************************************************************
  487. SecondRaise
  488. *****************************************************************************}
  489. procedure secondraise(var p : ptree);
  490. var
  491. a : pasmlabel;
  492. begin
  493. if assigned(p^.left) then
  494. begin
  495. { generate the address }
  496. if assigned(p^.right) then
  497. begin
  498. secondpass(p^.right);
  499. if codegenerror then
  500. exit;
  501. emit_push_loc(p^.right^.location);
  502. end
  503. else
  504. begin
  505. getlabel(a);
  506. emitlab(a);
  507. emit_sym(A_PUSH,S_L,a);
  508. end;
  509. secondpass(p^.left);
  510. if codegenerror then
  511. exit;
  512. case p^.left^.location.loc of
  513. LOC_MEM,LOC_REFERENCE:
  514. emit_ref(A_PUSH,S_L,
  515. newreference(p^.left^.location.reference));
  516. LOC_CREGISTER,LOC_REGISTER : emit_reg(A_PUSH,S_L,
  517. p^.left^.location.register);
  518. else CGMessage(type_e_mismatch);
  519. end;
  520. emitcall('FPC_RAISEEXCEPTION');
  521. end
  522. else
  523. begin
  524. emitcall('FPC_POPADDRSTACK');
  525. emitcall('FPC_RERAISE');
  526. end;
  527. end;
  528. {*****************************************************************************
  529. SecondTryExcept
  530. *****************************************************************************}
  531. var
  532. endexceptlabel : pasmlabel;
  533. { does the necessary things to clean up the object stack }
  534. { in the except block }
  535. procedure cleanupobjectstack;
  536. begin
  537. emitcall('FPC_POPOBJECTSTACK');
  538. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  539. emit_reg(A_PUSH,S_L,R_EAX);
  540. emitcall('FPC_DESTROYEXCEPTION');
  541. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  542. maybe_loadesi;
  543. end;
  544. { pops one element from the exception address stack }
  545. { and removes the flag }
  546. procedure cleanupaddrstack;
  547. begin
  548. emitcall('FPC_POPADDRSTACK');
  549. { allocate eax }
  550. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  551. emit_reg(A_POP,S_L,R_EAX);
  552. { deallocate eax }
  553. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  554. end;
  555. procedure secondtryexcept(var p : ptree);
  556. var
  557. exceptlabel,doexceptlabel,oldendexceptlabel,
  558. lastonlabel,
  559. exitexceptlabel,
  560. continueexceptlabel,
  561. breakexceptlabel,
  562. exittrylabel,
  563. continuetrylabel,
  564. breaktrylabel,
  565. doobjectdestroy,
  566. doobjectdestroyandreraise,
  567. oldaktexitlabel,
  568. oldaktexit2label,
  569. oldaktcontinuelabel,
  570. oldaktbreaklabel : pasmlabel;
  571. oldexceptblock : ptree;
  572. oldflowcontrol,tryflowcontrol,
  573. exceptflowcontrol : tflowcontrol;
  574. begin
  575. oldflowcontrol:=flowcontrol;
  576. flowcontrol:=[];
  577. { this can be called recursivly }
  578. oldendexceptlabel:=endexceptlabel;
  579. { we modify EAX }
  580. usedinproc:=usedinproc or ($80 shr byte(R_EAX));
  581. { save the old labels for control flow statements }
  582. oldaktexitlabel:=aktexitlabel;
  583. oldaktexit2label:=aktexit2label;
  584. if assigned(aktbreaklabel) then
  585. begin
  586. oldaktcontinuelabel:=aktcontinuelabel;
  587. oldaktbreaklabel:=aktbreaklabel;
  588. end;
  589. { get new labels for the control flow statements }
  590. getlabel(exittrylabel);
  591. getlabel(exitexceptlabel);
  592. if assigned(aktbreaklabel) then
  593. begin
  594. getlabel(breaktrylabel);
  595. getlabel(continuetrylabel);
  596. getlabel(breakexceptlabel);
  597. getlabel(continueexceptlabel);
  598. end;
  599. getlabel(exceptlabel);
  600. getlabel(doexceptlabel);
  601. getlabel(endexceptlabel);
  602. getlabel(lastonlabel);
  603. push_int (1); { push type of exceptionframe }
  604. emitcall('FPC_PUSHEXCEPTADDR');
  605. { allocate eax }
  606. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  607. emit_reg(A_PUSH,S_L,R_EAX);
  608. emitcall('FPC_SETJMP');
  609. emit_reg(A_PUSH,S_L,R_EAX);
  610. emit_reg_reg(A_TEST,S_L,R_EAX,R_EAX);
  611. { deallocate eax }
  612. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  613. emitjmp(C_NE,exceptlabel);
  614. { try block }
  615. { set control flow labels for the try block }
  616. aktexitlabel:=exittrylabel;
  617. aktexit2label:=exittrylabel;
  618. if assigned(oldaktbreaklabel) then
  619. begin
  620. aktcontinuelabel:=continuetrylabel;
  621. aktbreaklabel:=breaktrylabel;
  622. end;
  623. oldexceptblock:=aktexceptblock;
  624. aktexceptblock:=p^.left;
  625. flowcontrol:=[];
  626. secondpass(p^.left);
  627. tryflowcontrol:=flowcontrol;
  628. aktexceptblock:=oldexceptblock;
  629. if codegenerror then
  630. exit;
  631. emitlab(exceptlabel);
  632. emitcall('FPC_POPADDRSTACK');
  633. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  634. emit_reg(A_POP,S_L,R_EAX);
  635. emit_reg_reg(A_TEST,S_L,R_EAX,R_EAX);
  636. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  637. emitjmp(C_E,endexceptlabel);
  638. emitlab(doexceptlabel);
  639. { set control flow labels for the except block }
  640. { and the on statements }
  641. aktexitlabel:=exitexceptlabel;
  642. aktexit2label:=exitexceptlabel;
  643. if assigned(oldaktbreaklabel) then
  644. begin
  645. aktcontinuelabel:=continueexceptlabel;
  646. aktbreaklabel:=breakexceptlabel;
  647. end;
  648. flowcontrol:=[];
  649. { on statements }
  650. if assigned(p^.right) then
  651. begin
  652. oldexceptblock:=aktexceptblock;
  653. aktexceptblock:=p^.right;
  654. secondpass(p^.right);
  655. aktexceptblock:=oldexceptblock;
  656. end;
  657. emitlab(lastonlabel);
  658. { default handling except handling }
  659. if assigned(p^.t1) then
  660. begin
  661. { FPC_CATCHES must be called with
  662. 'default handler' flag (=-1)
  663. }
  664. push_int (-1);
  665. emitcall('FPC_CATCHES');
  666. maybe_loadesi;
  667. { the destruction of the exception object must be also }
  668. { guarded by an exception frame }
  669. getlabel(doobjectdestroy);
  670. getlabel(doobjectdestroyandreraise);
  671. exprasmlist^.concat(new(paicpu,op_const(A_PUSH,S_L,1)));
  672. emitcall('FPC_PUSHEXCEPTADDR');
  673. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  674. exprasmlist^.concat(new(paicpu,
  675. op_reg(A_PUSH,S_L,R_EAX)));
  676. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  677. emitcall('FPC_SETJMP');
  678. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  679. exprasmlist^.concat(new(paicpu,
  680. op_reg(A_PUSH,S_L,R_EAX)));
  681. exprasmlist^.concat(new(paicpu,
  682. op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
  683. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  684. emitjmp(C_NE,doobjectdestroyandreraise);
  685. oldexceptblock:=aktexceptblock;
  686. aktexceptblock:=p^.t1;
  687. { here we don't have to reset flowcontrol }
  688. { the default and on flowcontrols are handled equal }
  689. secondpass(p^.t1);
  690. exceptflowcontrol:=flowcontrol;
  691. aktexceptblock:=oldexceptblock;
  692. emitlab(doobjectdestroyandreraise);
  693. emitcall('FPC_POPADDRSTACK');
  694. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  695. exprasmlist^.concat(new(paicpu,
  696. op_reg(A_POP,S_L,R_EAX)));
  697. exprasmlist^.concat(new(paicpu,
  698. op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
  699. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  700. emitjmp(C_E,doobjectdestroy);
  701. emitcall('FPC_POPSECONDOBJECTSTACK');
  702. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  703. emit_reg(A_PUSH,S_L,R_EAX);
  704. emitcall('FPC_DESTROYEXCEPTION');
  705. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  706. { we don't need to restore esi here because reraise never }
  707. { returns }
  708. emitcall('FPC_RERAISE');
  709. emitlab(doobjectdestroy);
  710. cleanupobjectstack;
  711. emitjmp(C_None,endexceptlabel);
  712. end
  713. else
  714. begin
  715. emitcall('FPC_RERAISE');
  716. exceptflowcontrol:=flowcontrol;
  717. end;
  718. if fc_exit in exceptflowcontrol then
  719. begin
  720. { do some magic for exit in the try block }
  721. emitlab(exitexceptlabel);
  722. { we must also destroy the address frame which guards }
  723. { exception object }
  724. cleanupaddrstack;
  725. cleanupobjectstack;
  726. emitjmp(C_None,oldaktexitlabel);
  727. end;
  728. if fc_break in exceptflowcontrol then
  729. begin
  730. emitlab(breakexceptlabel);
  731. { we must also destroy the address frame which guards }
  732. { exception object }
  733. cleanupaddrstack;
  734. cleanupobjectstack;
  735. emitjmp(C_None,oldaktbreaklabel);
  736. end;
  737. if fc_continue in exceptflowcontrol then
  738. begin
  739. emitlab(continueexceptlabel);
  740. { we must also destroy the address frame which guards }
  741. { exception object }
  742. cleanupaddrstack;
  743. cleanupobjectstack;
  744. emitjmp(C_None,oldaktcontinuelabel);
  745. end;
  746. if fc_exit in tryflowcontrol then
  747. begin
  748. { do some magic for exit in the try block }
  749. emitlab(exittrylabel);
  750. cleanupaddrstack;
  751. emitjmp(C_None,oldaktexitlabel);
  752. end;
  753. if fc_break in tryflowcontrol then
  754. begin
  755. emitlab(breaktrylabel);
  756. cleanupaddrstack;
  757. emitjmp(C_None,oldaktbreaklabel);
  758. end;
  759. if fc_continue in tryflowcontrol then
  760. begin
  761. emitlab(continuetrylabel);
  762. cleanupaddrstack;
  763. emitjmp(C_None,oldaktcontinuelabel);
  764. end;
  765. emitlab(endexceptlabel);
  766. endexceptlabel:=oldendexceptlabel;
  767. { restore the control flow labels }
  768. aktexitlabel:=oldaktexitlabel;
  769. aktexit2label:=oldaktexit2label;
  770. if assigned(oldaktbreaklabel) then
  771. begin
  772. aktcontinuelabel:=oldaktcontinuelabel;
  773. aktbreaklabel:=oldaktbreaklabel;
  774. end;
  775. { return all used control flow statements }
  776. flowcontrol:=oldflowcontrol+exceptflowcontrol+
  777. tryflowcontrol;
  778. end;
  779. procedure secondon(var p : ptree);
  780. var
  781. nextonlabel,
  782. exitonlabel,
  783. continueonlabel,
  784. breakonlabel,
  785. oldaktexitlabel,
  786. oldaktexit2label,
  787. oldaktcontinuelabel,
  788. doobjectdestroyandreraise,
  789. doobjectdestroy,
  790. oldaktbreaklabel : pasmlabel;
  791. ref : treference;
  792. oldexceptblock : ptree;
  793. oldflowcontrol : tflowcontrol;
  794. begin
  795. oldflowcontrol:=flowcontrol;
  796. flowcontrol:=[];
  797. getlabel(nextonlabel);
  798. { push the vmt }
  799. emit_sym(A_PUSH,S_L,
  800. newasmsymbol(p^.excepttype^.vmt_mangledname));
  801. emitcall('FPC_CATCHES');
  802. { allocate eax }
  803. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  804. emit_reg_reg(A_TEST,S_L,R_EAX,R_EAX);
  805. emitjmp(C_E,nextonlabel);
  806. ref.symbol:=nil;
  807. gettempofsizereference(4,ref);
  808. { what a hack ! }
  809. if assigned(p^.exceptsymtable) then
  810. pvarsym(p^.exceptsymtable^.symindex^.first)^.address:=ref.offset;
  811. emit_reg_ref(A_MOV,S_L,
  812. R_EAX,newreference(ref));
  813. { deallocate eax }
  814. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  815. { in the case that another exception is risen }
  816. { we've to destroy the old one }
  817. getlabel(doobjectdestroyandreraise);
  818. exprasmlist^.concat(new(paicpu,op_const(A_PUSH,S_L,1)));
  819. emitcall('FPC_PUSHEXCEPTADDR');
  820. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  821. exprasmlist^.concat(new(paicpu,
  822. op_reg(A_PUSH,S_L,R_EAX)));
  823. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  824. emitcall('FPC_SETJMP');
  825. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  826. exprasmlist^.concat(new(paicpu,
  827. op_reg(A_PUSH,S_L,R_EAX)));
  828. exprasmlist^.concat(new(paicpu,
  829. op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
  830. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  831. emitjmp(C_NE,doobjectdestroyandreraise);
  832. if assigned(p^.right) then
  833. begin
  834. oldaktexitlabel:=aktexitlabel;
  835. oldaktexit2label:=aktexit2label;
  836. getlabel(exitonlabel);
  837. aktexitlabel:=exitonlabel;
  838. aktexit2label:=exitonlabel;
  839. if assigned(aktbreaklabel) then
  840. begin
  841. oldaktcontinuelabel:=aktcontinuelabel;
  842. oldaktbreaklabel:=aktbreaklabel;
  843. getlabel(breakonlabel);
  844. getlabel(continueonlabel);
  845. aktcontinuelabel:=continueonlabel;
  846. aktbreaklabel:=breakonlabel;
  847. end;
  848. { esi is destroyed by FPC_CATCHES }
  849. maybe_loadesi;
  850. oldexceptblock:=aktexceptblock;
  851. aktexceptblock:=p^.right;
  852. secondpass(p^.right);
  853. aktexceptblock:=oldexceptblock;
  854. end;
  855. getlabel(doobjectdestroy);
  856. emitlab(doobjectdestroyandreraise);
  857. emitcall('FPC_POPADDRSTACK');
  858. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  859. exprasmlist^.concat(new(paicpu,
  860. op_reg(A_POP,S_L,R_EAX)));
  861. exprasmlist^.concat(new(paicpu,
  862. op_reg_reg(A_TEST,S_L,R_EAX,R_EAX)));
  863. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  864. emitjmp(C_E,doobjectdestroy);
  865. emitcall('FPC_POPSECONDOBJECTSTACK');
  866. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  867. emit_reg(A_PUSH,S_L,R_EAX);
  868. emitcall('FPC_DESTROYEXCEPTION');
  869. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  870. { we don't need to restore esi here because reraise never }
  871. { returns }
  872. emitcall('FPC_RERAISE');
  873. emitlab(doobjectdestroy);
  874. cleanupobjectstack;
  875. { clear some stuff }
  876. ungetiftemp(ref);
  877. emitjmp(C_None,endexceptlabel);
  878. if assigned(p^.right) then
  879. begin
  880. { special handling for control flow instructions }
  881. if fc_exit in flowcontrol then
  882. begin
  883. { the address and object pop does secondtryexcept }
  884. emitlab(exitonlabel);
  885. emitjmp(C_None,oldaktexitlabel);
  886. end;
  887. if fc_break in flowcontrol then
  888. begin
  889. { the address and object pop does secondtryexcept }
  890. emitlab(breakonlabel);
  891. emitjmp(C_None,oldaktbreaklabel);
  892. end;
  893. if fc_continue in flowcontrol then
  894. begin
  895. { the address and object pop does secondtryexcept }
  896. emitlab(continueonlabel);
  897. emitjmp(C_None,oldaktcontinuelabel);
  898. end;
  899. aktexitlabel:=oldaktexitlabel;
  900. aktexit2label:=oldaktexit2label;
  901. if assigned(oldaktbreaklabel) then
  902. begin
  903. aktcontinuelabel:=oldaktcontinuelabel;
  904. aktbreaklabel:=oldaktbreaklabel;
  905. end;
  906. end;
  907. emitlab(nextonlabel);
  908. flowcontrol:=oldflowcontrol+flowcontrol;
  909. { next on node }
  910. if assigned(p^.left) then
  911. secondpass(p^.left);
  912. end;
  913. {*****************************************************************************
  914. SecondTryFinally
  915. *****************************************************************************}
  916. procedure secondtryfinally(var p : ptree);
  917. var
  918. reraiselabel,
  919. finallylabel,
  920. endfinallylabel,
  921. exitfinallylabel,
  922. continuefinallylabel,
  923. breakfinallylabel,
  924. oldaktexitlabel,
  925. oldaktexit2label,
  926. oldaktcontinuelabel,
  927. oldaktbreaklabel : pasmlabel;
  928. oldexceptblock : ptree;
  929. oldflowcontrol,tryflowcontrol : tflowcontrol;
  930. decconst : longint;
  931. begin
  932. { check if child nodes do a break/continue/exit }
  933. oldflowcontrol:=flowcontrol;
  934. flowcontrol:=[];
  935. { we modify EAX }
  936. usedinproc:=usedinproc or ($80 shr byte(R_EAX));
  937. getlabel(finallylabel);
  938. getlabel(endfinallylabel);
  939. getlabel(reraiselabel);
  940. { the finally block must catch break, continue and exit }
  941. { statements }
  942. oldaktexitlabel:=aktexitlabel;
  943. oldaktexit2label:=aktexit2label;
  944. getlabel(exitfinallylabel);
  945. aktexitlabel:=exitfinallylabel;
  946. aktexit2label:=exitfinallylabel;
  947. if assigned(aktbreaklabel) then
  948. begin
  949. oldaktcontinuelabel:=aktcontinuelabel;
  950. oldaktbreaklabel:=aktbreaklabel;
  951. getlabel(breakfinallylabel);
  952. getlabel(continuefinallylabel);
  953. aktcontinuelabel:=continuefinallylabel;
  954. aktbreaklabel:=breakfinallylabel;
  955. end;
  956. push_int(1); { Type of stack-frame must be pushed}
  957. emitcall('FPC_PUSHEXCEPTADDR');
  958. { allocate eax }
  959. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  960. emit_reg(A_PUSH,S_L,R_EAX);
  961. emitcall('FPC_SETJMP');
  962. emit_reg(A_PUSH,S_L,R_EAX);
  963. emit_reg_reg(A_TEST,S_L,R_EAX,R_EAX);
  964. { deallocate eax }
  965. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  966. emitjmp(C_NE,finallylabel);
  967. { try code }
  968. if assigned(p^.left) then
  969. begin
  970. oldexceptblock:=aktexceptblock;
  971. aktexceptblock:=p^.left;
  972. secondpass(p^.left);
  973. tryflowcontrol:=flowcontrol;
  974. if codegenerror then
  975. exit;
  976. aktexceptblock:=oldexceptblock;
  977. end;
  978. emitlab(finallylabel);
  979. emitcall('FPC_POPADDRSTACK');
  980. { finally code }
  981. oldexceptblock:=aktexceptblock;
  982. aktexceptblock:=p^.right;
  983. flowcontrol:=[];
  984. secondpass(p^.right);
  985. if flowcontrol<>[] then
  986. CGMessage(cg_e_control_flow_outside_finally);
  987. aktexceptblock:=oldexceptblock;
  988. if codegenerror then
  989. exit;
  990. { allocate eax }
  991. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  992. emit_reg(A_POP,S_L,R_EAX);
  993. emit_reg_reg(A_TEST,S_L,R_EAX,R_EAX);
  994. emitjmp(C_E,endfinallylabel);
  995. emit_reg(A_DEC,S_L,R_EAX);
  996. emitjmp(C_Z,reraiselabel);
  997. if fc_exit in tryflowcontrol then
  998. begin
  999. emit_reg(A_DEC,S_L,R_EAX);
  1000. emitjmp(C_Z,oldaktexitlabel);
  1001. decconst:=1;
  1002. end
  1003. else
  1004. decconst:=2;
  1005. if fc_break in tryflowcontrol then
  1006. begin
  1007. emit_const_reg(A_SUB,S_L,decconst,R_EAX);
  1008. emitjmp(C_Z,oldaktbreaklabel);
  1009. decconst:=1;
  1010. end
  1011. else
  1012. inc(decconst);
  1013. if fc_continue in tryflowcontrol then
  1014. begin
  1015. emit_const_reg(A_SUB,S_L,decconst,R_EAX);
  1016. emitjmp(C_Z,oldaktcontinuelabel);
  1017. end;
  1018. { deallocate eax }
  1019. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  1020. emitlab(reraiselabel);
  1021. emitcall('FPC_RERAISE');
  1022. { do some magic for exit,break,continue in the try block }
  1023. if fc_exit in tryflowcontrol then
  1024. begin
  1025. emitlab(exitfinallylabel);
  1026. { allocate eax }
  1027. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  1028. emit_reg(A_POP,S_L,R_EAX);
  1029. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  1030. emit_const(A_PUSH,S_L,2);
  1031. emitjmp(C_NONE,finallylabel);
  1032. end;
  1033. if fc_break in tryflowcontrol then
  1034. begin
  1035. emitlab(breakfinallylabel);
  1036. { allocate eax }
  1037. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  1038. emit_reg(A_POP,S_L,R_EAX);
  1039. { deallocate eax }
  1040. exprasmlist^.concat(new(pairegalloc,dealloc(R_EAX)));
  1041. emit_const(A_PUSH,S_L,3);
  1042. emitjmp(C_NONE,finallylabel);
  1043. end;
  1044. if fc_continue in tryflowcontrol then
  1045. begin
  1046. emitlab(continuefinallylabel);
  1047. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  1048. emit_reg(A_POP,S_L,R_EAX);
  1049. exprasmlist^.concat(new(pairegalloc,alloc(R_EAX)));
  1050. emit_const(A_PUSH,S_L,4);
  1051. emitjmp(C_NONE,finallylabel);
  1052. end;
  1053. emitlab(endfinallylabel);
  1054. aktexitlabel:=oldaktexitlabel;
  1055. aktexit2label:=oldaktexit2label;
  1056. if assigned(aktbreaklabel) then
  1057. begin
  1058. aktcontinuelabel:=oldaktcontinuelabel;
  1059. aktbreaklabel:=oldaktbreaklabel;
  1060. end;
  1061. flowcontrol:=oldflowcontrol+tryflowcontrol;
  1062. end;
  1063. {*****************************************************************************
  1064. SecondFail
  1065. *****************************************************************************}
  1066. procedure secondfail(var p : ptree);
  1067. begin
  1068. emitjmp(C_None,faillabel);
  1069. end;
  1070. end.
  1071. {
  1072. $Log$
  1073. Revision 1.69 2000-02-10 23:44:42 florian
  1074. * big update for exception handling code generation: possible mem holes
  1075. fixed, break/continue/exit should work always now as expected
  1076. Revision 1.68 2000/02/09 13:22:47 peter
  1077. * log truncated
  1078. Revision 1.67 2000/01/21 12:17:42 jonas
  1079. * regallocation fixes
  1080. Revision 1.66 2000/01/07 01:14:20 peter
  1081. * updated copyright to 2000
  1082. Revision 1.65 1999/12/22 23:30:06 peter
  1083. * nested try blocks work again
  1084. Revision 1.64 1999/12/22 01:01:46 peter
  1085. - removed freelabel()
  1086. * added undefined label detection in internal assembler, this prevents
  1087. a lot of ld crashes and wrong .o files
  1088. * .o files aren't written anymore if errors have occured
  1089. * inlining of assembler labels is now correct
  1090. Revision 1.63 1999/12/19 17:02:45 peter
  1091. * support exit,break,continue in try...except
  1092. * support break,continue in try...finally
  1093. Revision 1.62 1999/12/17 11:20:06 florian
  1094. * made the goto checking for excpetions more fool proof against errors
  1095. Revision 1.61 1999/12/14 09:58:41 florian
  1096. + compiler checks now if a goto leaves an exception block
  1097. Revision 1.60 1999/12/01 12:36:23 peter
  1098. * fixed selfpointer after destroyexception
  1099. Revision 1.59 1999/11/30 10:40:42 peter
  1100. + ttype, tsymlist
  1101. Revision 1.58 1999/11/28 23:15:23 pierre
  1102. * fix for form bug 721
  1103. Revision 1.57 1999/11/15 21:49:09 peter
  1104. * push address also for raise at
  1105. Revision 1.56 1999/11/06 14:34:17 peter
  1106. * truncated log to 20 revs
  1107. Revision 1.55 1999/10/30 17:35:26 peter
  1108. * fpc_freemem fpc_getmem new callings updated
  1109. Revision 1.54 1999/10/21 16:41:37 florian
  1110. * problems with readln fixed: esi wasn't restored correctly when
  1111. reading ordinal fields of objects futher the register allocation
  1112. didn't take care of the extra register when reading ordinal values
  1113. * enumerations can now be used in constant indexes of properties
  1114. Revision 1.53 1999/10/05 22:01:52 pierre
  1115. * bug exit('test') + fail for classes
  1116. Revision 1.52 1999/09/27 23:44:46 peter
  1117. * procinfo is now a pointer
  1118. * support for result setting in sub procedure
  1119. Revision 1.51 1999/09/26 13:26:05 florian
  1120. * exception patch of Romio nevertheless the excpetion handling
  1121. needs some corections regarding register saving
  1122. * gettempansistring is again a procedure
  1123. Revision 1.50 1999/09/20 16:35:43 peter
  1124. * restored old alignment, saves 40k on ppc386
  1125. Revision 1.49 1999/09/15 20:35:37 florian
  1126. * small fix to operator overloading when in MMX mode
  1127. + the compiler uses now fldz and fld1 if possible
  1128. + some fixes to floating point registers
  1129. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1130. * .... ???
  1131. Revision 1.48 1999/09/07 07:56:37 peter
  1132. * reload esi in except block to allow virtual methods
  1133. Revision 1.47 1999/08/25 11:59:42 jonas
  1134. * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
  1135. }