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.
On Sat, Mar 10, 2018 at 6:37 AM, Timothy Baldridge <tbaldri...@gmail.com> wrote: > Sorry about that, let me explain it at a higher level. I'm looking to make > a runtime-defined GC'd struct. Some members will be GC'd others will be > primitive. So I have a definition that says: > > Foo {member1=int, member2=Object, member3=float} > > From what I can tell I can't create lltypes on-the-fly at runtime, so I'm > left laying out the memory for this by hand, and making a custom GC hook. > But I'm still figuring out how to do that. > > Timothy > > On Sat, Mar 10, 2018 at 12:26 AM, Armin Rigo <armin.r...@gmail.com> wrote: > >> Hi Timothy, >> >> On 10 March 2018 at 01:26, Timothy Baldridge <tbaldri...@gmail.com> >> wrote: >> > I have a rather strange use-case for a data type in a rpython >> interpreter. >> > What I need is a raw malloc, but with a custom GC hook. >> >> GC hooks make no sense with non-GC structures. Try to describe more >> what you're trying to achieve. For example, maybe you have some GC >> object that itself contains a pointer to the raw variable-sized >> structure, and you want the GC to follow references from this GC >> object to other GC objects via the raw variable-sized structure. Then >> you'd put the GC hook on this GC object. >> >> >> A bientôt, >> >> Armin. >> > > > > -- > “One of the main causes of the fall of the Roman Empire was that–lacking > zero–they had no way to indicate successful termination of their C > programs.” > (Robert Firth) > -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth)
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev