From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YAMAMOTO Mitsuharu Newsgroups: gmane.emacs.devel Subject: Re: Lisp object allocations during asynchronous input handling Date: Sun, 11 Dec 2005 10:48:09 +0900 Organization: Faculty of Science, Chiba University Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1134265783 25343 80.91.229.2 (11 Dec 2005 01:49:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 11 Dec 2005 01:49:43 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 11 02:49:33 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ElGKQ-0002Kc-Tv for ged-emacs-devel@m.gmane.org; Sun, 11 Dec 2005 02:48:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ElGKq-00039g-7y for ged-emacs-devel@m.gmane.org; Sat, 10 Dec 2005 20:49:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ElGKQ-00034Q-RA for emacs-devel@gnu.org; Sat, 10 Dec 2005 20:48:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ElGKP-000348-A9 for emacs-devel@gnu.org; Sat, 10 Dec 2005 20:48:42 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ElGKP-000344-2u for emacs-devel@gnu.org; Sat, 10 Dec 2005 20:48:41 -0500 Original-Received: from [133.82.132.2] (helo=mathmail.math.s.chiba-u.ac.jp) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ElGLr-0008Cw-3q for emacs-devel@gnu.org; Sat, 10 Dec 2005 20:50:11 -0500 Original-Received: from church.math.s.chiba-u.ac.jp (church [133.82.132.36]) by mathmail.math.s.chiba-u.ac.jp (Postfix) with ESMTP id A5A562CBD for ; Sun, 11 Dec 2005 10:48:09 +0900 (JST) Original-To: emacs-devel@gnu.org In-Reply-To: User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:47418 Archived-At: >>>>> On Mon, 28 Nov 2005 11:34:32 +0900, YAMAMOTO Mitsuharu said: > However, drag-and-drop handling functions on any window systems > (e.g., x_handle_dnd_message in xselect.c) are doing this kind of > allocations in order to cope with multiple dnd items. And I can > find other such places in the Carbon port. Actually, I made some of > them without noticing this issue. I've made some changes to avoid some of such allocations in the Carbon port. What's remaining is the drag-and-drop handling part as in other platforms. Is there any reason to set the cons of a frame and dnd items to the `frame_or_window' member rather than setting them to `frame_or_window' and `arg' separately? Of course, this is not the only cause of Lisp object allocations during asynchronous input handling, so separating them as in the following patch is just a first step. YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp Index: src/keyboard.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v retrieving revision 1.844 diff -c -r1.844 keyboard.c *** src/keyboard.c 10 Dec 2005 01:49:24 -0000 1.844 --- src/keyboard.c 11 Dec 2005 01:14:20 -0000 *************** *** 5805,5818 **** Lisp_Object head, position; Lisp_Object files; ! /* The frame_or_window field should be a cons of the frame in ! which the event occurred and a list of the filenames ! dropped. */ ! if (! CONSP (event->frame_or_window)) ! abort (); ! ! f = XFRAME (XCAR (event->frame_or_window)); ! files = XCDR (event->frame_or_window); /* Ignore mouse events that were made on frames that have been deleted. */ --- 5805,5812 ---- Lisp_Object head, position; Lisp_Object files; ! f = XFRAME (event->frame_or_window); ! files = event->arg; /* Ignore mouse events that were made on frames that have been deleted. */ Index: src/macterm.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/macterm.c,v retrieving revision 1.146 diff -c -r1.146 macterm.c *** src/macterm.c 10 Dec 2005 01:49:53 -0000 1.146 --- src/macterm.c 11 Dec 2005 01:14:20 -0000 *************** *** 9191,9198 **** XSETINT (event.x, mouse.h); XSETINT (event.y, mouse.v); XSETFRAME (frame, f); ! event.frame_or_window = Fcons (frame, file_list); ! event.arg = Qnil; /* Post to the interrupt queue */ kbd_buffer_store_event (&event); /* MAC_TODO: Mimic behavior of windows by switching contexts to Emacs */ --- 9756,9763 ---- XSETINT (event.x, mouse.h); XSETINT (event.y, mouse.v); XSETFRAME (frame, f); ! event.frame_or_window = frame; ! event.arg = file_list; /* Post to the interrupt queue */ kbd_buffer_store_event (&event); /* MAC_TODO: Mimic behavior of windows by switching contexts to Emacs */ Index: src/w32term.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/w32term.c,v retrieving revision 1.236 diff -c -r1.236 w32term.c *** src/w32term.c 14 Oct 2005 08:09:33 -0000 1.236 --- src/w32term.c 11 Dec 2005 01:14:21 -0000 *************** *** 3187,3194 **** DragFinish (hdrop); XSETFRAME (frame, f); ! result->frame_or_window = Fcons (frame, files); ! result->arg = Qnil; return Qnil; } --- 3187,3194 ---- DragFinish (hdrop); XSETFRAME (frame, f); ! result->frame_or_window = frame; ! result->arg = files; return Qnil; } Index: src/xselect.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xselect.c,v retrieving revision 1.155 diff -c -r1.155 xselect.c *** src/xselect.c 7 Aug 2005 12:33:19 -0000 1.155 --- src/xselect.c 11 Dec 2005 01:14:22 -0000 *************** *** 2727,2737 **** mouse_position_for_drop (f, &x, &y); bufp->kind = DRAG_N_DROP_EVENT; ! bufp->frame_or_window = Fcons (frame, vec); bufp->timestamp = CurrentTime; bufp->x = make_number (x); bufp->y = make_number (y); ! bufp->arg = Qnil; bufp->modifiers = 0; return 1; --- 2727,2737 ---- mouse_position_for_drop (f, &x, &y); bufp->kind = DRAG_N_DROP_EVENT; ! bufp->frame_or_window = frame; bufp->timestamp = CurrentTime; bufp->x = make_number (x); bufp->y = make_number (y); ! bufp->arg = vec; bufp->modifiers = 0; return 1;