>Bill Gunshannon wrote:
Yes, but outside the PDP-11, when was the last time you actually had to
worry about it as a programmer? Or figuring out overlays. Now there
was a science!!
Just thought I would add a bit of information about overlays
in response to "Now there was a science!!".
I made some modifications to MACRO-11 which counts the
number of times an overlay is read into memory in addition
to the number of times the overlay is called - the difference
being the number of times the overlay was called, but was
already memory. The numbers are displayed at the end
of the listing along with the elapsed time.
A sample output follows this post. Note that the same assembly
takes over 11 minutes on a PDP-11/83.
MACRO-11 has one root section (or permanent overlay) and 13
overlay segments distributed across 3 regions:
Region 1: 1 2 3 4
Region 2: 5 6 7 8 9
Region 3: 10 11 12 13
Outside of initialization and termination code, only overlays 4,
9 and 11 seem to be used or one from each region.
Summarizing the results is very easy. Most overlays are read
into memory (after being called, of course) a limited number
of times no matter how large the source code. Overlays 4,
9 and 11 can be called (without being read into memory)
hundreds of thousands of times. An order of magnitude
estimate is about 1 million total calls for each 1000 blocks
of source code.
BUT, THE TOTAL NUMBER OF READS IS LESS
THAN 100 FOR EVERY EXAMPLE THAT WAS
TESTED!!!!!!!!!!!!!!!!!
The overlay handler uses only about a dozen instructions to
call an overlay segment which is already in memory. So the
overhead in minimal if the subroutine being called does not
need to be read into memory.
I agree that DEC had many decades to optimize MACRO-11.
Perhaps DEC even wrote its own test code which did the same
as my modification. The counts were not hard to keep once I
saw the expected results - 32 bit count for the number of calls
and a 16 bit counts for the number of reads or 3 words for each
overlay. For extra insurance, I also kept a 48 bit count for the
total number of calls and the total number of reads (just in case)
since each additional word required only the "AdC (R0)+"
instruction with no testing or branches after the first word used
"Add #1,(R0)+" to advance the count. Since I initially had no
idea how many calls or reads were being made, a 48 bit
count was guaranteed to be sufficient. Printing out the results
was the difficult part.
If anyone is interested, let me know. After I finish the documentation,
I will release the code. Meanwhile, if you have an example you want
to check, I can download the files if they are more than 1 MB.
Otherwise,
use Zip or BZip2 and e-mail me the files which should reduce them to
less than 1/2 MB. Please include a SYSMAC.SML file if you need
a particular version.
Jerome Fine
------------------------------------------------------------------------------------------
Sample Set of Count Values - Approximately 1100 blocks of Source Files
Errors detected: 0
*** Assembler statistics
Work file reads: 943
Work file writes: 756
Size of work file: 38984 Words ( 153 Pages)
Size of core pool: 21760 Words ( 85 Pages)
Use of Overlays: 1 2 3 4 5 6 7 8 9 10 11 12 13 Total
Segment Calls: 11 5 3 528006 1 1 3 7 494138 106 135960 12 0 1158253
Required Reads: 11 5 3 10 1 1 3 5 6 10 20 10 0 85
Operating system: RT-11
Program File Name: LD2:MACRO.SAV[93]
Names of .FETCHed: None
Device Drivers: None
Elapsed time: 00:00:39.07