emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make check fails? (emacs-26.1 w/modules)


From: Greg Minshall
Subject: Re: make check fails? (emacs-26.1 w/modules)
Date: Wed, 05 Sep 2018 23:26:48 +0300

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
----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]