home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / arch / 8933 < prev    next >
Encoding:
Text File  |  1992-08-17  |  2.8 KB  |  55 lines

  1. Newsgroups: comp.arch
  2. Path: sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!news.th-darmstadt.de!rs5.hrz.th-darmstadt.de!graef
  3. From: graef@rs5.hrz.th-darmstadt.de (Ulrich Graef)
  4. Subject: Re: Threaded Code
  5. Sender: news@news.th-darmstadt.de (The Usenet-News System)
  6. Message-ID: <1992Aug17.135955.6903@news.th-darmstadt.de>
  7. Date: Mon, 17 Aug 1992 13:59:55 GMT
  8. References: <55535@mentor.cc.purdue.edu> <13910@goanna.cs.rmit.oz.au> <GLEW.92Aug7185506@pdx007.intel.com> <1992Aug10.141731.10007@email.tuwien.ac.at> <martin.713808550@bert> <34301@cbmvax.commodore.com>
  9. Nntp-Posting-Host: rs5.hrz.th-darmstadt.de
  10. Organization: TU Darmstadt
  11. Lines: 42
  12.  
  13. In article <34301@cbmvax.commodore.com>, jesup@cbmvax.commodore.com (Randell Jesup) writes:
  14. > martin@math.rwth-aachen.de (  Martin Schoenert) writes:
  15. > >Subroutine threading (sub.c):
  16. > >    For each instruction there is a (C) function which implements this
  17. > >    instruction.  The instructions are encoded with the addresses of
  18. > >    those functions.  Each function returns after it has done its work,
  19. > >    and there is a central dispatcher in 'main', which looks as follows
  20. > >    'while (1) (**pc++)();'
  21. >     This is not what I would call "subroutine threading".  Subroutine
  22. > threading (at least from my perspective of having written a subroutine-
  23. > threaded forth) means that you do not have an array of function addresses,
  24. > you have an array of "jsr <address>".  On top of that, the code that
  25. > generates the instructions can inline when appropriate (a big win in forth
  26. > on modern processors, since many simple operations are smaller than an
  27. > instruction or even an address).
  28. >     I'm not sure what I'd call your method.  It's big problem is that
  29. > it requires an explicit "interpret" instruction to call an instruction
  30. > written from instructions instead of as a pre-existing C routine.  If I had
  31. > to name it I would call it an "explicit-threaded interpreter", since the
  32. > thing that compiles the code must know to generate "interpret" instructions
  33. > to execute words that need interpretation, while all standard methods of
  34. > threading do not need to know.
  35.  
  36. I think, you both are right. Martin calls a method `subroutine threading'
  37. which is used in interpreters which are written in C.
  38. The `subroutine threading' of Randell, which is often used in Forth
  39. interpreters is the `indirect threading' of Martin.
  40.  
  41. The interpreters of Martin are intended to test the method.
  42. Therefore they are small and have not the ability to compile 
  43. code like an Forth-interpreter.
  44.  
  45.  
  46. Uli
  47.  
  48. -- 
  49. Ulrich Graef        |  analog (phone) :  +49 6155 62493           
  50. Lichtenbergweg 11   |  digital (Email): graef@hrz.th-darmstadt.de 
  51. D-W-6103 Griesheim  +--------------------------------------------
  52. Germany             |  Nothing is real, look into your mirror!
  53.