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

Conference vaxaxp::vmsnotes

Title:VAX and Alpha VMS
Notice:This is a new VMSnotes, please read note 2.1
Moderator:VAXAXP::BERNARDO
Created:Wed Jan 22 1997
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:703
Total number of notes:3722

511.0. "LIB$CALLG issue on OpenVMS Alpha 7.0" by KMOOSE::CMCCUTCHEON (Charlie McCutcheon) Tue Apr 22 1997 13:57

I got the following question from ACT/gnat, who is writing an Ada '95
compiler for OpenVMS Alpha under contract for Digital:

>From:	US2RMC::"[email protected]" "Douglas Rupp" 21-APR-1997 17:04:37.70
>To:	Charlie McCutcheon <begin::cmccutcheon>, Lon Hilde <sspade::hilde>
>CC:	
>Subj:	VMS GDB: lib$callg and float args?
>
>Lib$callg apparently doesn't work with floating point args, is that
>right?  Is there any (easy) way around this?
>
>% ====== Internet headers and postmarks (see DECWRL::GATEWAY.DOC) ======

Does this ring any bells?  This is 7.0 on Alpha VMS.

I'm asking for more details, such as reproducer, and what happens to
make him think it doesn't work.  My moldy old VAX/VMS documentation
doesn't give me any clues as to why floating point would be special.

Thanks,
Charlie
DEC Ada
T.RTitleUserPersonal
Name
DateLines
511.1More information from DougKMOOSE::CMCCUTCHEONCharlie McCutcheonTue Apr 22 1997 14:2920
From:	US2RMC::"[email protected]" "Douglas Rupp" 22-APR-1997 13:26:15.86
To:	Charlie 22-Apr-1997 1249 -0500 <begin::cmccutcheon>
CC:	
Subj:	Re: VMS GDB: lib$callg and float args?

Charlie 22-Apr-1997 1249 -0500 wrote:
> 
> >Lib$callg apparently doesn't work with floating point args, is that
> >right?  Is there any (easy) way around this?
> 
> How does it not work?  Args aren't correct, or image access violates?  ;-)
....

The args aren't correct.  I think what happens is this: The called
function expects fp args to be passed in regs F16 and et al, but
lib$callg has no way of knowing if particular arg is fp, so it just
passes everything in R16 and et al.  Seems like it would be simple
enough to pass a mask to lib$callg but it doesn't take one.

% ====== Internet headers and postmarks (see DECWRL::GATEWAY.DOC) ======
511.2Alternatives; Code Would Be InterestingXDELTA::HOFFMANSteve, OpenVMS EngineeringTue Apr 22 1997 15:0117
   CALLG is a VAX instruction, with no direct Alpha equivalent...

   And yes, Alpha uses a parallel set of registers for floating point
   storage and manipulation...

   Consider passing the arguments by reference, and then redistribute
   the arguments as appropriate.  Or consider passing an array or
   data structure by reference -- possibly with type-length-value
   encoding or other scheme -- and then processing the structure as
   appropriate in the receiving routine...

   But code that would allow us to duplicate the problem would be quite
   interesting and useful -- I'd expect that direct OpenVMS VAX code
   would port to OpenVMS Alpha, even if floating point values were
   passed around via lib$callg.  (The contents of the argument array
   are of central interest here.)
511.3KMOOSE::CMCCUTCHEONCharlie McCutcheonTue Apr 22 1997 18:038
Doug tells me that Debug saw this and contacted him directly (thanks, Lon!).
It sounds like a restriction.

Doug's trying to implement an Ada '95 debugger (since VMS Debug won't be extended
for the '95 standard of Ada), and is trying to implement the "call" debug instruction.
I assume VMS Debug does this somehow on Alpha?

Charlie
511.4AUSS::GARSONDECcharity Program OfficeTue Apr 22 1997 20:5028
re .2               
    
>   But code that would allow us to duplicate the problem would be quite
>   interesting and useful -- I'd expect that direct OpenVMS VAX code
>   would port to OpenVMS Alpha, even if floating point values were
>   passed around via lib$callg.
    
    Passing a floating argument by value through LIB$CALLG does not seem to
    work on V6.2. I can see why extra sophistication would be needed in
    LIB$CALLG. It doesn't seem to be there. I don't have a V7.0 system to
    test the customer's claim.
    
re .3
    
    Quick testing of the debugger on Alpha VMS V6.2 suggests that it has not
    solved this problem i.e. it doesn't work to use the CALL command to
    pass a float by value. (Who knows? Maybe the debugger uses LIB$CALLG.)
    
    You might want to ask in the DEBUG conference as to whether a later version
    of VMS/DEBUG supports this.

re .1
    
    LIB$CALLG doesn't have a mask because it is originates in VAX where a
    mask isn't needed. It isn't clear to me whether a mask *argument* is
    actually needed on Alpha since there are all these nice blocks like the
    procedure descriptor and procedure signature that may already contain
    the needed info.
511.5KMOOSE::CMCCUTCHEONCharlie McCutcheonWed Apr 23 1997 11:037
>    You might want to ask in the DEBUG conference as to whether a later version
>    of VMS/DEBUG supports this.

Apparently Debug folk read this conference.  They use other means than lib$callg apparently.

Thanks!
Charlie
511.6Not insoluble, and a subset looks easyWIBBIN::NOYCEPulling weeds, pickin&#039; stonesWed Apr 23 1997 14:188
At first glance, it seems as if LIB$CALLG ought to simply load each of the
first 6 longwords of the argument list into both the appropriate integer
register (R16 thru R21) and the appropriate floating register (F16 thry F21).
You could make this work properly for VAX F_float types.  But if other types
(double-precision, or IEEE) are passed, you can't make them all work without
additional information.  If the routine to be called was compiled /TIE, then
its procedure descriptor contains information about the arguments it expects,
and one could imagine LIB$CALLG using that...
511.7AUSS::GARSONDECcharity Program OfficeWed Apr 23 1997 20:0913
re .6
    
>But if other types (double-precision
    
    Presumably double precision isn't an issue here. You just can't pass
    double by value with LIB$CALLG, right? [I am aware that C on VAX has an
    obnoxious hack that would require this and I can imagine that anyone
    doing this would simply have non-portable code.]
    
>If the routine to be called was compiled /TIE,
    
    Hmmm. Just for grins I tried that but on V6.2 it doesn't help. I think
    we can assume that LIB$CALLG just doesn't have the smarts in V6.2.
511.8AUSS::GARSONDECcharity Program OfficeThu Apr 24 1997 04:123
    re .*
    
    I've summarised this discussion in a QAR (V6 #01401).