unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo <akrl@sdf.org>
To: Alan Mackenzie <acm@muc.de>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Correct byte compiler error/warning positions.  The solution!
Date: Sat, 04 Dec 2021 19:22:02 +0000	[thread overview]
Message-ID: <xjfpmqcw4yt.fsf@ma.sdf.org> (raw)
In-Reply-To: <YaqGhn+S7GsbK4bR@ACM> (Alan Mackenzie's message of "Fri, 3 Dec 2021 21:05:10 +0000")

Alan Mackenzie <acm@muc.de> writes:

> Hello, Andrea.
>
> On Thu, Dec 02, 2021 at 20:35:50 +0000, Alan Mackenzie wrote:
>> On Thu, Dec 02, 2021 at 16:31:55 +0000, Andrea Corallo wrote:
>> > Alan Mackenzie <acm@muc.de> writes:
>
>> > Hi Alan,
>
> [ .... ]
>
>> > The modifications needed are all and only going into comp.c.
>
>> OK.
>
>> > The function you have to extend is 'emit_EQ'.  You'll see we have an
>> > emit_* function for each corresponding macro/inline function used, ex:
>> > 'emit_XLI', 'emit_XCONS' etc...
>
>> OK.
>
>> > You'll have to define all the new one needed in order to use them use
>> > them in the new 'emit_EQ'.
>
>> Thanks.  I'm currently going through the tutorial at
>> https://gcc.gnu.org/onlinedocs/jit/intro/tutorial....html, so it may be a
>> day or two before I start asking you questions.  ;-)

Hi Alan,

> For extending emit_EQ, I've got the following embryonic scheme:
>
> 1/- Import the C variable symbols_with_pos_enabled:
>
>  gcc_jit_lvalue *syms_with_pos_enabled =
>                gcc_jit_context_new_global
>                  (comp.ctxt, NULL,
>                   GCC_JIT_GLOBAL_IMPORTED,
>                   gcc_jit_get_type (comp.ctxt, GCC_JIT_TYPE_BOOL),
>                   "symbols_with_pos_enabled");

Yep something like.  PS We already have 'comp.bool_type' to use.

> 2/- Extend emit_EQ with lots of nested gcc_jit_context_new_comparison's
> containing GCC_JIT_BINARY_OP_LOGICAL_OR/ANDs, something like this:
>
>   emit_EQ (gcc_jit_rvalue *x, gcc_jit_rvalue *y)
>   {
>     emit_comment ("EQ");
>
>     return gcc_jit_context_new_comparison (
>              comp.ctxt,
>              NULL,
>              GIT_JIT_BINARY_OP_LOGICAL_OR (
>                gcc_jit_context_new_comparison
>                  (comp.ctxt,
>                   NULL,
>                   GCC_JIT_COMPARISON_EQ,
>                   emit_XLI (x),
>                   emit_XLI (y)),
>                syms_with_pos_enabled
>                  ....
>                  ....
>                ) ;
>   }
>
> 2a/- I think I would need C macros called something like ELN_AND and
> ELN_OR to make this half-way readable.
>
> 3/- Have several fragments of gcc_jit code which could be plugged into
> the above, things representing BARE_SYMBOL_P (x), SYMBOL_WITH_POS_P (x),
> and so on.
>
> Can you let me know what you think of this approach, please?  That is,
> before I put a lot of work into it.  Is it broadly a good way of doing
> the job?

I think it could be a good idea but I believe there's no need to use
macros here, we could have just functions return rvalues no?

I'm not a big fan of C macros and I try not to use them whem possible.

>> I can see already I'll need an emit_BASE_EQ (a renaming of the current
>> emit_EQ), and one or two others.
>
>> Hopefully, we'll get this up and running in a few days, or a week or two
>> at most.
>
> I can't help noticing the lack of anything like SYMBOLP in comp.c.  Is
> this just because nothing needs it?

Correct.

> Or is there some other method in
> operation, like using the inline function in lisp.h somehow, for
> example?

Nope.

Tip, while developing I suggest you to dump the pseudo C code generated
using `native-comp-debug' > 1 to verify it looks the way it is expected.

Best Regards

  Andrea



  reply	other threads:[~2021-12-04 19:22 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26 19:56 Correct byte compiler error/warning positions. The solution! Alan Mackenzie
2021-11-27  5:53 ` Eli Zaretskii
2021-11-27  9:31   ` Alan Mackenzie
2021-11-27 10:07     ` Eli Zaretskii
2021-11-27 10:33       ` Alan Mackenzie
2021-11-27 10:51         ` Eli Zaretskii
2021-11-27 23:05           ` Alan Mackenzie
2021-11-28  7:25             ` Eli Zaretskii
2021-11-29 11:50               ` Alan Mackenzie
2021-11-29 12:45                 ` Eli Zaretskii
2021-11-29 19:39                   ` Alan Mackenzie
2021-12-01 15:58                     ` Alan Mackenzie
2021-12-01 16:49                       ` Eli Zaretskii
2021-12-01 16:58                         ` Alan Mackenzie
2021-12-01 17:04                           ` Lars Ingebrigtsen
2021-12-01 17:21                             ` Alan Mackenzie
2021-12-01 17:38                               ` Lars Ingebrigtsen
2021-12-01 20:28                                 ` Alan Mackenzie
2021-12-01 17:08                           ` Eli Zaretskii
2021-12-01 17:12                             ` Alan Mackenzie
2021-12-01 17:53                             ` Andrea Corallo
2021-12-01 17:57                               ` Eli Zaretskii
2021-12-02 11:21                               ` Alan Mackenzie
2021-12-02 16:31                                 ` Andrea Corallo
2021-12-02 20:35                                   ` Alan Mackenzie
2021-12-03 21:05                                     ` Alan Mackenzie
2021-12-04 19:22                                       ` Andrea Corallo [this message]
2021-12-04 19:39                                         ` Eli Zaretskii
2021-12-04 19:55                                           ` Andrea Corallo
2021-12-04 19:58                                             ` Eli Zaretskii
2021-12-04 20:06                                               ` Andrea Corallo
2021-12-14 14:29                                         ` Alan Mackenzie
2021-12-15  9:33                                           ` Andrea Corallo
2021-12-17 11:54                                             ` Alan Mackenzie
2021-12-20  8:24                                               ` Andrea Corallo
2021-12-21 17:48                                                 ` Alan Mackenzie
2021-11-29 13:24                 ` Robert Pluim
2021-11-29 19:16                   ` Alan Mackenzie
2021-11-30  9:52                     ` Robert Pluim
2021-11-28 20:15             ` Andrea Corallo
2021-12-01 16:18               ` Andrea Corallo
2021-12-01 16:46                 ` Alan Mackenzie

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=xjfpmqcw4yt.fsf@ma.sdf.org \
    --to=akrl@sdf.org \
    --cc=acm@muc.de \
    --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 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).