harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li" <xiaofeng...@gmail.com>
Subject Re: [drlvm][gc] Question about references and fields.
Date Thu, 24 Jan 2008 11:47:40 GMT
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.


On Jan 24, 2008 6:36 PM, Yuri Kashnikoff <yuri.kashnikoff@gmail.com> wrote:
> Hi!
> I need to get the name of some reference field (e.g. for String.value
> - value).  Using iterating functions (like
> object_ref_iterator_get(int* iterator, Partial_Reveal_Object *obj)) we
> could get all REF* 's for Partial_Reveal_Object* obj. And is there any
> methods to recognize the name(field name) of this reference field?
> Thank, You!
> --
> Yuri S. Kashnikov
> Novosibirsk State University, Russia
> 2 Pirogova street
> 630090, Novosibirsk-90
> yuri.kashnikoff@gmail.com


View raw message