Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2002 10:35:24 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        ticso@cicely.de
Cc:        Joe Marcus Clarke <marcus@marcuscom.com>, alpha@FreeBSD.ORG
Subject:   Re: getting closer (was Re: mozilla failure on 4.6.2)
Message-ID:  <15742.812.130498.758611@grasshopper.cs.duke.edu>
In-Reply-To: <20020910140414.GC5057@cicely5.cicely.de>
References:  <1031329151.342.9.camel@gyros.marcuscom.com> <20020906194732.GA2244@dragon.nuxi.com> <15737.2550.488154.4401@grasshopper.cs.duke.edu> <20020907000825.GA4091@dragon.nuxi.com> <15739.43883.152090.936327@grasshopper.cs.duke.edu> <15741.2822.526047.253409@grasshopper.cs.duke.edu> <1031605410.351.90.camel@gyros.marcuscom.com> <15741.17468.701009.998323@grasshopper.cs.duke.edu> <1031635953.342.133.camel@gyros.marcuscom.com> <15741.61382.872535.426732@grasshopper.cs.duke.edu> <20020910140414.GC5057@cicely5.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help

Bernd Walter writes:
 > On Tue, Sep 10, 2002 at 09:12:38AM -0400, Andrew Gallatin wrote:
 > > 
 > > Joe Marcus Clarke writes:
 > >  > Add 8 to the stack pointer ("this", right), and store it in $16.
 > > 
 > > I wish it were that simple :-(
 > > 
 > > The problem seems to be that the application code is passing the
 > > "wrong" value in and somehow the c++ calling standard corrects it, and
 > > we must correct it too:
 > > 
 > > impl == 0x12001c080
 > > foo  == 0x12001c080
 > > bar  == 0x12001c088
 > 
 > I have no idea how the class declaration for you example looks like.

http://lxr.mozilla.org/seamonkey/source/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp

 > Possible because I don't know the mozilla code you are talking about.
 > What is the difference in direct and invoke calling?

"direct" is a normal c++ call:  bar->BarMethod1(1);


"invoke" means the mozilla xptinvoke shims:

  var[0].val.i32 = 1;
  var[0].type = nsXPTType::T_I32;
  var[0].flags = 0;
  XPTC_InvokeByIndex(bar, 3, 1, var);


They are described at:
     http://www.mozilla.org/scriptable/xptcall-faq.html

 > Lets asume foo is a virtual function of class x which is based on
 > class y defining the virtual function bar.
 > >From what I know about C++ (which might be outdated) we have the
 > following situation when using an object of class x.
 > Call of function bar means the caller knows the offset to the function
 > pointer, because it's using a pointer of type x.
 > The function bar expects a this pointer of type y so it gets the
 > this pointer of the embedded y object which may be numericaly different.
 > 
 > Now asume class x reimplement the virtual function bar.
 > The newly bar function has to share the calling conventions that were
 > declared by class y.
 > If we call function bar using a type y pointer we submit a this pointer
 > of type y.
 > But the function is designed to have a this pointer of type x.
 > Now the function must recalculate the supplied y pointer into an x
 > pointer.
 > If we call funtcion bar using a type x pointer we still have to convert
 > the x pointer into an y pointer because the function still expects an y
 > pointer.

I assume this is all done "behind the scenes" by the compiler?
Is there a convention for where the conversions are passed?

Since you know quite a bit about c++, and because you know alpha asm,
I'd _really_ like your help ;)    Do you have an alpha running
-stable?  Or are you all -current these days?

Thanks,

Drew

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15742.812.130498.758611>