[Info-vax] BASIC, Performance, and Stack Walking (was: Re: Opportunity for VSI?)
John Reagan
xyzzy1959 at gmail.com
Mon Dec 17 09:14:37 EST 2018
On Sunday, December 16, 2018 at 10:35:34 PM UTC-5, Stephen Hoffman wrote:
> On 2018-12-17 02:25:15 +0000, Tim Sneddon said:
>
> > Part of the BASIC prologue requires the routine to hunt for some sort
> > of context.
>
> Some of the previous discussions...
> https://groups.google.com/d/msg/comp.os.vms/OVTUn9GDHPo/tdohHkGo2nQJ
> https://groups.google.com/d/msg/comp.os.vms/a58LJeU8FvQ/5jLe-0-6BQAJ
>
> That DBASIC$IO_NO_SIGNAL logical name means the C feature logical name
> design morass has infested BASIC, too.
>
> --
> Pure Personal Opinion | HoffmanLabs LLC
I was hoping nobody would mention that as I hope that nobody uses it and I can remove it.
Here's the story:
#1 Every BASIC routine calls into the RTL in the routine prologue to walk up the stack looking for any active BASIC frames to verify that the scale factor is identical. Apparently, if they aren't, a hole opens in the space-time continuum. This stack walk is cheap on Alpha but expensive on Itanium. The RTL was updated for Itanium to do this as quick as possible, but it still hurts on Itanium. You can turn off that RTL call with OPTION INACTIVE=SETUP but several different BASIC language features will turn it back on (see the BASIC User Manual). We are thinking to simplify the RTL's per-routine overhead and not to do that check by default. BASIC already turns on checking by default (ie, /CHECK=(BOUNDS,OVERFLOW). I want to add an off-by-default /CHECK=SCALE_FACTOR setting.
#2 The BASIC RTL will signal RMS errors, like file-not-found, on IO statements. Programs that normally rely on such signals as part of their normal operation noticed slower operation on Itanium. Unlike Pascal which as "ERROR := CONTINUE" and "ERROR := MESSAGE" on all IO routines, BASIC gives you the single behavior of signalling and expects you to catch that will a handler (many people use LIB$SIG_TO_RET). So we added support to the RTL to allow you to set a "do not signal, but return instead" on a "per-call" basis and a "per-lun" basis. Subsequently (from reading the notes and comments), HPE India added a BASIC feature logical to change the default. So there must be at least one customer who found it difficult to modify their application or didn't have sources to the application. I did an eye-roll when I saw that edit to the RTL when I returned to VSI and reviewed the changes. I want to remove that logical for x86 since the unwinding/signalling overhead on x86 is much smaller (not quite as small as Alpha, but much smaller than Itanium).
More information about the Info-vax
mailing list