Răsfoiți Sursa

* 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 -

Jonas Maebe 9 ani în urmă
părinte
comite
ae51adac18
2 a modificat fișierele cu 12 adăugiri și 3 ștergeri
  1. 6 3
      compiler/ncgrtti.pas
  2. 6 0
      compiler/symconst.pas

+ 6 - 3
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 }

+ 6 - 0
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$',