From owner-freebsd-alpha Tue Sep 10 6:13:20 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 09F0E37B400; Tue, 10 Sep 2002 06:13:14 -0700 (PDT) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id D690A43E4A; Tue, 10 Sep 2002 06:13:09 -0700 (PDT) (envelope-from gallatin@cs.duke.edu) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id JAA25018; Tue, 10 Sep 2002 09:13:09 -0400 (EDT) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.6/8.9.1) id g8ADCdK68776; Tue, 10 Sep 2002 09:12:39 -0400 (EDT) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15741.61382.872535.426732@grasshopper.cs.duke.edu> Date: Tue, 10 Sep 2002 09:12:38 -0400 (EDT) To: Joe Marcus Clarke Cc: obrien@FreeBSD.ORG, alpha@FreeBSD.ORG Subject: Re: getting closer (was Re: mozilla failure on 4.6.2) In-Reply-To: <1031635953.342.133.camel@gyros.marcuscom.com> References: <20020906040641.GA61111@xor.obsecurity.org> <1031287598.361.2.camel@gyros.marcuscom.com> <15736.40749.986834.818558@grasshopper.cs.duke.edu> <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> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 Notice how "bar" = (char *)impl + 8 ? Somehow, when doing a "direct" call, the "this" pointer ends up as the impl pointer, not as the "bar" pointer, even if "bar" is used in the call. However, in the "invoke" code, we get literally what we asked for -- the "this" pointer == the "bar" pointer. We need to somehow be able to tell that its a case like this and make the this pointer be the impl pointer. Appended is sample output, with some of the methods modified to print out the this pointer. Drew calling direct: 1 + 1 = 2 1L + 1L = 2 2 * 2 = 4 2L * 2L = 4 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55 1 + 2 = 3.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 +1 15 + 16 + 17 + 18 + 19 + 20 = 210.000000f moo cow = milk calling via invoke: 1 + 1 = 2 1L + 1L = 2 2 * 2 = 4 2L * 2L = 4 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55 1 + 2 = 3.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55.000000f 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 = 210.000000f moo cow = milk impl == 0x1200160c0 foo == 0x1200160c0 bar == 0x1200160d8 Calling Foo... direct calls: this = 0x1200160c0 FooImpl::FooMethod1 called with i == 1, FooImpl part of a FooBarImpl this = 0x1200160c0 FooImpl::FooMethod2 called with i == 2, FooImpl part of a FooBarImpl invoke calls: this = 0x1200160c0 FooImpl::FooMethod1 called with i == 1, FooImpl part of a FooBarImpl this = 0x1200160c0 FooImpl::FooMethod2 called with i == 2, FooImpl part of a FooBarImpl Calling Bar... direct calls: this = 0x1200160d8 BarImpl::BarMethod1 called with i == 1, BarImpl part of a FooBarImpl this = 0x1200160d8 BarImpl::BarMethod2 called with i == 2, BarImpl part of a FooBarImpl invoke calls: this = 0x1200160d8 BarImpl::BarMethod1 called with i == 1, BarImpl part of a FooBarImpl this = 0x1200160d8 BarImpl::BarMethod2 called with i == 2, BarImpl part of a FooBarImpl impl == 0x12001c080 foo == 0x12001c080 bar == 0x12001c088 Calling Foo... direct calls: this = 0x12001c080 FooBarImpl2::FooMethod1 called with i == 1, local value = 12345678 this = 0x12001c080 FooBarImpl2::FooMethod2 called with i == 2, local value = 12345678 invoke calls: this = 0x12001c080 FooBarImpl2::FooMethod1 called with i == 1, local value = 12345678 this = 0x12001c080 FooBarImpl2::FooMethod2 called with i == 2, local value = 12345678 Calling Bar... direct calls: this = 0x12001c080 FooBarImpl2::BarMethod1 called with i == 1, local value = 12345678 this = 0x12001c080 FooBarImpl2::BarMethod2 called with i == 2, local value = 12345678 invoke calls: this = 0x12001c088 FooBarImpl2::BarMethod1 called with i == 1, local value = 0 this = 0x12001c088 FooBarImpl2::BarMethod2 called with i == 2, local value = 0 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message