[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:3 Jan 2005 10:53:58 -0000 
Subject:Re: another fortran-related problem in pop11 
From:John Duncan 
Volume-ID: 

A.Sloman@cs.bham.ac.uk writes:

(snip)

> 
> But there is nothing to suggest that the behaviour might differ
> between solaris and linux.
> 
> Any ideas?
> 
> Aaron

   Hi Aaron,
            Happy New Year to you and everyone else.

            Are these Sun's at the University 64 bit ? From my reading
            on the subject Fortran 77 employs hardware floats and this
            might have side effects. To test this compile something like
            this in Fotrtran 77 on both systems.

            program prog
      
            implicit none


            integer i
            real r
            double precision d
            logical j

            write(6,*)  ' integers are ',kind(i)
            write(6,*)  ' reals are ',kind(r)
            write(6,*)  ' double precision are ',kind(d)
            write(6,*)  ' logicals are ',kind(j)


            end


            Also of course Suns are big-endian and PCs are little-endian
            so if byte order is important this might be a problem.


            And reading,

     www.cs.bham.ac.uk/research/poplog/sysdoc/ppg

            this looks scary



     For example, in all current implementations (all of  which  are  on
32-bit byte-addressable machines), encoding is achieved with one tag bit
to distinguish  simple  from  compound,  and  a  second  to  distinguish
integers  from  single  floats.  Since  all  POPLOG  data structures are
rounded to an exact  number  of  32-bit  words,  and  begin  on  a  word
boundary, the address of any structure is a multiple of 4, having 2 zero
bits at the bottom; bit 0 is then used for the first tag (0 =  compound,
1 = simple), and bit 1 for the second (0 = single float, 1 = integer).

            pointer            single float         integer
        -----------------    ----------------   ----------------
        |           |0|0|    |          |0|1|   |          |1|1|
        -----------------    ----------------   ----------------


     This does mean, of course, that two bits are lost from  the  normal
machine  representation of integers and single floats. A machine integer
M is mapped to a POPLOG integer P by the relation P =  4M+3,  while  the
mapping for a single float depends on the machine and its floating-point
format (essentially, the single float has to be massaged into  a  30-bit
format  with  the  2 least significant bits lost from the mantissa). See
the sections below for  a  discussion  of  arithmetic  on  integers  and
floats.

     This encoding scheme would still  be  valid  on  a  machine  having
addresses  in multiples of 16-bit units, where addresses of 32-bit words
are only a multiple of 2; bit 0 can  still  be  used  to  distinguish  a
simple object from a pointer.  On the other hand, it would not be viable


John Gibson                                                      July 86



                                 - 6 -


on a machine that addressed 32-bit words in  32-bit  units,  where  word
addresses would go up in ones. Assuming that addresses on such a machine
were positive as machine integers, an alternative  scheme  would  be  to
have simple items encoded as negative integers.


         I don't know if this still holds but he says that mapping for a
         single float depends on the machine,the rest is a bit over my
         head. Just a few ideas i had, you have probably already
         considered these points.

                                       All the best,
                                        John Duncan

























John Gibson                                                      July 86