🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1152

gcc-2.2.2: doesn't inline generic fns/methods

#1152
From: Craig Federighi
Date: Tue, 15 Sep 1992 03:46
87 lines
2009 bytes
GCC Version:  gcc-2.2.2
Machine:      NeXT '040

I noticed that gcc isn't inlining generic functions or the inline methods
of generic (template) classes.  I couldn't find a mention of this limitation 
in any of the info files in the gcc install directory.  If there is a file
mentioning these sorts of limitations / bugs, could you please mail me back 
a pointer to it?

Here is a simple example using generic functions.  The results are similar
for the inline methods of generic classes.

// Test on inlined functions
// Non-template functions inline correctly

inline int InlineMax( const int &a, const int &b )
{
  return (a>b) ? a : b;
}

int CALLIINLINEMAX()
{
  return InlineMax(5, 10);
}

/*
_CALLIINLINEMAX__Fv:
  link a6,#-8
  moveq #5,d1
  movel d1,a6@(-4)
  moveq #10,d1
  movel d1,a6@(-8)
  lea a6@(-8),a0
  movel a6@(-4),d0
  cmpl a0@,d0
  jge L6
  movel a0@,d0
L6:
  unlk a6
  rts
*/



// Test on inlined functions
// Template functions do not inline.

template <class T>
inline T GenInlineMax( const T &a, const T &b )
{
  return (a>b) ? a : b;
}


int CALLGenInlineMax()
{
  return GenInlineMax(5, 10);
}

/*
_CALLGenInlineMax__Fv:
  link a6,#-8
  moveq #10,d1
  movel d1,a6@(-8)
  pea a6@(-8)
  moveq #5,d1
  movel d1,a6@(-4)
  pea a6@(-4)
  jbsr _GenInlineMax__FRCiT0
  unlk a6
  rts
  .align 1
_GenInlineMax__FRCiT0:
  link a6,#0
  movel a6@(8),a0
  movel a6@(12),a1
  movel a0@,d0
  cmpl a1@,d0
  jge L15
  movel a1@,d0
L15:
  unlk a6
  rts
*/

- Craig Federighi
  craigf@icsi.berkeley.edu
Technical Details
Message-ID: <9209151746.AA06115@cory.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cory.berkeley.edu!craigf

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cory.berkeley.edu!craigf
From: craigf@cory.berkeley.edu (Craig Federighi)
Subject: gcc-2.2.2: doesn't inline generic fns/methods
Message-ID: <9209151746.AA06115@cory.Berkeley.EDU>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 15 Sep 1992 03:46:30 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 88