Browse Source

* use an anonymous symbol for the record operator table as its typing is different for each incarnation anyway

Sven/Sarah Barth 3 years ago
parent
commit
1e37eef3d2
2 changed files with 12 additions and 12 deletions
  1. 12 10
      compiler/ncgrtti.pas
  2. 0 2
      compiler/symconst.pas

+ 12 - 10
compiler/ncgrtti.pas

@@ -1357,21 +1357,17 @@ implementation
 
         procedure recorddef_rtti(def:trecorddef);
 
-          procedure write_record_operators;
+          procedure write_record_operators(rttilab:tasmlabel);
           var
-            rttilab: Tasmsymbol;
             rttidef: tdef;
             tcb: ttai_typedconstbuilder;
             mop: tmanagementoperator;
             procdef: tprocdef;
           begin
-            rttilab := current_asmdata.DefineAsmSymbol(
-                internaltypeprefixName[itp_init_record_operators]+def.rtti_mangledname(rt),
-                AB_GLOBAL,AT_DATA,def);
             tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
 
             tcb.begin_anonymous_record(
-              rttilab.Name,
+              '',
               defaultpacking,min(reqalign,SizeOf(PInt)),
               targetinfos[target_info.system]^.alignment.recordalignmin
             );
@@ -1400,6 +1396,8 @@ implementation
             tcb.free;
           end;
 
+        var
+          oplab : tasmlabel;
         begin
            write_header(tcb,def,tkRecord);
            { need extra reqalign record, because otherwise the u32 int will
@@ -1426,6 +1424,7 @@ implementation
 
            tcb.emit_ord_const(def.size,u32inttype);
 
+           oplab:=nil;
            { store rtti management operators only for init table }
            if rt=initrtti then
              begin
@@ -1434,9 +1433,12 @@ implementation
                if (trecordsymtable(def.symtable).managementoperators=[]) then
                  tcb.emit_tai(Tai_const.Create_nil_dataptr,voidpointertype)
                else
-                 tcb.emit_tai(Tai_const.Createname(
-                   internaltypeprefixName[itp_init_record_operators]+def.rtti_mangledname(rt),
-                   AT_DATA_FORCEINDIRECT,0),voidpointertype);
+                 begin
+                   current_asmdata.getlocaldatalabel(oplab);
+                   tcb.emit_tai(Tai_const.Createname(
+                     oplab.name,
+                     AT_DATA_FORCEINDIRECT,0),voidpointertype);
+                 end;
              end;
 
            fields_write_rtti_data(tcb,def,rt);
@@ -1445,7 +1447,7 @@ implementation
 
            { write pointers to operators if needed }
            if (rt=initrtti) and (trecordsymtable(def.symtable).managementoperators<>[]) then
-             write_record_operators;
+             write_record_operators(oplab);
         end;
 
 

+ 0 - 2
compiler/symconst.pas

@@ -794,7 +794,6 @@ type
     itp_rtti_set_inner,
     itp_rtti_record,
     itp_rtti_record_inner,
-    itp_init_record_operators,
     itp_init_mop_offset_entry,
     itp_threadvar_record,
     itp_objc_method_list,
@@ -949,7 +948,6 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has
        '$rtti_set_inner$',
        '$rtti_record$',
        '$rtti_record_inner$',
-       '$init_record_operators$',
        '$init_mop_offset_entry$',
        '$threadvar_record$',
        '$objc_method_list$',