From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: eller.helmut@gmail.com, luangruo@yahoo.com, emacs-devel@gnu.org
Subject: Re: MPS: scroll-bars
Date: Sat, 04 May 2024 11:13:40 +0200 [thread overview]
Message-ID: <m2r0eindmj.fsf@pro2.fritz.box> (raw)
In-Reply-To: <86h6fegdzk.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 May 2024 11:47:43 +0300")
Eli Zaretskii <eliz@gnu.org> writes:
> My conclusions:
>
> . scroll-bar Lisp object is a pseudovector
> . w->vertical_scroll_bar is set to the window's scroll-bar object
> . scroll-bar objects of a frame are stored in a doubly-linked list
> via the ->prev and ->next C pointers of 'struct scroll_bar'
> . frame's f->scroll_bars points to the last scroll-bar object
> created for the frame's windows, and thus effectively to the
> linked list of the frame's scroll bars
> . similarly, a frame has f->condemned_scroll_bars, which is a
> doubly-linked list of condemned scroll bars, the ones that could
> be deleted as result of redisplay (e.g., because their window were
> deleted)
/* List of scroll bars on this frame.
Actually, we don't specify exactly what is stored here at all; the
scroll bar implementation code can use it to store anything it likes.
This field is marked by the garbage collector. It is here
instead of in the `device' structure so that the garbage
collector doesn't need to look inside the window-system-dependent
structure. */
Lisp_Object scroll_bars;
Lisp_Object condemned_scroll_bars;
Oh shit :-(. I need a break.
> Moreover (and this is w32-specific, I think), the Lisp thread sends a
> GUI message to the UI thread with the pointer to 'struct scroll_bar',
> via the call to my_create_hscrollbar:
>
> case WM_EMACS_CREATEVSCROLLBAR:
> return (LRESULT) w32_createvscrollbar ((struct frame *) wParam,
> (struct scroll_bar *) lParam);
>
> static HWND
> my_create_vscrollbar (struct frame * f, struct scroll_bar * bar)
> {
> return (HWND) SendMessage (FRAME_W32_WINDOW (f),
> WM_EMACS_CREATEVSCROLLBAR, (WPARAM) f,
> (LPARAM) bar); <<<<<<<<<<<<<<<<<<<<<<<<
> }
>
> the UI thread then uses the members of 'bar' like this:
>
> static HWND
> w32_createvscrollbar (struct frame *f, struct scroll_bar * bar)
> {
> HWND hwnd = CreateWindow ("SCROLLBAR", "",
> /* Clip siblings so we don't draw over child
> frames. Apparently this is not always
> sufficient so we also try to make bar windows
> bottommost. */
> SBS_VERT | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
> /* Position and size of scroll bar. */
> bar->left, bar->top, bar->width, bar->height,
> FRAME_W32_WINDOW (f), NULL, hinst, NULL);
>
> So, what does this mean in the MPS build? I guess we need to make
> sure scroll bars don't move, for the reference across threads to work?
That would be my guess as well.
> I see that allocate_pseudovector does:
>
> struct Lisp_Vector *
> igc_alloc_pseudovector (size_t nwords_mem, size_t nwords_lisp,
> size_t nwords_zero, enum pvec_type tag)
> {
> struct Lisp_Vector *v
> = alloc (header_size + nwords_mem * word_size, IGC_OBJ_VECTOR, tag);
> XSETPVECTYPESIZE (v, tag, nwords_lisp, nwords_mem - nwords_lisp);
> maybe_finalize (v, tag);
> return v;
> }
>
> But still for the life of me I don't really understand what that means
> for us in this case. What does it mean for the references to its C
> 'struct scroll_bar' when the scroll-bar object is moved? If any of
> these references are on some thread's stack, does it mean the object
> will not move? And what about those prev and next pointers in frame's
> scroll_bars lists -- do we need to do anything with them? Likewise
> with the window's vertical_scroll_bar pointers.
I assume that the GUI thread you mention is not one the Emacs threads,
but something else, so it's not main_thread and not one of the threads
made with make-thread.
Then I think we first of all must make sure that MPS knows about that
thread. The existing threads are added with thread_add
static struct igc_thread_list *
thread_add (struct thread_state *ts)
{
mps_thr_t thr;
mps_res_t res = mps_thread_reg (&thr, global_igc->arena);
IGC_CHECK_RES (res);
struct igc_thread_list *t = register_thread (global_igc, thr, ts);
That's the root for the control stack of the thread:
root_create_thread (t);
These are allocation points in case the thread allocates from MPS:
create_thread_aps (&t->d);
return t;
}
Maybe we should start with this, and move forward when we have it.
next prev parent reply other threads:[~2024-05-04 9:13 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-03 8:53 MPS image cache Gerd Möllmann
2024-05-03 10:58 ` Helmut Eller
2024-05-03 11:05 ` Po Lu
2024-05-03 11:22 ` Gerd Möllmann
2024-05-03 11:43 ` Gerd Möllmann
2024-05-03 13:24 ` Gerd Möllmann
2024-05-03 17:02 ` Gerd Möllmann
2024-05-04 4:38 ` MPS: scroll-bars (was: MPS image cache) Helmut Eller
2024-05-04 5:22 ` MPS: scroll-bars Gerd Möllmann
2024-05-04 5:29 ` Gerd Möllmann
2024-05-04 5:50 ` Po Lu
2024-05-04 6:27 ` Helmut Eller
2024-05-04 6:45 ` Gerd Möllmann
2024-05-04 7:05 ` Helmut Eller
2024-05-04 7:13 ` Gerd Möllmann
2024-05-04 7:48 ` Gerd Möllmann
2024-05-04 7:09 ` Gerd Möllmann
2024-05-04 8:47 ` Eli Zaretskii
2024-05-04 9:13 ` Gerd Möllmann [this message]
2024-05-04 9:29 ` Eli Zaretskii
2024-05-04 10:04 ` Gerd Möllmann
2024-05-04 13:59 ` MPS: w32 threads Eli Zaretskii
2024-05-04 14:20 ` Gerd Möllmann
2024-05-05 8:27 ` Eli Zaretskii
2024-05-05 9:16 ` Gerd Möllmann
2024-05-05 14:39 ` Eli Zaretskii
2024-05-05 15:23 ` Gerd Möllmann
2024-05-05 15:26 ` Gerd Möllmann
2024-05-04 8:29 ` MPS: scroll-bars Po Lu
2024-05-05 4:52 ` Gerd Möllmann
2024-05-05 7:53 ` Helmut Eller
2024-05-05 8:01 ` Gerd Möllmann
2024-05-05 8:08 ` Helmut Eller
2024-05-05 16:43 ` Eli Zaretskii
2024-05-05 18:02 ` Helmut Eller
2024-05-05 18:09 ` Eli Zaretskii
2024-05-06 15:05 ` Eli Zaretskii
2024-05-06 15:53 ` Gerd Möllmann
2024-05-06 18:25 ` Eli Zaretskii
2024-05-07 6:07 ` Helmut Eller
2024-05-07 12:56 ` Eli Zaretskii
2024-05-07 16:27 ` Helmut Eller
2024-05-03 14:59 ` MPS image cache Helmut Eller
2024-05-03 15:11 ` Gerd Möllmann
2024-05-05 6:45 ` Gerd Möllmann
2024-05-05 7:02 ` Gerd Möllmann
2024-05-05 9:00 ` Eli Zaretskii
2024-05-05 9:31 ` Gerd Möllmann
2024-05-05 10:24 ` Eli Zaretskii
2024-05-05 10:36 ` Gerd Möllmann
2024-05-05 11:01 ` Eli Zaretskii
2024-05-05 12:55 ` Gerd Möllmann
2024-05-05 14:07 ` Eli Zaretskii
2024-05-05 14:32 ` Gerd Möllmann
2024-05-05 15:49 ` Eli Zaretskii
2024-05-05 16:19 ` Gerd Möllmann
2024-05-05 17:45 ` Gerd Möllmann
2024-05-05 18:04 ` Eli Zaretskii
2024-05-05 18:13 ` Eli Zaretskii
2024-05-05 18:35 ` Gerd Möllmann
2024-05-05 19:18 ` Eli Zaretskii
2024-05-05 19:57 ` Gerd Möllmann
2024-05-05 8:16 ` Helmut Eller
2024-05-05 8:42 ` Gerd Möllmann
2024-05-06 14:16 ` Helmut Eller
2024-05-06 14:28 ` Gerd Möllmann
2024-05-03 15:02 ` Helmut Eller
2024-05-04 17:51 ` Gerd Möllmann
2024-05-03 11:04 ` Eli Zaretskii
2024-05-03 11:08 ` Gerd Möllmann
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2r0eindmj.fsf@pro2.fritz.box \
--to=gerd.moellmann@gmail.com \
--cc=eliz@gnu.org \
--cc=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=luangruo@yahoo.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.