home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / spo386.zip / SPO.DOC < prev    next >
Text File  |  1994-01-14  |  29KB  |  662 lines

  1.  
  2.  
  3.  
  4. ---------------------------------------------------------------------------
  5.                 Sally Tpu Peephole Optimizer version 1,20
  6.                              Morten Welinder
  7.                           Copenhagen 1993-1994
  8. ---------------------------------------------------------------------------
  9.  
  10. 1. Welcome
  11.  
  12. Welcome to Sally Tpu Peephole Optimizer, Spo.  This program lets you produce
  13. faster programs with Borland Pascal version 7.0 by optimizing the
  14. intermediate code produced by that compiler.
  15.  
  16. The program and documentation of it (including this file) is copyright 1993,
  17. 1994 by Morten Welinder.  "Sally" as the program outputs, that's me.
  18.  
  19. As a special bonus of using this program, the longint shift bug in the
  20. runtime library will be eliminated.
  21.  
  22.  
  23. 2. Terms of use
  24.  
  25. I do not currently know what I want to do with this program.  Therefore the
  26. following terms apply to all use of Sally Tpu Peephole Optimizer version
  27. 1,20:
  28.  
  29.         1. The program may be used by private individuals only.  As a
  30.            special exception I allow universities to use the program
  31.            for educational purposes.
  32.         2. You don't have to pay for using the program.
  33.         3. You may distribute copies of the program, if and if only
  34.            you distribute the whole package unmodified.
  35.         4. You use the program at your own risk.
  36.  
  37. If you do not like these terms you have two options: (1) don't use the
  38. program, and (2) contact me and explain your needs -- I may grant you more
  39. rights.
  40.  
  41.  
  42. 3. Bug reports and suggestions
  43.  
  44. Bug reports, comments et cetera can be snail-mailed to
  45.  
  46.         Morten Welinder
  47.         Borups Alle 249B, 3tv
  48.         DK-2400  Koebenhavn NV
  49.         Denmark
  50.  
  51. or emailed to "terra@diku.dk".  (TeX fans would have written the third line
  52. as {DK\raise0.12ex\hbox{-}2400~~K{\o}benhavn~NV} but don't worry, because The
  53. Royal Danish Mail is quite efficient.)  The email address is my Ph.D. student
  54. account at Department of Computer Science, University of Copenhagen, Denmark.
  55. Please be specific: use the debugging options to localize the bugs and
  56. include the failing source code.  By the way: don't misspell my name.
  57.  
  58.  
  59. 4. Usage
  60.  
  61. The optimizer is a command-line utility and recognizes lots of options.
  62. Entering "Spo" without parameters gives you a list:
  63.  
  64.    Sally Tpu Peephole Optimizer version 1,20
  65.    Copyright 1994 by Sally
  66.  
  67.    Usage: Spo Infile(s) [Options]
  68.           /?     Help
  69.           /Ax    Assembler           Example: Tasmx.Exe
  70.           /Tx    Target              86, 186, ... , 486
  71.           /Rx    Range Check         (B)ounds, (E)liminate
  72.           /Sx    Stack Check         (U)nfold, (E)liminate
  73.           /Ix    InOutRes Check      (U)nfold, (E)liminate
  74.           /Ox    Overflow Check      (I)ntO, (E)liminate
  75.           /Nx    80n87 instructions  (S)oft, (H)ard
  76.           /Cx    Target platform     (D)os, (P)rotected, (W)indows, (O)S/2
  77.           /Dx    Debug               Keep (L)ist file.
  78.                                      (N)o optimization.
  79.                                      (S)ystem names.
  80.                                      Allow no (D)ebug information.
  81.  
  82. Infile(s) is a list of the units to optimize.  Wildcards are now allowed.
  83. Debug information must be present in the unit.  The optimized versions of the
  84. units will be written in the current directory with an extension of "Ttt".
  85. This may very well change in later versions.
  86.  
  87. Note that options with parameters (e.g., "/Sx") does not accept any white
  88. space between the "S" and the parameter.
  89.  
  90. The options are described in greater detail in the following sections.  In
  91. order to run Spo you will need 300-600 KB free memory.  The presence of Xms
  92. memory (up to 64 KB) may improve capacity very slightly.  See the assembler
  93. option for information about how to use an assembler with larger capacity.
  94.  
  95. An alternate version for users with 386 processors is available: Spo386.
  96. This version runs under Dpmi and you will need some of the files that came
  97. with Borland Pascal 7.0 (the same files you need to start Bp.Exe).  The
  98. alternate version of Spo doesn't have the 64K limit for the assembly buffer
  99. and will thus optimize larger units.  Spo386 has been tested under Borland's
  100. dos extender only and since it uses some dirty tricks to operate in 32 bit
  101. mode it may or may not function under other dos extenders.  Please let me
  102. know it you have problems.
  103.  
  104.  
  105. 4.1 The assembler option, "/Ax"
  106.  
  107. By default Spo uses "Tasm.Exe" to assemble the generated code.  Since the
  108. syntax of the generated list file is very important you don't really have
  109. much choice here, but "Tasmx.Exe" might increase the maximum unit size that
  110. Spo can handle.  "Tasmx.Exe" is somewhat slower than "Tasm.Exe" so don't use
  111. it if you haven't got to.
  112.  
  113. The assembler is looked for in the current directory, as specified by the
  114. PATH environment, and in "C:\Bp\Bin" using that order.
  115.  
  116.  
  117. 4.2 The target option, "/Tx"
  118.  
  119. By specifying the target processor you direct Spo to generate the best code
  120. it knows for that processor.  As a consequence the generated code may not run
  121. on all the 8086-family.  As an example consider "/T3" (or "/T386" or
  122. something like that).  The resulting code may use 32-bit operations (but
  123. still in a 16-bit segment) and 386-specific instructions like "Bts".  Your
  124. program would then run on 386s and 486s only.
  125.  
  126. Specifying "/T486" produces code that will run on both 386s and 486s but it
  127. will be optimized for 486s.  There is no "/T5" or "/TPentium" because I have
  128. no idea of what makes Pentium code run faster.  Using "/T486" is probably the
  129. best idea in that case.
  130.  
  131. The default for this option depends on the target platform; for real mode
  132. units it is 8086, for Windows and protected mode units it is 286, and for
  133. OS/2 units it is 386.  If you specify a target that is weaker than the
  134. default your specification is silently ignored.
  135.  
  136. Specifying "/T8086" (for real mode units) produces code that will run on
  137. every 8086-family machine, including the 8088 used in the original IBM PC.
  138. Double prefixes will not be used for this target since the 8088 does not
  139. handle these correctly.  It does not matter whether the original unit was
  140. compiled with "/G+" (use 186 instructions) or not.  These instructions will
  141. be eliminated, I hope.  If not, then the assembler will report an error and
  142. no new code is generated.
  143.  
  144. Specifying "/T" on its own selects the processor on which Spo is running as
  145. the target.
  146.  
  147. You must ensure that the correct processor is present at run time.  You may
  148. do this by placing "Need_186", "Need_286", or "Need_386" very early in the
  149. uses list of your main program.  By "very early" I mean before any optimized
  150. unit (or unit that calls an optimized unit in the initialization procedure).
  151. Only programs for real mode need to check for 186/286 explicitly, and OS/2
  152. programs need not check for 386.  In these cases, the "Need_x86" units are
  153. therefore empty units.
  154.  
  155.  
  156. 4.3 The range check option, "/Rx"
  157.  
  158. The /R option together with the /T specifies what to do with range checks in
  159. the code.  A very large number of code sequences have been prepared to
  160. provide very fast range checking -- some checks which can be guaranteed never
  161. to fail will even be eliminated.
  162.  
  163. "/RI" (the default) directs Spo to improve the range checking actions.  You
  164. get this whether you want it or not.  In the 386+ case the instruction queue
  165. is unbroken.
  166.  
  167. "/RB" will cause "Bound" instructions to be generated to check a value
  168. against a given range.  These instructions are fast but an exception/
  169. interrupt 5 is generated when the check fails.  By default this will crash
  170. the system by generating an infinite number of screen dumps.  You must
  171. install a smart Int-5 handler to use this feature.  The easiest way to do
  172. this is to place "Int_0405" early in the uses list of your main program.
  173. "/RB" is not available for the 8086 case.
  174.  
  175. "/RE" will remove range checks as best as it can.  This process is not
  176. perfect -- it does not yield the same code as compiling with range checks
  177. disabled.  No range errors will be reported by the resulting code though.
  178.  
  179.  
  180. 4.4 The stack checking option, "/Sx"
  181.  
  182. The /S options specifies what to do with stack overflow checking as generated
  183. by Borland Pascal.
  184.  
  185. "/SI" and "/SU" direct Spo to unfold and improve the check.
  186.  
  187. "/SE" directs Spo to remove the checks.  Removal is perfect.
  188.  
  189.  
  190. 4.5 The input/output error checking option, "/Ix"
  191.  
  192. "/II" and "/IU" direct Spo to unfold and improve the check.  This speeds up
  193. the check significantly.  In the 386+ case the instruction queue is unbroken.
  194.  
  195. "/IE" directs Spo to remove the checks.  Removal is perfect.
  196.  
  197.  
  198. 4.6 The arithmetic overflow check option, "/Qx"
  199.  
  200. The /Q option together with the /T specifies what to do with overflow checks
  201. in the code.
  202.  
  203. "/Q0" (the default) directs Spo to improve the overflow checking actions.
  204. This is possible for the 386+ case only where the instruction queue will be
  205. left unbroken.
  206.  
  207. "/QI" will cause "Into" instructions to be generated to check the signed
  208. cases.  This instruction is fast but an exception/interrupt 4 is generated
  209. when the check fails.  By default this may crash the system if no handler is
  210. installed.  You must install an Int-4 handler to use this feature.  The
  211. easiest way to do this is to place "Int_0405" early in the uses list of your
  212. main program.
  213.  
  214. "/QE" will remove overflow checks as best as it can.  This process is not
  215. perfect -- it does not yield the same code as compiling with the checks
  216. disabled.  No overflow errors will be reported by the resulting code though.
  217.  
  218.  
  219. 4.7 The numeric processing option, "/Nx"
  220.  
  221. All 8087 instructions generated by Borland Pascal are emulated.  With the /N
  222. options you can direct Spo to hard-code "Esc" instructions.
  223.  
  224. "/NS" (the default) causes Spo to generate emulated instructions.  If the
  225. real emulator is present at run time (if the program is compiled with /E+)
  226. the resulting code will run without a co-processor.  Please note that
  227. emulation does not show on the assembler generated list file.
  228.  
  229. "/NH" causes hard-coded "Esc" instructions to be generated. This also makes it
  230. possible to use a larger part of the instruction set for the 287+ case.  The
  231. resulting code will not run without a co-processor unless you have an
  232. exception based emulator.
  233.  
  234. Currently the Fpu is assumed to match the Cpu.  This is wrong and will be
  235. fixed later.  386+287 systems must not specify "/NH /T386", or else!  "Fsin"
  236. et cetera will not be used for 186+187 systems.
  237.  
  238.  
  239. 4.8 The target platform option, "/Cx"
  240.  
  241. "/CD" (the default) directs Spo to treat units targeted for real mode.  In
  242. addition to this, "/CP" may be used to specify dos protected mode units,
  243. "/CW" to specify Windows mode units, and "/CO" to specify OS/2 mode units.
  244.  
  245.  
  246. 4.9 The debugging options, "/Dx"
  247.  
  248. Some options are available for debugging and for sticking your nose into the
  249. finer details of the program.  More than one debugging option can be
  250. specified.
  251.  
  252. "/DL" directs Spo to leave the list file from the assembler.  By examining
  253. the file "$po.Lst" in the current directory you can see the generated code.
  254. Only the list file from the last unit assembled can be seen.  Please note
  255. that 8087 instructions show un-emulated except for some "Fwait" instructions.
  256.  
  257. "/DN" makes Spo skip the optimization phase.  Together with "/DL" this
  258. gives disassembly of the original unit.
  259.  
  260. "/DS" causes Spo to put the names of system procedures in the list file.  The
  261. names used are the same as in "System.Pas" from the Run Time Library Source
  262. Code.
  263.  
  264. "/DD" is for my experiments use only.  It specifies that it is OK for a
  265. module not to contain debug information.
  266.  
  267.  
  268.  
  269. 5. How?
  270.  
  271. Spo works by a three phase scheme
  272.  
  273.         1. Disassembly.
  274.         2. Optimization of the generated assembly code.
  275.         3. Assembly.
  276.  
  277. This scheme has the side effect that you cannot rely on a particular coding
  278. of some instruction.  As an example "Mov Sp,Bp" has two different encodings.
  279. This should not concern you.
  280.  
  281. In general the speed-up comes from unfolding system procedures and functions.
  282. A far call and return takes 30 clock cycles plus penalties for broken
  283. instruction queues on a 486.
  284.  
  285. Other speed-up sources are use of larger instruction sets and less local view
  286. on instructions.
  287.  
  288.  
  289. 5.1 The disassembly phase
  290.  
  291. The disassembly phase consists of two sub-phases: identification of all
  292. instructions and text generation.  Starting with the entry point instructions
  293. are followed one by one including targets of jump and calls.  All
  294. instructions must be identified uniquely (jumps into the middle of other
  295. instructions are not accepted).  If not, no optimization will be performed.
  296.  
  297. Text generation uses my pride: a unit that disassembles one instruction and
  298. takes great care to handle prefixes correctly.  This unit has found two bugs
  299. in Borland's Turbo Assembler so you may assume that it has been tested better
  300. than Tasm.
  301.  
  302.  
  303. 5.2 The optimization phase
  304.  
  305. The optimization phase is driven by a regular expression engine.  All points
  306. of optimization are found using regular expressions.  Consider
  307.  
  308.         Regrep('//\(\(Add\|Adc\|Imul\|Mul\|Or\|And\|Xor\|Sub'+
  309.                    '\|Sbb\|Not\|Neg\) Ax.*\)/Or Ax,Ax','//\1');
  310.  
  311. where "/" means newline (ignore the double slashes).  This searches for zero
  312. flag setting instruction with register Ax as target followed by a check for
  313. Ax being zero.  When found it will be replaced by the first instruction.
  314. This is safe for all code generated by Borland Pascal.
  315.  
  316.         Regrep(Callsystem(System_Procedure_No('FLn')),
  317.                '/Fldl2e/Fxch/Fyl2x');
  318.  
  319. Replaces all calls to System.FLn (8087 version of Ln) with three equivalent
  320. instructions.
  321.  
  322. When regular expressions are not powerful enough to handle replacements the
  323. search and replacement are split and mixed with suitable Pascal code.
  324.  
  325. Following is an almost complete list of optimizations performed.  Please note
  326. that not optimizations make sense under all circumstances, i.e., the set
  327. improvements using "Bt?" will be performed for 386+ only.  If you find
  328. something that ought to be improved, please tell me.  Also some subtle lies
  329. are present here.
  330.  
  331.         - Enter and Leave instructions are eliminated for 386 or better.
  332.         - "J<cc> @@over//Jmp @@target//@@over:" is replaced by
  333.           "J<ncc> @@target".  The jump sizing of Tasm may reverse this
  334.           action when the target is not 386 or better.
  335.         - Stack checks are unfolded.
  336.         - InOutRes checks are unfolded.
  337.         - Some overflow checks are improved.
  338.         - Range checks are improved or eliminated.
  339.         - FSin/FCos/FArcTan/FLn/FSqrt/FExp (80x87) are hardcoded or 
  340.           unfolded.
  341.         - 80x87 flag checks for 286+ improved.
  342.         - LongInt Shl/Shr are unfolded.  If the second operand is known,
  343.           special instruction sequences are used.
  344.         - Longint Mul/Div/Mod are unfolded and improved.
  345.         - Value parameters of type String are copied word by word.  One
  346.           byte too many of the actual parameter many may be copied but
  347.           this is safe.
  348.         - Value parameters of type String[odd_max_length] are copied word
  349.           by word.  One byte too many of the actual parameter may be copied
  350.           but this is safe.
  351.         - Value parameters of type String[even_max_length] are copied word
  352.           by word plus a single byte.  One byte too many of the actual 
  353.           parameter may be copied but this is safe.
  354.         - Value parameters of size 3, 5--10, or 12 are copied with
  355.           stand-alone "Mov" instructions.
  356.         - Value parameters of other sizes are copied word by word plus
  357.           perhaps a single byte.
  358.         - Adding a set component (Include or [...,expr,...]) is done by
  359.           a "Bts" instruction.
  360.         - Removing a set component (by Exclude) is done by a "Btr"
  361.           instruction.
  362.         - Loading of word sized set is unfolded.
  363.         - Some set membership tests are done by "Bt" instructions.
  364.         - Loading and storing of sets are unfolded and done word by word.
  365.         - Set operations "+", "-", "*", "=", and "<>" are unfolded.
  366.         - Calls to UpCase are unfolded.
  367.         - Conversions of chars to strings are unfolded.
  368.         - Loading of strings is done word by word.
  369.         - Storing of strings is unfolded and done word by word.
  370.         - Comparing strings for (in)equality is unfolded and improved.
  371.         - Some Imul instruction sequences are improved.
  372.         - Redundant Ax tests are eliminated.
  373.         - Push followed by Pop is eliminated.
  374.         - Code segments are padded to 2 (286), 4 (386), or 16 (486) bytes
  375.           in order to make procedures aligned optimal for the processor.
  376.           The same goes for procedure entries.
  377.  
  378.  
  379. 5.3 The assembly phase
  380.  
  381. The assembler code from the previous phase is put through Borland's Turbo
  382. Assembler.  No errors should be found and all optimizations will be ignored
  383. if one is.  The assembly is done in Ideal+Smart mode with jump optimization.
  384.  
  385. The assembly is the memory critical phase.  The heap of Spo is shrunk to its
  386. minimum while running Tasm so I don't think you will notice any problems.  I
  387. might consider swapping to disk or Xms later.
  388.  
  389.  
  390. 6. Error messages and warnings
  391.  
  392. There are found kinds of messages from Spo: information, warnings, errors,
  393. and internal errors.  This (incomplete) list describes them.
  394.  
  395.  
  396. 6.1 Errors
  397.  
  398. Error are situations in which Spo does not know how to proceed.  If you
  399. cannot figure out why you get some message, simply refer from optimizing the
  400. unit.
  401.  
  402. Error:   Target processor "..." unknown.
  403.          You must specify one of 8086, 186, 286, 386, or 486 as the
  404.          target.  A lot of variant spellings are accepted but you
  405.          needn't know them all.
  406.  
  407. Error:   More than one target specified.
  408.          Only one /Tx option may be specified.  To optimize for more than
  409.          one target processor you must run Spo repeatedly.
  410.  
  411. Error:   More than one target platform specified.
  412.          Only one /Cx option may be specified.  To optimize for more than
  413.          one target platform you must run Spo repeatedly.
  414.  
  415. Error:   More than one assembler specified.
  416. Error:   More than one overflow checking action specified.
  417. Error:   More than one range checking action specified.
  418. Error:   More than one stack checking action specified.
  419. Error:   More than one InOutRes checking action specified.
  420. Error:   More than one floating point action specified.
  421.          Duplicate use of /Ax, /Ox, /Rx, /Sx, /Ix, and /Nx options is not
  422.          allowed.  Use the one that comes closest to your needs.
  423.  
  424. Error:   Illegal overflow check action specified: ...
  425. Error:   Illegal range check action specified: ...
  426. Error:   Illegal stack check action specified: ...
  427. Error:   Illegal InOutRes check action specified: ...
  428. Error:   Illegal floating point action specified: ...
  429. Error:   Illegal debug option specified: ...
  430. Error    Illegal target platform specified: ...
  431.          You specified an illegal option modifier.  Study the usage
  432.          description above for the right ones.
  433.  
  434. Error:   Unknown option specified: "."
  435.          You specified an option that Spo does not recognize.  See the
  436.          section about options above.
  437.  
  438. Error:   The target processor does not have the Bound instruction.
  439.          Range checking with "Bound" instructions is not available
  440.          when the target is 8086.  Use option "/T186" to control
  441.          the target.
  442.  
  443. Error:   The unit "..."  was compiled for another platform.
  444.          The indicated unit was compiled for a target platform different
  445.          from what its name specifies.  This should only happen if you
  446.          rename units or libraries.
  447.  
  448. Error:   Could not create temporary file.
  449.          The file "$po.Asm" could not be created in the current directory.
  450.          Probably the disk is write protected or full.
  451.  
  452. Error:   Overflow in table to hold generated code.
  453.          Either more than 64K code was generated for a single segment or
  454.          you are running out of memory.  Neither is likely to happen.
  455.  
  456. Error:   Overflow in table to hold generated fixups.
  457.          Either more than 64K relocation fixup information was generated
  458.          for a single segment or you are running out of memory.  Neither
  459.          is likely to happen.
  460.  
  461. Error:   Overflow in table to hold generated trace information.
  462.          Either more than 64K code-per-line information was generated
  463.          for a single segment or you are running out of memory.  Neither
  464.          is likely to happen.
  465.  
  466. Error:   Assembly buffer overflow.
  467.          The buffer to hold the assembly code overflowed.  Your unit
  468.          probably has a very large procedure or function.  At the present
  469.          I estimate the maximum to be 9K code.  You should try to use the
  470.          386 version instead -- if that fails refer from optimizing that
  471.          unit.
  472.  
  473. Error:   The unit "..." could not be loaded.
  474.          The unit was not found.  By default the unit is searched for in
  475.          the current directory, in directories specified by the PATH
  476.          environment variable, in "C:\Unit", in "C:\Bp\Bin", and finally
  477.          in "C:\Bp\Units".
  478.  
  479.          The search order is as given here.  If the unit was not found the
  480.          search is repeated for "Turbo.Tpl" ("Tpp.Tpl" for protected mode
  481.          units, "Tpw.Tpl" for Windows units, "OS2.Tpl" for OS/2 units) and
  482.          the unit is searched for therein.  (The PATH is searched in order
  483.          to find Turbo.Tpl).
  484.  
  485.          Units specified with wildcards are searched for in the specified
  486.          or current directory only.
  487.  
  488. Error:   The unit "..." is too big for Spo to handle.
  489.          Currently Spo requires the entire unit to be less than 64KB on
  490.          disk.  Symbol information for browsing is probably not updated
  491.          correctly anyway so it is a good idea to compile without that.
  492.  
  493. Error:   The file "..." does not contain a valid unit.
  494.          The header of the given unit is invalid.  Recompile.
  495.  
  496. Error:   The unit "..." was made by a pre 7.0 version of Turbo Pascal.
  497.          The header of the unit indicates that it was compiled by an
  498.          earlier version of Turbo Pascal, i.e., version 4.0, 5.0, 5.5, or
  499.          6.0.  Recompile.
  500.  
  501. Error:   The output file could not be opened.
  502. Error:   Error writing the output file.
  503.          Probably the disk is write protected or full.
  504.  
  505.  
  506. 6.2 Warning
  507.  
  508. Warnings are messages to you about abnormal situations.  Spo knows how to
  509. continue but evaluate the situation yourself.
  510.  
  511. Warning: This unit was compiled to use 186 instructions.
  512.          As the unit was compiled with option {$G+} and the target was
  513.          specified as 8086 you are relying on Spo to remove all
  514.          186-specific instructions.  There should be no problems with
  515.          this if and if only all code segments are optimized, i.e., if
  516.          the analysis succeeds.
  517.  
  518. Warning: The resulting code may be inefficient on this machine.
  519.          The specified target processor is 486 while the processor on
  520.          which Spo is running is a 386.  The code will be optimized
  521.          for the 486 but will run on any 386.
  522.  
  523. Warning: The resulting code may or may not run on this machine.
  524.          The processor on which Spo is running will probably not be able
  525.          to run code produced with the optimized unit.  This is OK if
  526.          you are generating code for another machine, "cross compiling".
  527.  
  528. Warning: Program must install an Int-4-handler.
  529.          "Into" instructions will be generated to test for signed
  530.          arithmetic overflow.  Insert "INT_0405" or equivalent early in
  531.          the uses clause of your main program to install a proper handler
  532.          for this instruction.
  533.  
  534. Warning: Program must install an Int-5-handler.
  535.          "Bound" instructions will be generated to test some values
  536.          against a range.  Insert "INT_0405" or equivalent early in the
  537.          uses clause of your main program to install a proper handler
  538.          for these instructions.
  539.  
  540. Warning: The unit does not use itself!
  541.          There is something strange about this unit, since is not
  542.          reported to have donated anything to itself.
  543.  
  544.  
  545. 6.3 Internal errors
  546.  
  547. Internal error are not supposed to occur.  If you get one of these messages
  548. I'd like to know.  See above for a description about how to report bugs.  The
  549. messages take the form
  550.  
  551.         Internal error: Decode_Support confused
  552.  
  553. or perhaps [let's not hope so]
  554.  
  555.         Runtime error #201 at 1234:5678
  556.  
  557. Please include the message and (if possible) the source code for the unit in
  558. the bug report.  If you know what went wrong, please tell me!
  559.  
  560.  
  561. 6.4 Information
  562.  
  563. Informational messages are supposed to be self-explanatory.  If they aren't
  564. you can do one of two things: (1) Flame me.  (2) Ignore them.
  565.  
  566.  
  567. 7. On improved versions of TURBO.TPL, TPP.TPL, TPW.TPL and OS2.TPL
  568.  
  569. Some optimized versions of Turbo.Tpl can be obtained.  These can be used
  570. together with Spo without problems.
  571.  
  572. In an earlier version of this documentation I claimed that "...they are not
  573. worth the while."  It has been pointed out to me that not only is this
  574. unfair, it is also incorrect!  What I should have written was
  575.  
  576.         1. Spo and the improved library can cooperate only where Spo
  577.            does not optimize.  In that case the improved library
  578.            function will simply not be called.
  579.         2. When Spo finds something to optimize it's good!
  580.  
  581. One could view Spo as low-level optimization and library-improvement as
  582. mid-level optimization.  As I would never dream of unfolding (say) the heap
  583. manager in order to improve calls to GetMem chances are that you can have the
  584. best of both worlds!  You cannot loose so go ahead and try!
  585.  
  586. I am aware of only one optimized library for Borland Pascal 7.0: BPL70N14 by
  587. Norbert Juffa.  It is now available at garbo.uwasa.fi in directory (I think)
  588. /pc/turbopas; the current version as of January 1994 is 1.4.
  589.  
  590. Note that improved libraries will improve the speed of your program during
  591. its development without slowing you down.  Spo can (reasonably) only be used
  592. for the final compilation since it takes its time.
  593.  
  594. A final word on compatibility: the support unit "Int_0405" depends on the
  595. first few bytes of the divide error handler.  There is no reason why this
  596. should be a problem for you; producing optimized versions of handlers for
  597. fatal exceptions is overkill!
  598.  
  599.  
  600. 8. New features to come or not
  601.  
  602. As one might expect this program could be enhanced to input the unit (or to
  603. output the new unit) in older versions of the tpu file format.  It would not
  604. be very much work but is it worth the while?  An easy thing to do would be to
  605. generate assembler code so that the code could be linked into C programs or
  606. whatever.
  607.  
  608. The code generated for the Case statement could be improved significantly by
  609. using jump tables when several branches are present.
  610.  
  611. The Fpu and Cpu types should be separated.
  612.  
  613. Swapping to disk or Xms should be possible in order to prevent the assembler
  614. from running out of memory.
  615.  
  616. Other procedures than system procedures should be unfolded, perhaps
  617. specialized (producing new procedures when knowing the values of some of the
  618. parameters).  This is a technique in its childhood so you should not expect
  619. much.  Look up articles on "Partial Evaluation".
  620.  
  621. Redundant load and save instructions should be eliminated.  Much more should
  622. be done with 32-bit instructions, i.e., pushing pointers and longints.  The
  623. reason that it has not already been done is that a concept of "dead"
  624. registers and flags has to be formulated.
  625.  
  626.  
  627. 9. Keeping the lawyers happy
  628.  
  629. Borland International holds "Tasm", "Turbo Assembler", and "Borland Pascal"
  630. as trademarks; Microsoft Corp. holds "Windows" as trademark; International
  631. Business Machines Corp. holds "Ibm Pc" as trademark; Intel Corp. holds the
  632. cpu names as trademarks.  I don't know who holds "OS/2" as a trademark, but
  633. it must be either International Business Machines Corp. or Microsoft Corp.
  634.  
  635.  
  636. 10. Thanks
  637.  
  638. Special thanks to William L. Peavy <70042.2310@compuserve.com>, author of
  639. TPU6.  Without his work this program would not have been possible.
  640.  
  641. Thanks to Ralf Brown <ralf@telerama.pgh.pa.us> for the interrupt list.
  642. There's nothing like good documentation on technical issues.
  643.  
  644. Thanks to Duncan Murdoch <dmurdoch@mast.QueensU.CA> for keeping the list
  645. of known bugs in Borland Pascal.  New versions of programs always seem to
  646. follow the line "old bugs replaced by new and unknown ones."
  647.  
  648. Thanks to Norbert Juffa <S_JUFFA@irav1.ira.uka.de> for useful comments and
  649. for pointing out serious bugs in the handling of 8087 instructions.
  650.  
  651. Several others has helped me -- thanks to all of you!
  652.  
  653.  
  654. 11. Scary codes
  655.  
  656. This chapter is intended to confuse you.
  657.  
  658. Local Variables: ***
  659. mode: text ***
  660. fill-column: 77 ***
  661. End: ***
  662.