home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / compiler / documentation / notes.txt < prev    next >
Text File  |  1993-10-29  |  7KB  |  148 lines

  1.  
  2.  
  3.            Notes on potential compiler improvements
  4.  
  5.  
  6. * The analysis which generates `block-stack-link' could be improved.
  7. Currently, it fails in the case where the procedure is always invoked
  8. as a subproblem, but there are multiple possible continuations.  The
  9. reason is subtle: we need to know that the `continuation/offset' of
  10. all of the continuations is the same (as well as the frame-size and
  11. the closing-block).  Unfortunately, the computation of the offset
  12. depends on the subproblem ordering, which depends on the stack-link
  13. (to decide whether or not to use static links).  Catch-22.  Probably
  14. this can be solved.
  15.  
  16. * Pathological case of "takr.scm" can perhaps be solved by integrating
  17. simapp and outer into one pass.  By handling "passed-in" nodes before
  18. other nodes, and not making links to such nodes, the explosion of
  19. useless dataflow information would be avoided.  However, this affects
  20. the static-link analysis, which looks at BOTH the "passed-in" bit as
  21. well as the set of values.  Think of some way to make this degrade
  22. properly.
  23.  
  24. * Make the static-link analysis more sophisticated so that it uses
  25. static links whenever the current strategy would require going through
  26. at least two links.  This sometimes happens when the parent must be
  27. located through the closing block of the continuation.  In this case
  28. it is probably better to add a redundant static link for speed in
  29. lookup.
  30.  
  31. * When tail-recursing into an internal procedure, if the procedure has
  32. no free variables, we can erase the calling frame.  In the simplest
  33. case, this means that such a procedure is actually an external
  34. procedure.  However, we could get more sophisticated and notice that
  35. it was OK to delete some of the ancestor stack frames but not others.
  36.  
  37. * The code generated by the rewrite rule for disjunctions demonstrates
  38. that the decision about whether or not to use registers for LET
  39. parameters does not depend on the entire body of the LET.  In this
  40. case, the predicate parameter can ALWAYS be register allocated,
  41. independent of the complexity of the alternative, because it is unused
  42. once the decision has been made in favor of the alternative.  This can
  43. be generalized to handle more complex cases.
  44.  
  45. * Change CFG implementation so that `hook' objects are just partially
  46. connected edges.  I think that noop nodes can then be eliminated in
  47. favor of disconnected edges.  This will also solve a potential problem
  48. where deletion of the noop nodes at the entry points of continuations
  49. leaves random hooks scattered around in various subproblems.
  50.  
  51. * Many closures are never invoked through their external entry points.
  52. For such closures, the external entry point and associated code need
  53. never be generated.  Also, the closure object need not contain a code
  54. pointer.  This is one step closer to just using the closure frame
  55. pointer in place of the closure.
  56.  
  57. * Perform dead-code-elimination at the same time as constant folding.
  58. Be thorough, deleting all nodes associated with all code that is
  59. eliminated.  This is tricky but pays off handsomely later on.  Also,
  60. doing it after the dataflow but before the rest of the analysis
  61. greatly reduces the amount of details that have to be kept track of
  62. during deletion.
  63.  
  64. ALSO: note that removal of code to hack known predicates in "rgretn"
  65. may make something like this necessary for simple cases.
  66.  
  67. Subsequent note: performing dead code elimination prior to subproblem
  68. ordering has a problem in that there are cfg fragments in the
  69. subproblems with invisible pointers into the node structure.  We can't
  70. delete nodes unless we know about these pointers, so we must do dead
  71. code elimination after subproblem ordering.
  72.  
  73. * Now that RTL generator does not generate temporaries for quantities
  74. that are immediately pushed, tested, etc., we will need to modify the
  75. CSE to generate temporaries for the cases where those quantities are
  76. found in multiple places.  Hopefully this won't break the world.
  77.  
  78. * The interning of SCode variable objects (for explicit lookup) is
  79. done on a per-block basis.  It should be changed so that stack blocks
  80. are skipped and the interning is done on the nearest IC block.
  81.  
  82. * Fixnum operations
  83.  
  84. ** Is signed bit-field extraction faster than current strategy if the
  85. operand is in memory?
  86.  
  87. ** In the case of addition of two boxed fixnums to a boxed result,  no
  88. unboxing is needed on the operands provided the result is boxed in the
  89. usual way.
  90.  
  91.  
  92.             Items that have been processed
  93.  
  94.  
  95. * Introduction of inline-coded continuations (i.e. continuations of
  96. type UNIQUE or SIMPLE) has invalidated the current method of
  97. maintaining the frame pointer offset.  The reason is that the body of
  98. such a continuation thinks that the frame pointer knows where its
  99. frame is, while the offset in fact refers to some ancestor of that
  100. frame.  I think that ignoring the frame of such a continuation in
  101. `find-block' will produce the desired effect.
  102.  
  103. * JOIN type blocks aren't needed for offset, but they ARE needed to
  104. prevent continuations from being classified as UNIFORM when they
  105. aren't.
  106.  
  107. * To do `block-parent' operation on a "real" block, must skip any
  108. intervening JOIN blocks to find the next "real" block.
  109.  
  110. * `generator/subproblem' has code to mark frame-size of a join block
  111. if the continuation is closed in one.  That needs to be moved
  112. elsewhere?
  113.  
  114. * Theory: JOIN blocks are always invisible _except_ when needed to
  115. compute a frame pointer offset.  This means:
  116.  
  117. ** `find-block' and friends in "emodel" need to know about them.  Also
  118. the associated `stack-block-parent-locative' and similar
  119. constructions.
  120.  
  121. ** `procedure-closure-block' now refers to the previous
  122. `block-parent'.  The closing code must refer to `block-%parent' to get
  123. the lower-level closing block.
  124.  
  125. ** `block->join/distance' in "rgretn" needs to learn about them.
  126.  
  127. * (implemented 8/88 -- cph) The code in "rgretn" should be modified as
  128. follows.  At a return point, if the continuation is known, then we can
  129. just jump to the continuation, as long as we set things up correctly
  130. based on the operator class of the continuation.  This might mean, for
  131. example, that we throw away the return address on the stack because we
  132. know that it has a certain value.  In practice, this can occur when we
  133. supply a continuation to a combination that goes to one of two
  134. procedures.  The procedure in which the return appears is ONLY invoked
  135. with this continuation, while the other procedure is sometimes invoked
  136. with another continuation.  Thus we must push the return address,
  137. because we don't know which procedure we're invoking, but at return
  138. time it isn't needed.
  139.  
  140. * Some procedures that are being considered closures can easily be
  141. open external.  Each of the free variables must satisfy one of the
  142. following criteria: (1) it has a known value, or (2) it is bound in
  143. the IC block being used for cached references.  This optimization will
  144. make an enormous performance improvement on programs that consist of
  145. many procedures closed in a compiled block, with a few external
  146. closure entry points, because it will allow most of the internal
  147. procedures to be open.  Currently they will all become closures.
  148.