all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Greg Minshall <minshall@acm.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: make check fails? (emacs-26.1 w/modules)
Date: Wed, 05 Sep 2018 23:26:48 +0300	[thread overview]
Message-ID: <19423.1536179208@minshall-apollo.minshall.org> (raw)
In-Reply-To: Your message of "Wed, 05 Sep 2018 00:54:46 -0700." <367ca660-33f5-f4d6-c03c-146056b4ece2@cs.ucla.edu>

Paul,

i'm more or less stuck.  using a copy of "gcc -E" (garnered from 'make
V=1'), and deleting here and there, for module_intern() (just one of
many routines that are truncated, on my system, by "gcc -O2"), my
current minimal'ish example is this (surrounded by the rest of the "gcc
-E" output):
----
static emacs_value
module_intern (emacs_env *env, const char *name)
{
  if (module_non_local_exit_check (env))
    return module_nil;
  if (module_non_local_exit_check (env))
    return module_nil;

  struct handler *internal_cleanup_CATCHER_ALL;
  if (_setjmp (internal_cleanup_CATCHER_ALL->jmp)) {
      return module_nil;
  }

  return lisp_to_value (env, intern (name));
}
----

note that lines 3 and 4 duplicate 1 and 2; if 3 and 4 are deleted, the
compiler emits "good" code.  the "if" conditions there can be
complemented ("!") without changing the compiler behavior.

and, some form of _setjmp() must be there, though what the range is i'm
not sure.

similarly, if "anything" is changed in module_non_local_exit_check(),
which is currently:
----
static enum emacs_funcall_exit
module_non_local_exit_check (emacs_env *env)
{
  module_assert_thread ();
  module_assert_env (env);
  return env->private_members->pending_non_local_exit;
}
----
the compiler doesn't truncate module_intern().

with -O2, i get (only up to the "ret" is relevant, except for checking i
didn't miss anything):
----
        .type   module_intern, @function
module_intern:
.LFB791:
        .cfi_startproc
        subq    $8, %rsp
        .cfi_def_cfa_offset 16
        call    module_non_local_exit_check
        xorl    %eax, %eax
        addq    $8, %rsp
        .cfi_def_cfa_offset 8
        ret
        .cfi_endproc
.LFE791:
        .size   module_intern, .-module_intern
        .section        .text.unlikely
.LCOLDE18:
        .text
.LHOTE18:
        .section        .text.unlikely
.LCOLDB19:
        .text
.LHOTB19:
        .p2align 4,,15
        .type   module_make_float, @function
----

below is the full, unoptimized code.

i installed clang 6.0, and it, even at -O3, seemed to output correct
code for module_intern(), at least.

i'm open to all thoughts.  (including, "give up!" :)

cheers, Greg

----
with *out* -O2 (or, any other optimization level), the compiler
generates this:
----
        .type   module_intern, @function
module_intern:
.LFB791:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        subq    $32, %rsp
        movq    %rdi, -24(%rbp)
        movq    %rsi, -32(%rbp)
        movq    -24(%rbp), %rax
        movq    %rax, %rdi
        call    module_non_local_exit_check
        testl   %eax, %eax
        je      .L119
        movl    $0, %eax
        jmp     .L120
.L119:
        movq    -24(%rbp), %rax
        movq    %rax, %rdi
        call    module_non_local_exit_check
        testl   %eax, %eax
        je      .L121
        movl    $0, %eax
        jmp     .L120
.L121:
        movq    -8(%rbp), %rax
        addq    $56, %rax
        movq    %rax, %rdi
        call    _setjmp
        testl   %eax, %eax
        je      .L124
        movl    $0, %eax
        jmp     .L120
.L124:
        movq    -32(%rbp), %rax
        movq    %rax, %rdi
        call    intern
        movq    %rax, %rdx
        movq    -24(%rbp), %rax
        movq    %rdx, %rsi
        movq    %rax, %rdi
        call    lisp_to_value
.L120:
        leave
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE791:
        .size   module_intern, .-module_intern
        .type   module_non_local_exit_check, @function
----



  parent reply	other threads:[~2018-09-05 20:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03 14:39 make check fails? (emacs-26.1 w/modules) Greg Minshall
2018-09-03 15:12 ` Greg Minshall
2018-09-03 15:13 ` Eli Zaretskii
2018-09-03 15:16   ` Greg Minshall
2018-09-03 15:18   ` Greg Minshall
2018-09-04 10:39   ` Greg Minshall
2018-09-05  7:54     ` Paul Eggert
2018-09-05  9:14       ` Greg Minshall
2018-09-05 20:26       ` Greg Minshall [this message]
2018-09-05 20:55         ` Paul Eggert
2018-09-06  8:58           ` Robert Pluim
2018-09-06 10:32           ` Greg Minshall
2018-09-12 13:41             ` Robert Pluim
2018-09-12 14:56               ` Paul Eggert
2018-09-12 16:19               ` Greg Minshall
2018-09-12 16:37                 ` Robert Pluim
2018-09-12 16:27               ` Greg Minshall
2018-09-12 16:39                 ` Robert Pluim
2018-09-07  9:10           ` Greg Minshall
2018-09-03 18:27 ` Paul Eggert
2018-09-03 23:46   ` Greg Minshall

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=19423.1536179208@minshall-apollo.minshall.org \
    --to=minshall@acm.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.