This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran, OOP] Cleaning up generic TBPs


Hi all,

the attached patch reworks the treatment of generic type-bound
procedures in gfortran. Up to now we had some extra structures in our
vtable implementation to handle polymorphic generic TBP calls at
runtime. However, I recently came to the conclusion that generic TBPs
can be completely resolved to specific TBPs at compile time, which
means that we actually don't need any additional runtime hooks for
generic TBPs.

The patch removes quite a bit of code (those parts that generated the
generic structures in the vtable), and cleans up a few things in
class.c. It has the extremely nice side-effect of fixing four PRs at
once: 44434, 44565, 43945 and 44869 (the second one being a regression
wrt 4.5). It also helped to identify three test cases in the testsuite
as invalid.

The patch was regtested on x86_64-unknown-linux-gnu with no failures.
Ok for trunk?

(Before committing I will add test cases from the four above-mentioned PRs.)

Cheers,
Janus



2010-07-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44434
	PR fortran/44565
	PR fortran/43945
	PR fortran/44869
	* gfortran.h (gfc_find_derived_vtab): Modified prototype.
	* class.c (gfc_build_class_symbol): Modified call to
	'gfc_find_derived_vtab'.
	(add_proc_component): Removed, moved code into 'add_proc_comp'.
	(add_proc_comps): Renamed to 'add_proc_comp', removed treatment of
	generics.
	(add_procs_to_declared_vtab1): Removed unnecessary argument 'resolved'.
	Removed treatment of generics.
	(copy_vtab_proc_comps): Removed unnecessary argument 'resolved'.
	Call 'add_proc_comp' instead of duplicating code.
	(add_procs_to_declared_vtab): Removed unnecessary arguments
'resolved' and 'declared'. Do not recurse to all super types, but copy
all PPCs
	directly from the parent.
	(add_generic_specifics,add_generics_to_declared_vtab): Removed.
	(gfc_find_derived_vtab): Removed unnecessary argument 'resolved'.
	Removed treatment of generics.
	* iresolve.c (gfc_resolve_extends_type_of): Modified call to
	'gfc_find_derived_vtab'.
	* resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
	Remove treatment of generics.
	(resolve_select_type,resolve_fl_derived): Modified call to
	'gfc_find_derived_vtab'.
	* trans-decl.c (gfc_get_symbol_decl): Ditto.
	* trans-expr.c (gfc_conv_derived_to_class,gfc_trans_class_assign):
	Ditto.
	* trans-stmt.c (gfc_trans_allocate): Ditto.

2010-07-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/44434
	PR fortran/44565
	PR fortran/43945
	PR fortran/44869
	* gfortran.dg/dynamic_dispatch_1.f03: Fixed invalid test case.
	* gfortran.dg/dynamic_dispatch_2.f03: Ditto.
	* gfortran.dg/dynamic_dispatch_3.f03: Ditto.

Attachment: generics_v5.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]