unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Subject: Re: Lisp object allocations during asynchronous input handling
Date: Sun, 11 Dec 2005 10:48:09 +0900	[thread overview]
Message-ID: <wlslt0flpi.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <wlu0dx1ow7.wl%mituharu@math.s.chiba-u.ac.jp>

>>>>> On Mon, 28 Nov 2005 11:34:32 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 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;

  reply	other threads:[~2005-12-11  1:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-28  2:34 Lisp object allocations during asynchronous input handling YAMAMOTO Mitsuharu
2005-12-11  1:48 ` YAMAMOTO Mitsuharu [this message]
2005-12-11 16:49   ` Richard M. Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wlslt0flpi.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).