This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: AIX I/O failures


>>>>> "Gabriel" == Gabriel Dos Reis <gdr@codesourcery.com> writes:

    Gabriel> Given that cout construction happens at compile/link time
    Gabriel> and that it has to be treated identical to the refered

Sorry, I wasn't clear.  I'm not talking about *constructing* the
object, I'm talking about *using* it.  My claim is that every call to
an I/O function will require an extra load.

Let's just do a C example.

  void f(int*);
  int i;

  void g() { f(&i); }

On a SPARC, that becomes:

        sethi   %hi(i), %o1
        or      %o1, %lo(i), %o0
        call    f, 0

Now, change it to:

  void f(int*);
  int* i;

  void g() { f(i); }

Then, you get:

        sethi   %hi(i), %o0
        or      %o0, %lo(i), %o1
        ld      [%o1], %o0
        call    f, 0
 
Note the extra load.  That make sense -- you have to pay for the
indirection.  

The second case is what you're proposing; think of `f' as a member
function of `ostream' and `int* i' as `ostream& cout'.

There are no free references! :-)

-
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]