Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Moving VAX into 21 century :-)



Den 2019-08-31 kl. 14:04, skrev Johnny Billquist:
On 2019-08-31 05:13, Mouse wrote:
Things that CALL do:

Push requested register on stack at entry, and automatically restores
them again at return.

Saves AP and sets up new AP.

Saves and sets up new FP.

Also:

- Longword-aligns SP.

- Fiddles some trap enables based on the entry mask.

- Sets up fixed condition codes in the stack frame, which the procedure
    can fiddle and then have loaded into the PSW by RET.

- If CALLS is used instead of CALLG, RET pops additional longwords.

- Produces UNPREDICTABLE behaviour in various cases I doubt anyone
    cares about (such as CALLS SP,dst or CALLS R0,@(R0)+).

Right. And maybe some of those things can really be skipped without any negative effects, but I have a feeling that the main gain by JSB is just that by not doing a bunch of things you gain speed. But it is at a cost, and many times you actually want those things as well, and if you do all of them, then the gain from JSB are gone.
Not in the C ABI, that's the point :-)  The only things that are needed in a function call are:
- Remember return address
- Save/restore callee-saved regs (if needed)
- Allocate space on stack (if needed)

Saving/restoring regs take the same time whether or not CALLS is used, so I removed that from the calculation.

AP is never needed, and FP only if VLAs are used (or alloca called).

The work it change pcc to use this ABI was less than an hour, so it's was not a giant work.  Especially since all other (modern) archs use similar ABIs.

2) Make VAX use IEEE floats :-)

Personally, I would not use this.  I prefer to actively break code that
blindly assumes IEEE floating-point, so I can fix it.  (So far, I have
found more such code than I have code that legitimately depends on the
IEEE behaviour in cases where it differs from the VAX behaviour;
indeed, I can't recall a non-artificial example of the latter. Not
that I've found all that much of the former.)

I agree in the sense that most code do not actually need IEEE, and if they crash because of this, it is almost always artificial creations that explicitly fails, and not the actual meaningful code.

But it does raise the point if we should just fix it/fake it so that those stupid artificial tests pass, and just keep the VAX FP for the rest, so that the code will run, also when you have VAX FP.
That would be far too much inneccessary work.  I think making VAX FP act as IEEE is easy and lightweight.  Trying to fool zillions of packages are really time-consuming for no gain.

-- Ragge



Home | Main Index | Thread Index | Old Index