Class array implementation

Paul Richard Thomas paul.richard.thomas@gmail.com
Wed Oct 26 09:12:00 GMT 2011


Dear All,

I have not managed to stick to my intended deadline for implementation
of class arrays.  You will have seen from my last patch that it seems
to require ad-hoc kludges in every expression type involved.  The
problem is that the insertion of the component references that point
to the the _data field and the _vptr components (eg hash, size, copy
and so on) is done too late; either in translation or the fimnal stage
of resolution.  This results in the ad-hoc aspect, since it has to be
done differently for every situation.

I am considering two possible solutions:
(i) To insert a "_data" component reference after all class object or
component references during matching.  In those specific cases where a
_vptr component (eg. the 'hash'field for the select type construct) is
used, this can be done by changing the _data reference to _vptr and
adding the hash field reference.
(ii) Introduce a new type of reference, REF_CLASS_COMPONENT with a
ref->type ENUM that includes _data, _vptr, size etc. the expansion of
the reference can then wait until translation; especially in
gfc_conv_expr and its like.  In the places where this needs to be
changed, such as in resolving select type, the enum value can be
changed - that's all!.  This new type of reference, should have a
typespec corresponding to the _data type, an array spec and a the
_vptr typespec.

In both cases, objects containing class components will be dealt with
as a matter of course.

I think that (i) is a lot less effort but that (ii) will be a lot
cleaner in the long run.

I'll let you know in the next couple of days.  I have a couple of
batchelor evenings ahead of me, so I will concentrate on this problem
then :-)

Cheers

Paul

-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy



More information about the Fortran mailing list