[fpc-devel] Refactoring TVMTBuilder
Sven Barth
pascaldragon at googlemail.com
Wed Dec 11 23:44:11 CET 2019
Am 05.12.2019 um 13:48 schrieb Blaise at blaise.ru:
> 1) Currently, the following snippet
>> vmtbuilder:=TVMTBuilder.Create(...);
>> vmtbuilder.generate_vmt;
>> vmtbuilder.free;
> is present @
> types_dec :objectdef
> generate_specialization_phase2 :objectdef
> jvm_maybe_create_enum_class
> jvm_create_procvar_class_intern
> and there will be the fifth instance for closures.
> The first patch extracts the above into a separate routine -- build_vmt.
>
> 2) Because of SVN r41884, I strongly suggest that build_vmt be
> actually named insert_hidden_paras_and_build_vmt (the second patch),
> in order that the tight coupling of these two unrelated operations be
> reflected in the name. Unless you are ready for something generic like
> postprocess_object, that mouthful is better than simple "build_vmt".
> Should this be rejected, at the very least, add the following comment
> // Despite the name, this also inserts method's hidden parameters
> above the interface declaration of build_vmt.
>
> 3) I would like to draw a strong terminological distinction between
> creating/building data structures within the compiler, and generating
> code/data in object files. NCGVMT.TVMTWriter is the one concerned with
> VMT /generation/, not NObj.TVMTBuilder, which creates & builds the
> data structures.
> The third patch renames
> TVMTBuilder.generate_vmt_def -> .create_vmtdef // or, maybe,
> build_vmtdef
> TVMTBuilder.generate_vmt -> .build
> Also, .build_interface_mappings becomes private and it is grouped
> within the TVMTBuilder declaration with the methods it uses.
>
> (This submission is only split into three patches for easy
> cherry-picking; in my book, they are just fine becoming a single SVN
> commit.)
Done in r43673 to r43676.
Regards,
Sven
More information about the fpc-devel
mailing list