From ae51adac1853e9591ce36d86021cb88e7c65c133 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sun, 28 Aug 2016 22:07:47 +0000 Subject: [PATCH] * give names to the types of the fields of the enumdef rtti, so that we can refer to these type names when writing the s2o and o2s arrays in the LLVM assembler writer (otherwise we have to write out the entire definition of those fields and their subtypes for every access, resulting in a 139MB cpubase.ll instead of a more reasonable 1.5MB one now) git-svn-id: trunk@34386 - --- compiler/ncgrtti.pas | 9 ++++++--- compiler/symconst.pas | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index c12779d96f..36caac2b8c 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -562,7 +562,10 @@ implementation { align; the named fields are so that we can let the compiler calculate the string offsets later on } tcb.next_field_name:='size_start_rec'; - tcb.begin_anonymous_record('',defaultpacking,reqalign, + { add a typename so that it can be reused when writing the the s2o + and o2s arrays for llvm (otherwise we have to write out the entire + type definition every time we access an element from this record) } + tcb.begin_anonymous_record(internaltypeprefixName[itp_rtti_enum_size_start_rec]+def.unique_id_str,defaultpacking,reqalign, targetinfos[target_info.system]^.alignment.recordalignmin, targetinfos[target_info.system]^.alignment.maxCrecordalign); case longint(def.size) of @@ -581,7 +584,7 @@ implementation We need to adhere to this, otherwise things will break. } tcb.next_field_name:='min_max_rec'; - tcb.begin_anonymous_record('',defaultpacking,reqalign, + tcb.begin_anonymous_record(internaltypeprefixName[itp_rtti_enum_min_max_rec]+def.unique_id_str,defaultpacking,reqalign, targetinfos[target_info.system]^.alignment.recordalignmin, targetinfos[target_info.system]^.alignment.maxCrecordalign); tcb.emit_ord_const(def.min,s32inttype); @@ -589,7 +592,7 @@ implementation tcb.next_field_name:='basetype_array_rec'; { all strings must appear right after each other -> from now on packrecords 1 (but the start must still be aligned) } - tcb.begin_anonymous_record('',1,reqalign, + tcb.begin_anonymous_record(internaltypeprefixName[itp_rtti_enum_basetype_array_rec]+def.unique_id_str,1,reqalign, targetinfos[target_info.system]^.alignment.recordalignmin, targetinfos[target_info.system]^.alignment.maxCrecordalign); { write base type } diff --git a/compiler/symconst.pas b/compiler/symconst.pas index da544e79ff..56214b391c 100644 --- a/compiler/symconst.pas +++ b/compiler/symconst.pas @@ -697,6 +697,9 @@ type itp_rtti_normal_array, itp_rtti_dyn_array, itp_rtti_proc_param, + itp_rtti_enum_size_start_rec, + itp_rtti_enum_min_max_rec, + itp_rtti_enum_basetype_array_rec, itp_threadvar_record, itp_objc_method_list, itp_objc_proto_list, @@ -834,6 +837,9 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has '$rtti_normal_array$', '$rtti_dyn_array$', '$rtti_proc_param$', + '$rtti_enum_size_start_rec$', + '$rtti_enum_min_max_rec$', + '$rtti_enum_basetype_array_rec$', '$threadvar_record$', '$objc_method_list$', '$objc_proto_list$',