Thread

  1. Re: [HACKERS] Platforms with v6.3 trouble

    bill.allie@mug.org — 1998-02-27T04:46:47Z

    On the SCO UNIXWARE (UNIVEL) port, it is only necessary to replace the macro 
    definition of fastgetattr with a static function in heapam.h in order to get 
    the code to compile.  I guess the people who wrote the compile could not 
    concieve of anyone nesting the trinary operator (?:) to such a depth :-).  The 
    UNIXWARE compiler does an excellent job of in-lining the function on it's own 
    without the macro.  The patch for the version of heapam.h I am using follows 
    (I am currently using USE_UNIVEL_CC_ASM as the trigger, but that can be 
    changed).
    
    Bruce,  will this change work?  I am not as familiar with this section of code 
    as I would like to be.
    
    ----
    *** src/include/access/heapam.h.orig    Fri Feb 13 20:18:33 1998
    --- src/include/access/heapam.h Sat Feb 14 09:03:40 1998
    ***************
    *** 88,93 ****
    --- 88,142 ----
       *
       * ----------------
       */
    + #if defined(USE_UNIVEL_CC_ASM)
    + extern Datum nocachegetattr(HeapTuple tup, int attnum,
    +                        TupleDesc att, bool *isnull);
    +
    + static Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
    +                        bool *isnull)
    + {
    +     return (
    +       (attnum) > 0 ?
    +       (
    +           ((isnull) ? (*(isnull) = false) : (dummyret)NULL),
    +           HeapTupleNoNulls(tup) ?
    +           (
    +               ((tupleDesc)->attrs[(attnum)-1]->attcacheoff != -1 ||
    +                (attnum) == 1) ?
    +               (
    +                   (Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]),
    +                       (char *) (tup) + (tup)->t_hoff +
    +                       (
    +                           ((attnum) != 1) ?
    +                               (tupleDesc)->attrs[(attnum)-1]->attcacheoff
    +                           :
    +                               0
    +                       )
    +                   )
    +               )
    +               :
    +                   nocachegetattr((tup), (attnum), (tupleDesc), (isnull))
    +           )
    +           :
    +           (
    +               att_isnull((attnum)-1, (tup)->t_bits) ?
    +               (
    +                   ((isnull) ? (*(isnull) = true) : (dummyret)NULL),
    +                   (Datum)NULL
    +               )
    +               :
    +               (
    +                   nocachegetattr((tup), (attnum), (tupleDesc), (isnull))
    +               )
    +           )
    +       )
    +       :
    +       (
    +            (Datum)NULL
    +       )
    +   );
    + }
    + #else
      #define fastgetattr(tup, attnum, tupleDesc, isnull) \
      ( \
        AssertMacro((attnum) > 0) ? \
    ***************
    *** 129,136 ****
             (Datum)NULL \
        ) \
      )
    !
    !
    
      /* ----------------
       *        heap_getattr
    --- 178,184 ----
             (Datum)NULL \
        ) \
      )
    ! #endif
    
      /* ----------------
       *        heap_getattr
    
    -- 
    ____       | Billy G. Allie    | Domain....: Bill.Allie@mug.org
    |  /|      | 7436 Hartwell     | Compuserve: 76337,2061
    |-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com
    |/  |LLIE  | (313) 582-1540    | 
    
    
    
    
  2. Re: [HACKERS] Platforms with v6.3 trouble

    Bruce Momjian <maillist@candle.pha.pa.us> — 1998-02-27T05:14:05Z

    > 
    > On the SCO UNIXWARE (UNIVEL) port, it is only necessary to replace the macro 
    > definition of fastgetattr with a static function in heapam.h in order to get 
    > the code to compile.  I guess the people who wrote the compile could not 
    > concieve of anyone nesting the trinary operator (?:) to such a depth :-).  The 
    > UNIXWARE compiler does an excellent job of in-lining the function on it's own 
    > without the macro.  The patch for the version of heapam.h I am using follows 
    > (I am currently using USE_UNIVEL_CC_ASM as the trigger, but that can be 
    > changed).
    > 
    > Bruce,  will this change work?  I am not as familiar with this section of code 
    > as I would like to be.
    
    This is fine, and a good place to put it, though the port-specific
    change should go AFTER the standard #define, not before it, so you do:
    
    #if !defined(SCO)
    #define
    #else
    static ...
    #endif
    
    As far as them never suspecting such a macro, well, I never suspected I
    would ever write such a macro either.  But I did, and it works.  I
    didn't inline this in the first pass of inlining because it looked so
    hard, but when I realized how many times it was called, and that I could
    inline just the beginning of the function to get more speed when the
    cache offset was active, I did it.  The new macro formatting style is my
    idea too, and it makes things much simpler.  Look at the ugly
    heap_getattr() macros in 6.2.
    
    
    -- 
    Bruce Momjian                          |  830 Blythe Avenue
    maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
      +  If your life is a hard drive,     |  (610) 353-9879(w)
      +  Christ can be your backup.        |  (610) 853-3000(h)