all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Tom Tromey <tom@tromey.com>
Cc: emacs-devel@gnu.org
Subject: 32-bit MinGW build with JIT
Date: Thu, 16 Aug 2018 17:09:15 +0300	[thread overview]
Message-ID: <838t56iet0.fsf@gnu.org> (raw)

I tried to build the JIT branch with 32-bit MinGW tools.  Since Tom
said wide ints are not yet supported, I didn't configure with that
option.

The build failed half way through bootstrap.  Specifically,
bootstrap-emacs crashes the first time it attempts to JIT-compile a
byte-compiled function, and then invoke the resulting JIT.

The crash is in this snippet from eval.c:

#ifdef HAVE_LIBJIT
         if (initialized)
           {
             struct Lisp_Vector *vec = XVECTOR (fun);

             if (vec->contents[COMPILED_JIT_CODE] == NULL)
               emacs_jit_compile (fun);

             if (vec->contents[COMPILED_JIT_CODE] != NULL)
               return funcall_subr (fun,
                                    (struct subr_function *) vec->contents[COMPILED_JIT_CODE],
                                    nargs, arg_vector);
           }
#endif /* HAVE_LIBJIT */

funcall_subr calls the JIT function, which attempts to call Ffuncall,
and the latter segfaults because its arguments are not valid Lisp
objects.

I'm not yet sure what causes this, but since I presume that the branch
was successfully built on a 64-bit host, I suspect some snafu with
pointers that are narrower than 64-bit integers.  I couldn't yet spot
any code that would be suspect, although some portions of the code
work differently on 64-bit and 32-bit hosts, for example:

  if (sizeof (ptrdiff_t) == 8)
    ptrdiff_t_type = jit_type_ulong;
  else
    {
      eassert (sizeof (ptrdiff_t) == 4);
      ptrdiff_t_type = jit_type_uint;
    }

(This is btw wrong, I think, in a 32-bit build --with-wide-int.)

Also, I'm not sure why we are making a "long constant" (i.e., a 64-bit
data type) here:

         mandatory_val
           = jit_value_create_long_constant (func, ptrdiff_t_type, mandatory);

Why shouldn't this be of the same type as ptrdiff_t_type?

Anyway, what I wanted to tell is that as of now, it is very hard to
debug these problems.  All the libjit types are "incomplete" as far as
GDB is concerned, there are no facilities to display libjit types and
values in human-readable form, C-level backtraces show ?? when a JIT
compiled function is called, etc.  I didn't yet succeed in
establishing whether the invalid Lisp arguments for Ffuncall are
already invalid when we compile the function, or get corrupted as part
of compilation.

I think we need to upgrade our debugging facilities, including adding
commands to .gdbinit, as part of working on this branch.

Tom, if you didn't try to build on a 32-bit host, could you please try
that, so I could decide if what I report is specific to a 32-bit build
or to MS-Windows?

Thanks.



             reply	other threads:[~2018-08-16 14:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16 14:09 Eli Zaretskii [this message]
2018-08-16 17:35 ` 32-bit MinGW build with JIT Eli Zaretskii
2018-08-18  9:14   ` Eli Zaretskii
2018-08-19 15:24 ` Tom Tromey
2018-08-19 15:37   ` Eli Zaretskii
2018-08-19 15:50     ` Tom Tromey
2018-08-19 16:15       ` Eli Zaretskii
2018-08-27 19:52         ` Ken Brown
2018-08-28  5:25           ` Eli Zaretskii
2018-08-28 13:12             ` Ken Brown
2018-08-28 16:58               ` Eli Zaretskii
2018-08-19 17:11     ` Paul Eggert

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=838t56iet0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=tom@tromey.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.