[net.arch] pointers to freshly minted func

robison@uiucdcsb.CS.UIUC.EDU (03/13/86)

> 	The Buroughs B5700 had (in addition to the strangest subroutine
> linkage I've ever seen) a tagged architecture.  Each memory word had a
> (3-bit?) tag which defined the value stored there as integer, real,
> pointer, instruction, etc.  This tag was not directly accessible by a
> programmer which made it kind of hard to implement a compiler.  Presumably
> (I never actually used a B5700) there was some magic way the OS used to
> convert data into code, but I never ran accross any reference to it.
> 

Much of the 5700's security was enforced by the compiler.
Therefore ordinary users could not set the tags.  There was a priviliged
instruction which could set the tags.  Thus all compilers had to run
in priviledged mode.

The early versios of the compiler didn't enforce the security rules well
enough.  Specifically, a pointer could be set to point to a variable more
local than itself (i.e. an up-level pointer).  When the variable disappeared, 
accessing the pointer could lead to total system failure.  (In the compiler
manual there was an index entry "total system failure"!  The current compilers
on the system disallow anything that even looks like an attempt to make an
up-level pointer.

- Arch Robison

levy@ttrdc.UUCP (Daniel R. Levy) (03/16/86)

In a related vein:

It is my understanding that Spice 2 (an electronic circuit simulation program
written entirely in Fortran, except for a few system-dependent interfaces) in
the CDC version had a feature called CODGEN, where it would actually generate
machine code for solving upper (or lower, or both?) triangular matrices.
Now, how in the dickens did they get the machine to "run" the generated code?
I presume the interface must have been done in assembly language or at least
not in Fortran (which appears to me even less promising than C to have a way
to "go to" the data space).  Maybe they figured out some way to overwrite a
dummy function with the specially generated code?  Even wierder, some time
ago in mod.vlsi (or whatever it was called then) someone alluded to doing
it under (the infamous Unix) f77 on a VAX (or a Sun?).  Does somebody know how
this would have been implemented?  Thanks in advance.
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
						vax135}!ttrdc!levy

alan@apollo.uucp (Alan Lehotsky) (03/19/86)

Regarding how SPICE on CDC would dynamically create procedures
and then execute them.  This is a classic FORTRAN trick and is
handled by the fact that syntactically, the only difference
between an array-reference and a subroutine or function call
is that the array must have been dimensioned in a DIMENSION
statement or a type-statement(among other places).

So, if your compiler handles "named-common" by giving it a "global"
name you can do:

    SUBROUTINE dummy
    COMMON  /dynamic/ I(1000)
C
C   "Compile" code into the array "I" (including correct entry-exit
C   sequences and parameter-passing conventions
C
    ......
    END

    SUBROUTINE hacker
    CALL dynamic(1,2,3)
    END

This used to work on IBM-360s.  This trick won't work on APOLLO-DOMAIN,
VAX/VMS or (I think) most UNIX systems.

taylor@glasgow.glasgow.UUCP (Jem Taylor) (03/19/86)

In article <798@ttrdc.UUCP> levy@ttrdc.UUCP writes:
>the CDC version had a feature called CODGEN, where it would actually generate
>machine code for solving upper (or lower, or both?) triangular matrices.
>Now, how in the dickens did they get the machine to "run" the generated code?

The Cambridge (England) Phoenix system's BCPL implementation under MVT (OS/370)
had access to a loader so that one could load BCPL or FORTRAN modules, to allow
DIY overlaying in a restricted virtual address space (44K if memery serves me
aright). Since loading was from a disk dataset, one *could* I guess generate a
module and then overlay and execute it ... I dont know that anyone did thou.

-Jem.