harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuri Kashnikoff" <yuri.kashnik...@gmail.com>
Subject Re: [drlvm][gc] Question about references and fields.
Date Thu, 24 Jan 2008 12:06:33 GMT
On Jan 24, 2008 5:47 PM, Xiao-Feng Li <xiaofeng.li@gmail.com> wrote:
> Yuri, to get reference field you need different approach. Object field
> meta info are kept in its class structure. From an object, you can get
> it's vtable pointer (VTable*), from vtable pointer you can get its
> class structure (Class* or Class_Handle). Assuming you have the
> Class_Handle of a class _clss, then you can iterate its fields by
> following routine:
>   unsigned int nfields = class_number_fields(_clss);
>   unsigned int i;
>   for(i=0; i<nfields; i++){
>     Field_Handle field = class_get_field(_clss, i);
>     char* field_name = field_get_name(field);
>   }
> Please play around to be familiar with the APIs.
Xiao-Feng, first of all thank You for your answer!

Sorry may be I was incorrect. I know how to iterate fields with such
method as You have mentioned above. Imagine that there is a list
implementation and 'next' field is typically 'next' field of list
implementation ('next' refers to the next element of the list).
How to get the address of the object on which it('next') refers?

Yuri S. Kashnikov
Novosibirsk State University, Russia
2 Pirogova street
630090, Novosibirsk-90

View raw message