From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: compiling with -DSCM_DEBUG=1 Date: Sat, 31 Oct 2009 15:42:50 +0000 Message-ID: <87bpjn36yt.fsf@ossau.uklinux.net> References: <87ljky5ug4.fsf@gnu.org> <86DCB6A5-5CBD-4779-8FEE-7DFD345C9775@raeburn.org> <8763ac726h.fsf@ossau.uklinux.net> <2E027DD8-E640-4A63-93B6-9E595FF57424@raeburn.org> <87hbtg7ese.fsf@ossau.uklinux.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1257003825 11447 80.91.229.12 (31 Oct 2009 15:43:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Oct 2009 15:43:45 +0000 (UTC) Cc: guile-devel To: Ken Raeburn Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Oct 31 16:43:38 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N4G6Z-0004kK-0m for guile-devel@m.gmane.org; Sat, 31 Oct 2009 16:43:03 +0100 Original-Received: from localhost ([127.0.0.1]:33886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4G6Y-0002sL-Ff for guile-devel@m.gmane.org; Sat, 31 Oct 2009 11:43:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N4G6U-0002s8-UR for guile-devel@gnu.org; Sat, 31 Oct 2009 11:42:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N4G6P-0002re-Dh for guile-devel@gnu.org; Sat, 31 Oct 2009 11:42:57 -0400 Original-Received: from [199.232.76.173] (port=40342 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4G6P-0002rb-83 for guile-devel@gnu.org; Sat, 31 Oct 2009 11:42:53 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:34338) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N4G6O-0001dI-QJ for guile-devel@gnu.org; Sat, 31 Oct 2009 11:42:53 -0400 Original-Received: from arudy (host86-147-112-196.range86-147.btcentralplus.com [86.147.112.196]) by mail3.uklinux.net (Postfix) with ESMTP id E2B9E1F6917; Sat, 31 Oct 2009 15:42:51 +0000 (GMT) Original-Received: from arudy (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id CF5D738023; Sat, 31 Oct 2009 15:42:50 +0000 (GMT) In-Reply-To: <87hbtg7ese.fsf@ossau.uklinux.net> (Neil Jerram's message of "Fri, 30 Oct 2009 21:28:01 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:9620 Archived-At: Neil Jerram writes: > Ken Raeburn writes: > >> At Andy's suggestion, re-posting the still-pending part that needs >> review. Without these changes, the code in the loops applies SCM_CAR >> to non-pair objects. >> >> GUILE_AUTO_COMPILE=0 \ >> ../meta/uninstalled-env \ >> guile-tools compile -Wunbound-variable -o "ice-9/debugger.go" >> "../../ >> guile/module/ice-9/debugger.scm" >> Non-pair accessed with SCM_C[AD]R: `#> . #{initargs\ 2866}#)>' >> >> This patch is my best guess, but I'm not very familiar with the code... > > I don't know... Even though this code is destined for the dustbin soon > anyway, I'd prefer if we understood it! I'll have another go at working > it out over the weekend. OK, I think I mostly understand this now. The method cache is a vector, and this code expects each entry in the vector to look like (TYPE1 ... ENV FORMALS FORM1 ...) where TYPE1 ... are the types (classes) that the method is specialised for, ENV is the environment where the method was defined, FORMALS are the formals and FORM1 ... is the method's code. So the comment "More arguments than specifiers => CLASS != ENV" means "We don't have to check for reaching the end of the list of TYPEs, because then we'll be comparing the class of the next actual arg against ENV, and there is no possibility of those matching, so we'll exit the loop." Which makes sense, if the cache entry really does have the above form. But apparently it doesn't. I added this just inside the loops: if (!scm_is_pair (z)) { scm_write (z, scm_current_output_port ()); scm_newline (scm_current_output_port ()); scm_write (SCM_SIMPLE_VECTOR_REF (method_cache, hash_value), scm_current_output_port ()); scm_newline (scm_current_output_port ()); abort (); } and then the build fails when it gets to compiling (ice-9 debugger): GUILE_AUTO_COMPILE=0 \ ../meta/uninstalled-env \ guile-tools compile -Wunbound-variable -o "ice-9/debugger.go" "ice-9/debugger.scm" # (#< 8c77990> #< 8c7a640> . #) So there's at least this case where the cache entry has a different form. Actually I think this is a general change that Andy made a while back - i.e. to form the old (ENV FORMALS FORM1 ...) part into a procedure and store that in the cache instead. Andy, can you confirm this? Subject to that, I think that Ken's proposed patch is correct, but it would also be good to remove or clarify the "CLASS != ENV" comments, and to update the comments that describe the cache entry layout (in objects.c and oop/goops/dispatch.scm). Thanks, Neil