home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / misc / 3689 next >
Encoding:
Text File  |  1992-11-15  |  8.6 KB  |  186 lines

  1. Newsgroups: comp.lang.misc
  2. Path: sparky!uunet!think.com!ames!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin
  3. From: hrubin@pop.stat.purdue.edu (Herman Rubin)
  4. Subject: Re: Accessing the hardware directly (Was: Pointers)
  5. Message-ID: <BxrK6x.A04@mentor.cc.purdue.edu>
  6. Sender: news@mentor.cc.purdue.edu (USENET News)
  7. Organization: Purdue University Statistics Department
  8. References: <721626972@sheol.UUCP> <BxpsHo.MID@mentor.cc.purdue.edu> <mwm.2n3n@contessa.palo-alto.ca.us>
  9. Date: Sun, 15 Nov 1992 15:25:44 GMT
  10. Lines: 174
  11.  
  12. In article <mwm.2n3n@contessa.palo-alto.ca.us> mwm@contessa.palo-alto.ca.us (Mike Meyer) writes:
  13. >In <BxpsHo.MID@mentor.cc.purdue.edu>, hrubin@mentor.cc.purdue.edu (Herman Rubin) wrote:
  14. >> This is not a change in subject.  It is the question of whether one
  15. >> is allowed to directly use the machine hardware, or whether one must
  16. >> HOPE that the compiler writer considered what you are doing when the
  17. >> compiler was produced.
  18.  
  19. >First, the people responsible for allowing you to access the hardware
  20. >*directly* are the hardware vendors. If it's that important to you,
  21. >you should use the facilities they provide. Better yet, convince them
  22. >to give you a WCS, so you can access the underlying hardware, and not
  23. >have to full with the macromachine. That can trim as much as an order
  24. >of magnitude off your program.
  25.  
  26. So far, I have not had too much trouble in at least getting access to
  27. the machine instructions.  But Dik Winter has just posted a followup
  28. to one of his postings in which he stated that, on the machine he is
  29. now using, he has no access to the assembler.
  30.  
  31. >If you don't like the syntax they provide for accessing these
  32. >facilities, bitch at *them*. Have you called the people who build the
  33. >machines you use and asked for a more accessible assembler?
  34.  
  35. It is not a matter of access, but of SYNTAX.  
  36.  
  37. >As for compiler writers, your hope is that what you are doing was
  38. >important to a large enough fraction of the user base that they did
  39. >it. As has been repeatedly pointed out, that's not the case for you
  40. >and most popular languages.
  41.  
  42. >Clearly, you need a language designed for your purposes. This has also
  43. >been pointed out repeatedly. People have even volunteered to take a
  44. >first crack at writing it, if you'd provide the spec. You still
  45. >haven't provided a spec for it.
  46.  
  47. I have repeatedly stated that it is impossible to produce a perfect
  48. language, even for my purposes.  I have not asked for one.  
  49.  
  50. What I have asked for is that the language be fully extensible.  If
  51. I want to add another type, I do so.  To SOME extent, C has this in
  52. structs, and C++ does a good job with its classes.  But we should at
  53. least call a spade a shovel, and call this typedef, and rename the
  54. C misnomer typealias.  I know that it is bad to change existing 
  55. terminology, but in this I am less guilty than the C creators.  
  56. I did use typedefs on Fortran IV for the CDC 3600 in the mid 60s.
  57.  
  58. >You complain that you don't have time to write such a spec, much less
  59. >a compiler. Yet the amount of time you've spent arguing on usenet
  60. >would seem sufficient to write the compiler. Clearly, it's more than
  61. >enough time to write the spec.
  62.  
  63. I still do not know what you mean by a spec.  I have stated that one
  64. thing which is certainly going to be needed is a really versatile
  65. macro converter.  What this is supposed to do is to convert from
  66. one syntax to another, but taking into account that the variables
  67. might have attributes, like types, storage classes (in particular,
  68. register), and whatever else seems needed.  I have given examples 
  69. of this, and I have been informed by those I respect that this can
  70. be done.  
  71.  
  72. Looking at what I have written above, the types certainly will not be
  73. limited to those in the current languages.  Bob Silverman has given 
  74. some examples of the notation; he would like to write
  75.  
  76.     c = a ** b
  77.  
  78. to multiply two integers of a given size to form a double length integer.
  79. Now in C++ one could insert a function doubmult, and even overload it to
  80. handle the possibility of different lengths being doubled, and instruct
  81. the compiler (?) to inline this.  Now with the macro converter, Bob would
  82. still have to define the function doubmult, but he could also have the
  83. macro conversion instruction
  84.  
  85. ###     a ** b    {
  86.     doubmult(a,b);}#
  87.  
  88. or some other suitable notation, and then he could blithely write a ** b
  89. in the program wherever he wants to.   Now there are more complicated
  90. situations.  There is one which even others have cited as "impossible"
  91. to understand.  I will now endeavor to show that it is not so bad, and
  92. I will give most of what it is doing, and why.  The syntax is
  93.  
  94.     c{'z} ={tc} {-}{|}{ta} a{'x} OP{mod} {|}{tb} b{'y} {/\{~}w}
  95.       1     2    3  4   5     6  7   8    9  10    11   12 13
  96.  
  97. Since there are so many optional fields, I have numbered them.  Now this
  98. is what it requires:
  99.  
  100.     c must be a register holding a vector descriptor.  The type of 
  101.     the vector may be integer or float or ..., and also half or full.
  102.  
  103.     If field 1 is present, c must be an even numbered register, and
  104.     the integer z must be in the next register.  The c (and w) offset
  105.     bit in the instruction is set; otherwise it is cleared.
  106.  
  107.     If field 2 is present, the half/full type of c is overridden.  
  108.     this bit in the instruction is set iff the final type is half, 
  109.  
  110.     If field 3 is set, the first argument is negated.  
  111.  
  112.     If field 4 or 9 is set, the modulus of the argument is used.
  113.  
  114.     a and b are either vector descriptors in registers, or scalars
  115.     in registers.  Fields 5 and 10 cause the appropriate bits in the
  116.     instruction to be set if scalars are used.
  117.  
  118.     If a or b is a vector, it can be offset.  Fields 6 and 11 cause
  119.     the register addresses of the offsets to be inserted in the
  120.     instruction.  Otherwise 0 must be used.
  121.  
  122.     Field 12 specifies that a control vector is used.  In that 
  123.     case, the bit address of the start of the control vector 
  124.     must be in the register address in the instruction.  The
  125.     z offset, if present, is used.
  126.  
  127.     Field 13 specifies that the control vector is toggled, which
  128.     means that 0 enables the operation rather than 1.
  129.  
  130.     Field 7 specifies the operation (+ - * / sqrt etc.)  I will
  131.     list the defaults and options for + only.  If the type of c
  132.     is integer, the default is upper.  If it is float, the 
  133.     default is normalize.  If it is address, the default is 
  134.     "address".  The possiblilities are upper, lower, normalize,
  135.     and address, and field 8 allows the default to be changed.
  136.  
  137. >Let me suggest that next quarter, when whatever regular event it is
  138. >that triggers your posting to usenet happens, instead of sitting down
  139. >and baiting newbies, why don't you sit down and start the spec for the
  140. >language you want to be using? Post *that* instead of the usual
  141. >harangue. If people are as wrong as you say they are, it should be
  142. >immediately obvious that the product is far superior to all other
  143. >languages. If that isn't the case, you will probably get some feedback
  144. >from people who have experience at language design/implementation,
  145. >pointing at what will be hard to do, and what would be a useful
  146. >addition to other languages.
  147.  
  148. >> Are we going to allow the driver to use the steering wheel and the 
  149. >> accelerator and brake, or just have a program to run the car?
  150.  
  151. >When the technology gets there, the user is going to have a program.
  152. >Circumventing it will be a crime. That's because the kind of silly
  153. >mistakes you get from going directly to the hardware in a car kill
  154. >people, not programs.
  155.  
  156. This statement does not surprise me.  As Franklin stated, quote from memory
  157.  
  158.     Those who will give up essential liberty for little safety 
  159.     deserve neither liberty nor safety.
  160.  
  161. >> One major advantage of Arabic over Roman is that Arabic can usually
  162. >> be written faster.  Are reference notations anywhere near as fast as
  163. >> pointers?
  164.  
  165. >They can be written faster, because they are closer to the problem.
  166. >They allow the compiler more latitude in implementation, meaning that
  167. >the *worst case* is that they run as slow as pointers, and in many
  168. >cases can use faster implementations, so they run faster. In other
  169. >words, they are a win-win solution.
  170.  
  171. I do not see how any system of references will enable writing
  172.  
  173.     *fill(*descriptor)
  174.  
  175. any faster.  Nor do I trust compiler writers (or government bureaucrats.)
  176. And if the lack of pointers in the languages causes hardware to elide pointers
  177. in favor of something clumsy like call_by_name, searching the name file, we
  178. all lose.  I have also pointed out that I want to use this in cases in which
  179. the calling routine does not even know the name.  True, you could read the
  180. name, but is that any easier than reading the address?
  181. -- 
  182. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  183. Phone: (317)494-6054
  184. hrubin@snap.stat.purdue.edu (Internet, bitnet)  
  185. {purdue,pur-ee}!snap.stat!hrubin(UUCP)
  186.