Hi Timothy,

On 10 March 2018 at 16:02, Timothy Baldridge <tbaldri...@gmail.com> wrote:
> One thing I forgot to mention that I'm also trying to keep this as
> low-overhead as possible. So I'd like a struct of type MyStruct
> {member1=int} to be two words wide. One for the pointer to the
> StructDefinition, and the other for the (unwrapped) int.

Ok, that makes sense.  But you have to consider also where such a raw
MyStruct would live; that is, who has got the raw pointer to the
MyStruct data?  I would imagine that you want this pointer to be
inside another GC object of a specific class.  It's this GC object
there that needs to have a custom GC hook.  If you really want no such
thing, then you still need to make an artificial GC object in order to
have a place where you can stick the custom GC hook.  Also, remember
that the GC assumes 'x.custom_gc_hook()' always returns the same list
by default; you need to manually call 'rgc.write_barrier(x)' whenever
the custom GC hook on object 'x' would give a different answer.


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to