unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Adding extra fields to float_block and cons_block?
       [not found] <875yuszs7h.fsf.ref@yahoo.com>
@ 2021-09-22 12:54 ` Po Lu
  2021-09-22 18:19   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu @ 2021-09-22 12:54 UTC (permalink / raw)
  To: emacs-devel

I tried adding an extra array of bits_words to cons_block and
float_block, in alloc.c, defined as follows:

  bits_word gc_pushed_to_stack_ps[1 + FLOAT_BLOCK_SIZE / BITS_PER_BITS_WORD];

But now Emacs crashes with:

  alloc.c:1252: Emacs fatal error: assertion failed: nbytes <= BLOCK_BYTES
  Fatal error 6: Aborted

I can't seem to figure out the hairy mess surrounding that code, and I'd
appreciate it if someone could explain the proper procedure for adding
extra fields to those two structs.  Thanks.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Adding extra fields to float_block and cons_block?
  2021-09-22 12:54 ` Adding extra fields to float_block and cons_block? Po Lu
@ 2021-09-22 18:19   ` Stefan Monnier
  2021-09-23  0:07     ` Po Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2021-09-22 18:19 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

Po Lu [2021-09-22 20:54:10] wrote:
> I tried adding an extra array of bits_words to cons_block and
> float_block, in alloc.c, defined as follows:
[...]
> I can't seem to figure out the hairy mess surrounding that code, and I'd
> appreciate it if someone could explain the proper procedure for adding
> extra fields to those two structs.  Thanks.

These blocks are used to store the 129bits we need per cons cells
(2x64bit for the car and cdr plus 1bit for the markbit).  So the block
themselves need to be aligned on a multiple of 1KB (IIRC), the cons
cells are aligned on a multiple of 8B (so they each store 128bit only)
and the extra bit can be found by taking the cons's address, truncating
the last few bits to find the address of the block and then looking up
the bit in the corresponding bitvector.

How to modify it will likely depend on what info you need/want to add
in there.  So what is this extra array of bits_words you want to add?
Do you want to grow cons cells to 130bits, basically?


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Adding extra fields to float_block and cons_block?
  2021-09-22 18:19   ` Stefan Monnier
@ 2021-09-23  0:07     ` Po Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Po Lu @ 2021-09-23  0:07 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> How to modify it will likely depend on what info you need/want to add
> in there.  So what is this extra array of bits_words you want to add?
> Do you want to grow cons cells to 130bits, basically?

Extra markbits, to determine whether or not an object has not yet been
marked, but has been pushed to the gray list, for use in a simple
tri-color incremental mark-and-sweep GC.

Thanks.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-23  0:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <875yuszs7h.fsf.ref@yahoo.com>
2021-09-22 12:54 ` Adding extra fields to float_block and cons_block? Po Lu
2021-09-22 18:19   ` Stefan Monnier
2021-09-23  0:07     ` Po Lu

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