Hi Timothy,

On Tue, 30 Oct 2018 at 00:42, Timothy Baldridge <tbaldri...@gmail.com> wrote:
> typedef struct foo_t {
> int a, b;
> int _data[0];
> }
>
> foo_t tmp = malloc(sizeof(foo_t) + 64);

You can do that if you use the lltype.GcStruct type directly, not
using "regular" RPython code.  See the main example in
rpython.rtyper.lltypesystem.rstr: the types STR and UNICODE.  They are
defined as lltype.GcStruct('name', ..some_regular_fields..,
inlined_array_field), and allocated with lltype.malloc(STR,
length_of_array).

Note that you also need to prevent the JIT from seeing any such type:
it has got special case for STR and UNICODE but doesn't handle the
general case.


A bientôt,

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

Reply via email to