all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Andrea Corallo <akrl@sdf.org>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Correct byte compiler error/warning positions.  The solution!
Date: Fri, 17 Dec 2021 11:54:25 +0000	[thread overview]
Message-ID: <Ybx6cd7vQEP7Nho9@ACM> (raw)
In-Reply-To: <xjfilvqrz46.fsf@ma.sdf.org>

Hello, Andrea.

On Wed, Dec 15, 2021 at 09:33:45 +0000, Andrea Corallo wrote:
> Alan Mackenzie <acm@muc.de> writes:

[ .... ]

> > I have a problem at the moment, which could be a big problem.  How do I
> > refer to a Lisp variable from jit generated code?

> > In particular, I need read-access to symbols-with-pos-enabled, or more
> > precisely to globals.f_symbols_with_pos_enabled.

[ .... ]

> > I tried declaring "globals" as a global variable to be imported into jit
> > space, but the loader doesn't know about "globals".

> > So, how can I get access to globals.f_symbols_with_pos_enabled?

> > Thanks in advance!


> Hi Alan,

> I think the way should be done is that one declare in the .eln a global
> variable as a (bool *), say 'f_symbols_with_pos_enabled_ref'.  Then
> during eln load time we set into that the correct address of
> 'globals.f_symbols_with_pos_enabled' so it can be used as
> '*f_symbols_with_pos_enabled_ref' by the generated code.

Thanks, I have done this, and have thus progressed further.  It is a
shame we need the extra indirection, but it shouldn't cost too much in
run time.

By the way, congratulations on using three stars in the declaration
struct thread_state ***current_thread_reloc;.  That's not something one
sees very often.  :-)

> We do something very similar for the Emacs global var 'current_thread'.
> In the eln we have a global variable named "current_thread_reloc" where
> we store the address of 'current_thread'.  You can see we set this value
> during eln load in 'load_comp_unit'.

> Just grep CURRENT_THREAD_RELOC_SYM and you should find the relevant
> pieces of code you are interested in.

Done.

I now have another problem, and that's when bootstrap-emacs is trying to
load comp.{el,elc,eln} (I'm not sure which), and is in the (defconst
comp-known-func-cstr-h ...).  The (Lisp) backtrace I see looks like this:

Debugger entered--Lisp error: (error "Attempt to modify read-only object" --cl-block-comp-cstr-union-1-no-mem--)
  comp-cstr-union-1-no-mem(t #s(comp-cstr :typeset (number) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (marker) :valset nil :range nil :neg nil))
  comp-cstr-union-1(t #s(comp-cstr :typeset (t) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (number) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (marker) :valset nil :range nil :neg nil))
  comp-cstr-union(#s(comp-cstr :typeset (t) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (number) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (marker) :valset nil :range nil :neg nil))
  comp-cstr-union-make(#s(comp-cstr :typeset (number) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (marker) :valset nil :range nil :neg nil))
  comp-type-spec-to-cstr((or number marker) t)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_51>((or number marker))
  comp-type-spec-to-cstr((function ((or number marker) (or number marker)) number))
  byte-code("\302 \30\303\304\305\"\11\306\211\211\211\211\5:\2038\0\5@\262\3\2\211A\262\4\242\262\5\2@\262\4\307\4!\262\2\310\5\3\6\11#\210\5A\262\6..." [comp-ctxt comp-known-type-specifiers make-comp-cstr-ctxt make-hash-table :test eq ni\l comp-type-spec-to-cstr puthash] 11)
  (defconst comp-known-func-cstr-h (byte-code "\302 \30\303\304\305\"\11\306\211\211\211\211\5:\2038\0\5@\262\3\2\211A\262\4\242\262\5\2@\262\4\307\4!\262\2\310\5\3\6\11#\210\5A\262\6..." [comp-ctxt comp-known-type-specifiers make-comp-cst\r-ctxt make-hash-table :test eq nil comp-type-spec-to-cstr puthash] 11) "Hash table function -> `comp-constraint'.")
  load("comp" nil t)

The error seems to mean there was an attempt to write into pure memory,
and that the thing being written was the cl-block tag generated by the
(cl-defun comp-cstr-union-1-no-mem ...).

I thought I'd traced it to the `setcdr' form in cl--block-throw (in
cl-macs.el), but when I tried commenting out the CHECK_IMPURE test from
Fsetcdr (in data.c), I still got the same error and backtrace.

Would you help me with this error, please.  Thanks!

> Best Regards

>   Andrea

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2021-12-17 11:54 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
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 [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ybx6cd7vQEP7Nho9@ACM \
    --to=acm@muc.de \
    --cc=akrl@sdf.org \
    --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.