home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rpi!uwm.edu!linac!att!ucbvax!lrw.com!leichter
- From: leichter@lrw.com (Jerry Leichter)
- Newsgroups: comp.os.vms
- Subject: Re: VAXC divide problems (V3.2)
- Message-ID: <9301271830.AA15422@uu3.psi.com>
- Date: 27 Jan 93 17:12:27 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Organization: The Internet
- Lines: 46
-
-
- ...As I explained in an earlier reply, the subtraction of 4 from the
- stack pointer is for allocation of a local variable for use by the
- VAXC$ESTABLISH condition-handler setup routine. That's not a
- condition handler itself, but the address of any handler you pass it
- is stored on the stack in the top four bytes, so they actually are
- space for a [pointer to a] condition handler. The value pointed to by
- the frame pointer is set to a handler inside the C run-time library.
-
- All fine so far.
-
- Gruesome details are available in the CRTL portion of the VMS
- listings. This ugly violation of the VMS Procedure Calling Standard
-
- In what way is this a violation of the Procedure Calling Standard? It is
- perfectly legitimate for a procedure to reserve space on the stack for data of
- local interest; nothing says that that space has to correspond to variables
- visible to the user. It is perfectly permissible for a condition handler to
- make calls to other procedures, basing its choices on locally available data.
- That's just what this condition handler is doing; it's no different, in
- principle, from having a local variable that indicates what you were trying
- to do, and a condition handler that checks that variable to decide what
- further action to take.
-
- is for setjmp/longjmp handling, and is inherited from the Pascal
- compiler of all places! ...
-
- Actually, I think it's the BASIC compiler (which had to pull the same kind
- of trick to implement its user error handling). Any run-time system that
- needs to gain control when frames are unwound off the stack, for any of a
- wide variety of reasons, will have to do something of this sort.
-
- LIB$ESTABLISH is a low-level tool that provides access to an important
- facility that many HLL's don't independently provide. It has always been
- made clear in the standards and the documentation that, if an HLL provides
- equivalent facilities, you should use them - and you may HAVE to use them.
- Some HLL's (I think BASIC is one, but I'd have to check the documentation;
- Ada is almost certainly another) neither allow you to call LIB$ESTABLISH, nor
- provide a directly equivalent routine (though the provide other ways to do
- the same kind of thing). VAX C provides VAXC$ESTABLISH, which is a direct,
- "plug-compatible" replacement for LIB$ESTABLISH. What do you find so "ugly"
- about it? (The REAL ugliness is setjmp/longjmp, whose design and interface
- were inspired by a particular run-time implementation, and which are just
- plain uncomfortable in many otherwise quite reasonable systems.)
-
- -- Jerry
-