[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::languages

Title:Languages
Notice:Speaking In Tongues
Moderator:TLE::TOKLAS::FELDMAN
Created:Sat Jan 25 1986
Last Modified:Wed May 21 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:394
Total number of notes:2683

249.0. "Reentrant code ?" by MSAM00::MIKEWARREN (SWS Dept, Malaysia) Mon Aug 28 1989 20:38

    When looking at tenders on computer language compilers, very often
    i see the question :
    
    	"Does the compiler support producing reentrant code ?"
    
    
    1. What does "reentrant code" mean ?
    
    2. Any idea which of our compilers that run on the VAX support this
       feature ?
    
    
    Regards, Michael.
T.RTitleUserPersonal
Name
DateLines
249.1All of themGIDDAY::GILLINGSHave we fixed it yet?Tue Aug 29 1989 03:2625
    Michael,                                                     
      "Reentrant code" in its most general sense means that code can be
    simultaneously executed by multiple execution threads. In this sense
    the only real necessity is for the code to be position independent and
    not modify itself. ALL VAX/VMS compilers satisfy this requirement
    (maybe someone has a counter example?). If they didn't then it would not
    be possible to run the same image from 2 different processes at the same
    time.
      Note that the above only applies to executable code, data areas are
    another matter entirely. See the system services manuals regarding
    "AST reentrancy" for some discussion. This area is more in the realm of
    program design than a feature of a compiler.
      Another possibility is that "reentrancy" is referring to the ability
    to write recursive routines. This is more a matter of the language
    definition than the compiler implementation. For example, VAX FORTRAN
    cannot be used to write recursive routines because of the way it
    allocates memory. Other languages which do allow recursion include
    PASCAL, ADA, PL/1 and C.
      I suspect that your customer requirements refer to the first
    definition (above). In which case you can safely say that all VAX/VMS
    compilers are OK. Indeed, the requirement is probably only there for
    historic reasons. Some 1960's compilers from some suppliers did crazy
    things like storing the return address of a subroutine call in the
    first word of the routines code.
    					John Gillings, Sydney CSC
249.2We were one of the crazy suppliers in the 1960'sPASTIS::MONAHANhumanity is a trojan horseTue Aug 29 1989 05:555
    The PDP-8 hardware stored "the return address of a subroutine call in the
    first word of the routines code".
    
    That didn't stop people writing compilers that handled recursive
    routines, though it did make it a little more difficult.
249.3MSAM00::MIKEWARRENSWS Dept, MalaysiaWed Aug 30 1989 05:213
    Thanks for the clarification.
    
    Regards, Michael.
249.4VAX Fortran not as good as the othersSAUTER::SAUTERJohn SauterWed Aug 30 1989 14:2212
    re: .1
    
    In my opinion, VAX Fortran does not produce position-independent 
    code, because it keeps parameter addresses in static storage.  
    You can argue that this is a "data" issue, but the Fortran programmer 
    isn't dealing with data when he writes a subroutine call, so the 
    Fortran programmer thinks of this as "code".
    
    There is logic in the linker to make this work in shareable images,
    but the result is that portions of the image become unshareable
    due to "non-PIC data".
        John Sauter
249.5what kinds of reentrancy?CASEE::PALO�etta finnst m�r �g�tt!Sat Sep 23 1989 11:5640
    There are four (4) levels of reentrancy:
    
    1	serial    
    2	recursive 
    3	AST       
    4	full ( or truly reentrant )      
    
    Serial Reentrancy: a serially reentrant routine must execute to
    completion before it is allowed to be called again.  FORTRAN routines
    are usually serially reentrant.
    
    Recursive Reentrancy: consider a routine that executes to the point of
    another call to itself;  it makes the call to itself (a recursive
    call), and then continues to make recursive calls until a statement is
    executed or a condition occurs that ends the recursion.  Then, the
    statements after the point of the recursive call execute, until
    finally the original call completes.  If *no* calls are permitted until
    the original call has completed, the routine is said to be recursively
    reentrant.  A recursively reentrant routine is also serially reentrant.
    
    AST Reentrancy: AST reentrancy means that at a random point duriong the
    execution of a routine, an AST can occur and the routine may be
    reentered ( by the AST call ).  VMS normally allows only one AST to be
    called at a time for any given access mode.  SO, if a routine is
    AST-reentrant, it may designed to permit at most two calls to be in
    progress at any one time.  An AST-reentrant routine is also serially
    reentrant.
    
    Full Reentrancy: routines are fully reentrant if they behave properly
    when called by multiple tasks whose execution can be suspended at
    arbitrary points ( and resumed in arbitrary orders ) in the routine's
    code.
    
    
    This information is paraphrased from the  VAX Ada Programmer's Run-Time
    Reference Manual (7.4.6).
    
    	FWIW    
    	
    		\rikki