Ver código fonte

* use pooled constant references for the parameter names of VMT methods in the RTTI

git-svn-id: trunk@39684 -
svenbarth 7 anos atrás
pai
commit
228d3252cc
2 arquivos alterados com 11 adições e 4 exclusões
  1. 2 2
      compiler/ncgrtti.pas
  2. 9 2
      rtl/objpas/typinfo.pp

+ 2 - 2
compiler/ncgrtti.pas

@@ -245,7 +245,8 @@ implementation
                           else
                             write_rtti_reference(tcb,para.vardef,fullrtti);
                           write_param_flag(tcb,para);
-                          tcb.emit_shortstring_const(para.realname);
+
+                          tcb.emit_pooled_shortstring_const_ref(para.realname);
 
                           write_paralocs(tcb,@para.paraloc[callerside]);
 
@@ -1905,7 +1906,6 @@ implementation
           current_module.add_extern_asmsym(s,AB_EXTERNAL,AT_DATA);
       end;
 
-
     procedure TRTTIWriter.write_rtti(def:tdef;rt:trttitype);
       var
         tcb: ttai_typedconstbuilder;

+ 9 - 2
rtl/objpas/typinfo.pp

@@ -331,11 +331,13 @@ unit TypInfo;
         function GetParaLocs: PParameterLocations; inline;
         function GetTail: Pointer; inline;
         function GetNext: PVmtMethodParam; inline;
+        function GetName: ShortString; inline;
       public
         ParamType: PPTypeInfo;
         Flags: TParamFlags;
-        Name: ShortString;
+        NamePtr: PShortString;
         { ParaLocs: TParameterLocations; }
+        property Name: ShortString read GetName;
         property ParaLocs: PParameterLocations read GetParaLocs;
         property Tail: Pointer read GetTail;
         property Next: PVmtMethodParam read GetNext;
@@ -2962,7 +2964,7 @@ end;
 
 function TVmtMethodParam.GetParaLocs: PParameterLocations;
 begin
-  Result := PParameterLocations(aligntoptr(PByte(@Name[0]) + Length(Name) + Sizeof(Name[0])));
+  Result := PParameterLocations(aligntoptr(PByte(@NamePtr) + SizeOf(NamePtr)));
 end;
 
 function TVmtMethodParam.GetTail: Pointer;
@@ -2975,6 +2977,11 @@ begin
   Result := PVmtMethodParam(aligntoptr(Tail));
 end;
 
+function TVmtMethodParam.GetName: ShortString;
+begin
+  Result := NamePtr^;
+end;
+
 { TIntfMethodEntry }
 
 function TIntfMethodEntry.GetParam(Index: Word): PVmtMethodParam;