;;; -*- Mode:Gate; Fonts:(HL12 HL12I HL12B CPTFONTB HL12BI HL12B HL12I ) -*- =Node: Closure Subprimitives =Text: 3CLOSURE SUBPRIMITIVES* These functions deal with things like what closures deal with: the distinction between internal and external value cells and control over how they work. 3sys:%binding-instances* 1list-of-symbols* This is the primitive that could be used by 2closure*. First, if any of the symbols in 1list-of-symbols* has no external value cell, a new external value cell is created for it, with the contents of the internal value cell. Then a list of locatives, twice as long as 1list-of-symbols*, is created and returned. The elements are grouped in pairs: pointers to the internal and external value cells, respectively, of each of the symbols. 2closure* could have been defined by: 3(defun closure (variables function)* 3 (%make-pointer dtp-closure* 3 (cons function (sys:%binding-instances variables)))) sys:%using-binding-instances* 1instance-list* This function is the primitive operation that invocation of closures could use. It takes a list such as 2sys:%binding-instances* returns, and for each pair of elements in the list, it ``adds'' a binding to the current stack frame, in the same manner that the 2%bind* function does. These bindings remain in effect until the frame returns or is unwound. 2sys:%using-binding-instances* checks for redundant bindings and ignores them. (A binding is redundant if the symbol is already bound to the desired external value cell.) This check avoids excessive growth of the special pdl in some cases and is also made by the microcode which invokes closures, entities, and instances. Given a closure, 2closure-bindings* extracts its list of binding instances, which you can then pass to 2sys:%using-binding-instances*. 3sys:%internal-value-cell* 1symbol* Returns the contents of the internal value cell of 1symbol*. 2dtp-one-q-forward* pointers are considered invisible, as usual, but 2dtp-external-value-cell-pointer*s are 1not*; this function can return a 2dtp-external-value-cell-pointer*. Such pointers will be considered invisible as soon as they leave the ``inside of the machine'', meaning internal registers and the stack. =Node: Distinguishing Processor Types =Text: 3DISTINGUISHING PROCESSOR TYPES* The MIT Lisp Machine system runs on two types of processors: the CADR and the Lambda. These are similar enough that there is no difference in compiled code for them, and no provision for compile-time conditionalization. However, obscure or internal I/O code sometimes needs to behave differently at run-time depending on the type of processor. This is possible through the use of these macros. 3sys:processor-type-code* 1Variable* This variable is the value of 2sys:cadr-type-code* on a CADR processor or equivalent, 2sys:lambda-type-code* on a Lambda. 3sys:cadr-type-code* 1Constant* A possible value for 2sys:processor-type-code*. The numeric value is 1. 3sys:lambda-type-code* 1Constant* A possible value for 2sys:processor-type-code*. The numeric value is 2. 3if-in-cadr* 1body...* 1Macro* Executes 1body* only when executing on a CADR. 3if-in-lambda* 1body* 1Macro* Executes 1body* only when executing on a Lambda. 3if-in-cadr-else-lambda* 1if-cadr-form* 1else-body...* 1Macro* Executes 1if-cadr-form* when executing on a CADR, executes 1else-body* when executing on a Lambda. 3(format t "~&Processor is a ~A.~%"* 3 (if-in-cadr-else-lambda "CADR" "Lambda")) if-in-lambda-else-cadr* 1if-lambda-form* 1else-body...* 1Macro* Executes 1if-cadr-form* when executing on a Lambda executes 1else-body* when executing on a CADR. 3select-processor* 1clauses* 1Macro* Each clause consists of 2:cadr* or 2:lambda* followed by forms to execute when running on that kind of processor. Example: 3(format t "~&Processor is a ~A.~%"* 3 (select-processor* 3 (:cadr "CADR")* 3 (:lambda "Lambda")))* =Node: Microcode Variables =Text: 3MICROCODE VARIABLES* The following variables' values actually reside in the scratchpad memory of the processor. They are put there by 2dtp-one-q-forward* invisible pointers. The values of these variables are used by the microcode. Many of these variables are highly internal and you shouldn't expect to understand them. 3%microcode-version-number* 1Variable* This is the version number of the currently-loaded microcode, obtained from the version number of the microcode source file. 3sys:%number-of-micro-entries* 1Variable* Size of 2micro-code-entry-area* and related areas. 2default-cons-area* is documented on 4(AREAS-1)Area Functions and Variables*. 3sys:number-cons-area* 1Variable* The area number of the area where bignums, ratios, full-size floats and complexnums are consed. Normally this variable contains the value of 2sys:extra-pdl-area*, which enables the ``temporary storage'' feature for numbers, saving garbage collection overhead. 2current-stack-group* and 2current-stack-group-resumer* are documented on 4(STACKGROUPS-1)Resuming of Stack Groups*. 3sys:%current-stack-group-state* 1Variable* The 2sg-state* of the currently-running stack group. 3sys:%current-stack-group-calling-args-pointer* 1Variable* The argument list of the currently-running stack group. 3sys:%current-stack-group-calling-args-number* 1Variable* The number of arguments to the currently-running stack group. 3sys:%trap-micro-pc* 1Variable* The microcode address of the most recent error trap. 3sys:%initial-fef* 1Variable* The function that is called when the machine starts up. Normally this is the definition of 2si:lisp-top-level*. 3sys:%initial-stack-group* 1Variable* The stack group in which the machine starts up. Normally this is the initial Lisp Listener window's process's stack group. 3sys:%error-handler-stack-group* 1Constant* The stack group that receives control when a microcode-detected error occurs. This stack group cleans up, signals the appropriate condition, or assigns a stack group to run the debugger on the erring stack group. 3sys:%scheduler-stack-group* 1Constant* The stack group that receives control when a sequence break occurs. 3sys:%chaos-csr-address* 1Constant* A fixnum, the virtual address that maps to the Unibus location of the Chaosnet interface. 3%mar-low* 1Variable* A fixnum, the inclusive lower bound of the region of virtual memory subject to the MAR feature (see 4(DEBUGGING-6)The MAR*). 3%mar-high* 1Variable* A fixnum, the inclusive upper bound of the region of virtual memory subject to the MAR feature (see 4(DEBUGGING-6)The MAR*). 3sys:%inhibit-read-only* 1Variable* If non-2nil*, you can write into read-only areas. This is used by 2fasload*. 2self* is documented on 4(FLAVOR-2)Flavor Functions*. 2inhibit-scheduling-flag* is documented on 4(PROCESSES-1)The Scheduler*. 3inhibit-scavenging-flag* 1Variable* If non-2nil*, the scavenger is turned off. The scavenger is the quasi-asynchronous portion of the garbage collector, which normally runs during consing operations. 3sys:scavenger-ws-enable* 1Variable* If this is 2nil*, scavenging can compete for all of the physical memory of the machine. Otherwise, it should be a fixnum, which specifies how much physical memory the scavenger can use: page numbers as high as this number or higher are not available to it. 3sys:%region-cons-alarm* 1Variable* Increments whenever a new region is allocated. 3sys:%page-cons-alarm* 1Variable* Increments whenever a new page is allocated. 3sys:%gc-flip-ready* 1Variable* 2t* while the scavenger is running, 2nil* when there are no pointers to oldspace. 3sys:%gc-generation-number* 1Variable* A fixnum which is incremented whenever the garbage collector flips, converting one or more regions from newspace to oldspace. If this number has changed, the 2%pointer* of an object may have changed. 3sys:%disk-run-light* 1Constant* A fixnum, the virtual address of the TV buffer location of the run-light which lights up when the disk is active. This plus 2 is the address of the run-light for the processor. This minus 2 is the address of the run-light for the garbage collector. 3sys:%loaded-band* 1Variable* A fixnum, the high 24 bits of the name of the disk partition from which virtual memory was booted. Used to create the greeting message. 3sys:%disk-blocks-per-track* 1Variable* 3sys:%disk-blocks-per-cylinder* 1Variable* Configuration of the disk being used for paging. Don't change these! 2sys:%disk-switches* is documented on 4(SUBPRIMITIVES-2)The Paging System*. 3sys:%qlaryh* 1Variable* This is the last array to be called as a function, remembered for the sake of the function 2store*. 3sys:%qlaryl* 1Variable* This is the index used the last time an array was called as a function, remembered for the sake of the function 2store*. 3sys:%mc-code-exit-vector* 1Variable* This is a vector of pointers that microcompiled code uses to refer to quoted constants. 3sys:currently-prepared-sheet* 1Variable* Used for communication between the window system and the microcoded graphics primitives. 2alphabetic-case-affects-string-comparison* is documented on 4(CHARSTR-2)Basic String Operations*. 2sys:tail-recursion-flag* is documented on 4(EVAL-4)Tail Recursion*. 2zunderflow* is documented on 4(NUMBERS-0)Numbers*. The next four have to do with implementing the metering system described in 4(MISCELL-1)Metering*. 3sys:%meter-global-enable* 1Variable* 2t* if the metering system is turned on for all stack-groups. 3sys:%meter-buffer-pointer* 1Variable* A temporary buffer used by the metering system. 3sys:%meter-disk-address* 1Variable* Where the metering system writes its next block of results on the disk. 3sys:%meter-disk-count* 1Variable* The number of disk blocks remaining for recording of metering information. 3sys:lexical-environment* 1Variable* This is the static chain used in the implementation of lexical scoping of variable bindings in compiled code. 3sys:amem-evcp-vector* 1Variable* No longer used. 2background-cons-area* is documented on 4(AREAS-1)Area Functions and Variables*. 2sys:self-mapping-table* is documented on 4(FLAVOR-5)Implementation of Flavors*. 2sys:processor-type-code* is documented on 4(SUBPRIMITIVES-3)Distinguishing Processor Types*. 3sys:a-memory-location-names* 1Constant* A list of all of the above symbols (and any others added after this documentation was written). =Node: Microcode Meters =Text: 3MICROCODE METERS* Microcode meters are locations in the scratchpad memory which contain numbers. Most of them are used to count events of various sorts. They are accessible only through the functions 2read-meter* and 2write-meter*. They have nothing to do with the Lisp metering tools. 3read-meter* 1name* Returns the contents of the microcode meter named 1name*, which can be a fixnum or a bignum. 1name* must be one of the symbols listed below. 3write-meter* 1name* 1value* Writes 1value*, a fixnum or a bignum, into the microcode meter named 1name*. 1name* must be one of the symbols listed below. The microcode meters are as follows: 3sys:%count-chaos-transmit-aborts* 1Meter* The number of times transmission on the Chaosnet was aborted, either by a collision or because the receiver was busy. 3sys:%count-cons-work* 1Meter* 3sys:%count-scavenger-work* 1Meter* Internal state of the garbage collection algorithm. 3sys:%tv-clock-rate* 1Meter* The number of TV frames per clock sequence break. The default value is 67., which causes clock sequence breaks to happen about once per second. 3sys:%count-first-level-map-reloads* 1Meter* The number of times the first-level virtual-memory map was invalid and had to be reloaded from the page hash table. 3sys:%count-second-level-map-reloads* 1Meter* The number of times the second-level virtual-memory map was invalid and had to be reloaded from the page hash table. 3sys:%count-meta-bits-map-reloads* 1Meter* The number of times the virtual address map was reloaded to contain only ``meta bits'', not an actual physical address. 3sys:%count-pdl-buffer-read-faults* 1Meter* The number of read references to the pdl buffer that were virtual memory references that trapped. 3sys:%count-pdl-buffer-write-faults* 1Meter* The number of write references to the pdl buffer that were virtual memory references that trapped. 3sys:%count-pdl-buffer-memory-faults* 1Meter* The number of virtual memory references that trapped in case they should have gone to the pdl buffer, but turned out to be real memory references after all (and therefore were needlessly slowed down). 3sys:%count-disk-page-reads* 1Meter* The number of pages read from the disk. 3sys:%count-disk-page-writes* 1Meter* The number of pages written to the disk. 3sys:%count-fresh-pages* 1Meter* The number of fresh (newly-consed) pages created in core, which would have otherwise been read from the disk. 3sys:%count-disk-page-read-operations* 1Meter* The number of paging read operations; this can be smaller than the number of disk pages read when more than one page at a time is read. 3sys:%count-disk-page-write-operations* 1Meter* The number of paging write operations; this can be smaller than the number of disk pages written when more than one page at a time is written. 3sys:%count-disk-prepages-used* 1Meter* The number of times a page was used after being read in before it was needed. 3sys:%count-disk-prepages-not-used* 1Meter* The number of times a page was read in before it was needed, but got evicted before it was ever used. 3sys:%count-disk-page-write-waits* 1Meter* The number of times the machine waited for a page to finish being written out in order to evict the page. 3sys:%count-disk-page-write-busys* 1Meter* The number of times the machine waited for a page to finish being written out in order to do something else with the disk. 3sys:%disk-wait-time* 1Meter* The time spent waiting for the disk, in microseconds. This can be used to distinguish paging time from running time when measuring and optimizing the` performance of programs. 3sys:%count-disk-errors* 1Meter* The number of recoverable disk errors. 3sys:%count-disk-recalibrates* 1Meter* The number of times the disk seek mechanism was recalibrated, usually as part of error recovery. 3sys:%count-disk-ecc-corrected-errors* 1Meter* The number of disk errors that were corrected through the error correcting code. 3sys:%count-disk-read-compare-differences* 1Meter* The number of times a read compare was done, no disk error occurred, but the data on disk did not match the data in memory. 3sys:%count-disk-read-compare-rereads* 1Meter* The number of times a disk read was done over because after the read a read compare was done and did not succeed (either it got an error or the data on disk did not match the data in memory). 3sys:%count-disk-read-compare-rewrites* 1Meter* The number of times a disk write was done over because after the write a read compare was done and did not succeed (either it got an error or the data on disk did not match the data in memory). 3sys:%disk-error-log-pointer* 1Meter* Address of the next entry to be written in the disk error log. The function 2si:print-disk-error-log* (see 4(MISCELL-2)Utility Programs*) prints this log. 3sys:%count-aged-pages* 1Meter* The number of times the page ager set an age trap on a page, to determine whether it was being referenced. 3sys:%count-age-flushed-pages* 1Meter* The number of times the page ager saw that a page still had an age trap and hence made it ``flushable'', a candidate for eviction from main memory. 3sys:%aging-depth* 1Meter* A number from 0 to 3 that controls how long a page must remain unreferenced before it becomes a candidate for eviction from main memory. 3sys:%count-findcore-steps* 1Meter* The number of pages inspected by the page replacement algorithm. 3sys:%count-findcore-emergencies* 1Meter* The number of times no evictable page was found and extra aging had to be done. 3sys:a-memory-counter-block-names* 1Constant* A list of all of the above symbols (and any others added after this documentation was written). =Node: Miscellaneous Subprimitives =Text: 3MISCELLANEOUS SUBPRIMITIVES sys:%halt* Stops the machine.