emacs-devel
[Top][All Lists]
Advanced

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

Re: MPS: native comp


From: Gerd Möllmann
Subject: Re: MPS: native comp
Date: Fri, 03 May 2024 16:19:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Andrea Corallo <acorallo@gnu.org> writes:

> You said:
>
>> The problem is not liveness, it's the existence of untraced references
>> there.
>
> So my question is, there's really no way to express to MPS the
> 'existence' of an object without impacting his 'liveness'?
>
> This case is supported by alloc.c as the change in discussion
> demonstrates.

Hm, let me try. I don't know what exactly you are asking, but maybe
explaining it in different way helps. So, ...

We have two things at hand

 1. liveness
 2. references

Liveness with MPS and old GC is handled the same way. We have something
on the stack, as an example, and that fact keeps it alive. No problem.

References are different in MPS and old GC.

In the old GC, _all_ references to live objects are _always_ correct
because objects never move in memory.

With MPS this is not the case. Unless we do something, only references
that are _traced_ (updated) are guranteed to be correct, if an object
ever moves. Or, alternatively we prevent an object from moving.

I think the following C is similar to what we have in our case:

Lisp_Object global;

void foo ()
{
  Lisp_Object v = Fread (....);
  global = AREF (v, 0);

  do_something ();
  // MPS kicks in when we rea here
  do_something_else (global);
}

We read new a vector v from some string. This keeos the vector and its
contents alive because it is on the stack.

But, please note that only v is on the stack. The contents are _not_ on
the stack. Means, in the MPS case, that only v cannot move in memory.
Its contents _can_ move.

In the C code above, when we reach do_something_else, this means that
the reference in global may be invalid because v->contents[0] has
meanwhile moved.

Is that of help?



reply via email to

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