Browse Prior Art Database

Multiple CONTEXT Links for Fig-Forth

IP.com Disclosure Number: IPCOM000062066D
Original Publication Date: 1986-Oct-01
Included in the Prior Art Database: 2005-Mar-09
Document File: 2 page(s) / 14K

Publishing Venue

IBM

Related People

Reynolds, DC: AUTHOR [+2]

Abstract

This article describes a program which will modify the internal structure of a FORTH compiler to improve compilation time by a factor of 5 to 1. FORTH systems typically have a single threaded dictionary link. Compilation of a FORTH source program entails searching through the single dictionary link hundreds, perhaps thousands, of times. By dividing the dictionary link into 16 threads, the FORTH compiler can search the dictionary 16 times faster, which translates into an improvement of 5 to 1 in compilation time. The concept of using multiple dictionary threads is not new per se. Papers have been written about its advantages and recently FORTH vendors have been supplying compilers with such a feature. Selecting a single thread FORTH system for its other merits, however, precludes conversion to multiple threads later.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 2

Multiple CONTEXT Links for Fig-Forth

This article describes a program which will modify the internal structure of a FORTH compiler to improve compilation time by a factor of 5 to 1. FORTH systems typically have a single threaded dictionary link. Compilation of a FORTH source program entails searching through the single dictionary link hundreds, perhaps thousands, of times. By dividing the dictionary link into 16 threads, the FORTH compiler can search the dictionary 16 times faster, which translates into an improvement of 5 to 1 in compilation time. The concept of using multiple dictionary threads is not new per se. Papers have been written about its advantages and recently FORTH vendors have been supplying compilers with such a feature. Selecting a single thread FORTH system for its other merits, however, precludes conversion to multiple threads later. The program described here changes any standard FORTH compiler to a multiple threaded system. The FORTH interpreter searches through a single thread to locate the word searched,

(Image Omitted)

In a multiple thread system, the words are hashed into N possible links. In this implementation, N is 16.

(Image Omitted)

In this implementation, the second hexadecimal character (least significant four bits) of the ASCII byte representation of the first word is used for the hashing. For example, for the word "BOY", the ASCII representation of "B" is hexadecimal 42. Since the second character is 2, "BOY" will be hashed into the second link head. To separate FORTH into 16 link headings, the control words "CONTEXT" and "CURRENT" must comprise 16 elements instead of one. This is accomplished in screen 240 in the multi-element variables <CONTEXT> and <CURRENT>. CONTEXT2 and CURRENT2 return the actual addresses within the multi- element variables. The hashing is done with the word HASH, and the result of the hash is stored in the variable +HSH. The value in +HSH is used in the words CONTEXT2 and CURRENT2. With 16 element <CONTEXT> and <CURRENT>, CREATE must be changed so that all new definitions go into the correct location in the link heads. This is accomplished by screen 241 with CREATE2. To find the words, the search must migrate down the correct link path. This is accomplished by screen 241 with -FIND 2. Key words changed by Screen 242 are:

(Image Omitted)

The assembler used in redefining ":" is identical to the assembler used in defining the original ":" word, and is copied. SMUDGE, IMMEDIATE, and FORGET are also redefined to accommodate the changes, e.g., see scree...