mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 02:31:49 +01:00 
			
		
		
		
	* Smartlinking with interfaces fixed
* Better smartlinking for rtti and init tables
This commit is contained in:
		
							parent
							
								
									92137a9a2a
								
							
						
					
					
						commit
						d75c4d6486
					
				| @ -31,9 +31,10 @@ implementation | |||||||
| 
 | 
 | ||||||
| uses | uses | ||||||
|   systems, |   systems, | ||||||
|   verbose,globals, |   verbose,globals,globtype, | ||||||
|   aasm, |   aasm, | ||||||
|   symconst,symbase,symtype,symtable,symdef,symsym, |   symconst,symtype,symdef,symsym, | ||||||
|  |   fmodule, | ||||||
|   nobj, |   nobj, | ||||||
|   temp_gen, |   temp_gen, | ||||||
|   cpubase, |   cpubase, | ||||||
| @ -141,7 +142,7 @@ procedure ti386classheader.cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef | |||||||
| var | var | ||||||
|   oldexprasmlist: TAAsmoutput; |   oldexprasmlist: TAAsmoutput; | ||||||
|   lab : tasmsymbol; |   lab : tasmsymbol; | ||||||
| 
 |   make_global : boolean; | ||||||
| begin | begin | ||||||
|   if procdef.proctypeoption<>potype_none then |   if procdef.proctypeoption<>potype_none then | ||||||
|     Internalerror(200006137); |     Internalerror(200006137); | ||||||
| @ -149,11 +150,22 @@ begin | |||||||
|      (procdef.procoptions*[po_containsself, po_classmethod, po_staticmethod, |      (procdef.procoptions*[po_containsself, po_classmethod, po_staticmethod, | ||||||
|        po_methodpointer, po_interrupt, po_iocheck]<>[]) then |        po_methodpointer, po_interrupt, po_iocheck]<>[]) then | ||||||
|     Internalerror(200006138); |     Internalerror(200006138); | ||||||
|  |   if procdef.owner.symtabletype<>objectsymtable then | ||||||
|  |     Internalerror(200109191); | ||||||
| 
 | 
 | ||||||
|   oldexprasmlist:=exprasmlist; |   oldexprasmlist:=exprasmlist; | ||||||
|   exprasmlist:=asmlist; |   exprasmlist:=asmlist; | ||||||
| 
 | 
 | ||||||
|   exprasmList.concat(Tai_symbol.Createname(labelname,0)); |   make_global:=false; | ||||||
|  |   if (not current_module.is_unit) or | ||||||
|  |      (cs_create_smart in aktmoduleswitches) or | ||||||
|  |      (procdef.owner.defowner.owner.symtabletype=globalsymtable) then | ||||||
|  |     make_global:=true; | ||||||
|  | 
 | ||||||
|  |   if make_global then | ||||||
|  |    exprasmList.concat(Tai_symbol.Createname_global(labelname,0)) | ||||||
|  |   else | ||||||
|  |    exprasmList.concat(Tai_symbol.Createname(labelname,0)); | ||||||
| 
 | 
 | ||||||
|   { set param1 interface to self  } |   { set param1 interface to self  } | ||||||
|   adjustselfvalue(ioffset); |   adjustselfvalue(ioffset); | ||||||
| @ -211,7 +223,11 @@ initialization | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $Log$ | ||||||
|   Revision 1.2  2001-08-26 13:37:00  florian |   Revision 1.3  2001-09-19 11:04:41  michael | ||||||
|  |   * Smartlinking with interfaces fixed | ||||||
|  |   * Better smartlinking for rtti and init tables | ||||||
|  | 
 | ||||||
|  |   Revision 1.2  2001/08/26 13:37:00  florian | ||||||
|     * some cg reorganisation |     * some cg reorganisation | ||||||
|     * some PPC updates |     * some PPC updates | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -133,6 +133,7 @@ implementation | |||||||
| {$endif} | {$endif} | ||||||
|        globtype,globals,verbose, |        globtype,globals,verbose, | ||||||
|        symtable,symconst,symtype,symsym,types, |        symtable,symconst,symtype,symsym,types, | ||||||
|  |        fmodule, | ||||||
| {$ifdef GDB} | {$ifdef GDB} | ||||||
|        gdb, |        gdb, | ||||||
| {$endif GDB} | {$endif GDB} | ||||||
| @ -811,8 +812,8 @@ implementation | |||||||
| 
 | 
 | ||||||
|     function  tclassheader.gintfgetvtbllabelname(intfindex: integer): string; |     function  tclassheader.gintfgetvtbllabelname(intfindex: integer): string; | ||||||
|       begin |       begin | ||||||
|         gintfgetvtbllabelname:='_$$_'+upper(_class.objname^)+'_$$_'+ |         gintfgetvtbllabelname:='VTBL_'+current_module.modulename^+'$_'+upper(_class.objname^)+ | ||||||
|           upper(_class.implementedinterfaces.interfaces(intfindex).objname^)+'_$$_VTBL'; |                                '_$$_'+upper(_class.implementedinterfaces.interfaces(intfindex).objname^); | ||||||
|       end; |       end; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -826,7 +827,10 @@ implementation | |||||||
|       begin |       begin | ||||||
|         implintf:=_class.implementedinterfaces; |         implintf:=_class.implementedinterfaces; | ||||||
|         curintf:=implintf.interfaces(intfindex); |         curintf:=implintf.interfaces(intfindex); | ||||||
|         rawdata.concat(Tai_symbol.Createname(gintfgetvtbllabelname(intfindex),0)); |         if (cs_create_smart in aktmoduleswitches) then | ||||||
|  |          rawdata.concat(Tai_symbol.Createname_global(gintfgetvtbllabelname(intfindex),0)) | ||||||
|  |         else | ||||||
|  |          rawdata.concat(Tai_symbol.Createname(gintfgetvtbllabelname(intfindex),0)); | ||||||
|         proccount:=implintf.implproccount(intfindex); |         proccount:=implintf.implproccount(intfindex); | ||||||
|         for i:=1 to proccount do |         for i:=1 to proccount do | ||||||
|           begin |           begin | ||||||
| @ -1004,11 +1008,9 @@ implementation | |||||||
|                 ioffsets(i)^:=ioffsets(impintfindexes[i])^; |                 ioffsets(i)^:=ioffsets(impintfindexes[i])^; | ||||||
|             gintfgenentry(i,impintfindexes[i],rawdata); |             gintfgenentry(i,impintfindexes[i],rawdata); | ||||||
|           end; |           end; | ||||||
|         dataSegment.insertlist(rawdata); |         dataSegment.concatlist(rawdata); | ||||||
|         rawdata.free; |         rawdata.free; | ||||||
|         if (cs_create_smart in aktmoduleswitches) then |         codeSegment.concatlist(rawcode); | ||||||
|           rawcode.insert(Tai_cut.Create); |  | ||||||
|         codeSegment.insertlist(rawcode); |  | ||||||
|         rawcode.free; |         rawcode.free; | ||||||
|         freemem(impintfindexes,(max+1)*sizeof(longint)); |         freemem(impintfindexes,(max+1)*sizeof(longint)); | ||||||
|       end; |       end; | ||||||
| @ -1153,10 +1155,21 @@ implementation | |||||||
|          vmtlist:=TAasmoutput.Create; |          vmtlist:=TAasmoutput.Create; | ||||||
|          genvmt(vmtlist); |          genvmt(vmtlist); | ||||||
| 
 | 
 | ||||||
|  |          if (cs_create_smart in aktmoduleswitches) then | ||||||
|  |            dataSegment.concat(Tai_cut.Create); | ||||||
|  | 
 | ||||||
|          { write tables for classes, this must be done before the actual |          { write tables for classes, this must be done before the actual | ||||||
|            class is written, because we need the labels defined } |            class is written, because we need the labels defined } | ||||||
|          if is_class(_class) then |          if is_class(_class) then | ||||||
|           begin |           begin | ||||||
|  |             { interface table } | ||||||
|  |             if _class.implementedinterfaces.count>0 then | ||||||
|  |              begin | ||||||
|  |                if (cs_create_smart in aktmoduleswitches) then | ||||||
|  |                 codeSegment.concat(Tai_cut.Create); | ||||||
|  |                interfacetable:=genintftable; | ||||||
|  |              end; | ||||||
|  | 
 | ||||||
|             methodnametable:=genpublishedmethodstable; |             methodnametable:=genpublishedmethodstable; | ||||||
|             fieldtablelabel:=_class.generate_field_table; |             fieldtablelabel:=_class.generate_field_table; | ||||||
|             { write class name } |             { write class name } | ||||||
| @ -1171,9 +1184,6 @@ implementation | |||||||
|               intmessagetable:=genintmsgtab |               intmessagetable:=genintmsgtab | ||||||
|             else |             else | ||||||
|               dataSegment.concat(Tai_const.Create_32bit(0)); |               dataSegment.concat(Tai_const.Create_32bit(0)); | ||||||
|             { interface table } |  | ||||||
|             if _class.implementedinterfaces.count>0 then |  | ||||||
|               interfacetable:=genintftable; |  | ||||||
|           end; |           end; | ||||||
| 
 | 
 | ||||||
|         { write debug info } |         { write debug info } | ||||||
| @ -1260,7 +1270,11 @@ initialization | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $Log$ | ||||||
|   Revision 1.3  2001-08-30 20:13:53  peter |   Revision 1.4  2001-09-19 11:04:42  michael | ||||||
|  |   * Smartlinking with interfaces fixed | ||||||
|  |   * Better smartlinking for rtti and init tables | ||||||
|  | 
 | ||||||
|  |   Revision 1.3  2001/08/30 20:13:53  peter | ||||||
|     * rtti/init table updates |     * rtti/init table updates | ||||||
|     * rttisym for reusable global rtti/init info |     * rttisym for reusable global rtti/init info | ||||||
|     * support published for interfaces |     * support published for interfaces | ||||||
|  | |||||||
| @ -1053,6 +1053,8 @@ implementation | |||||||
|              begin |              begin | ||||||
|                getdatalabel(localrttilab[rt]); |                getdatalabel(localrttilab[rt]); | ||||||
|                write_child_rtti_data(rt); |                write_child_rtti_data(rt); | ||||||
|  |                if (cs_create_smart in aktmoduleswitches) then | ||||||
|  |                 rttiList.concat(Tai_cut.Create); | ||||||
|                rttiList.concat(Tai_symbol.Create(localrttilab[rt],0)); |                rttiList.concat(Tai_symbol.Create(localrttilab[rt],0)); | ||||||
|                write_rtti_data(rt); |                write_rtti_data(rt); | ||||||
|                rttiList.concat(Tai_symbol_end.Create(localrttilab[rt])); |                rttiList.concat(Tai_symbol_end.Create(localrttilab[rt])); | ||||||
| @ -4844,6 +4846,8 @@ implementation | |||||||
|          count:=0; |          count:=0; | ||||||
|          tablecount:=0; |          tablecount:=0; | ||||||
|          symtable.foreach({$ifdef FPC}@{$endif}count_published_fields); |          symtable.foreach({$ifdef FPC}@{$endif}count_published_fields); | ||||||
|  |          if (cs_create_smart in aktmoduleswitches) then | ||||||
|  |           rttiList.concat(Tai_cut.Create); | ||||||
|          rttiList.concat(Tai_label.Create(fieldtable)); |          rttiList.concat(Tai_label.Create(fieldtable)); | ||||||
|          rttiList.concat(Tai_const.Create_16bit(count)); |          rttiList.concat(Tai_const.Create_16bit(count)); | ||||||
|          rttiList.concat(Tai_const_symbol.Create(classtable)); |          rttiList.concat(Tai_const_symbol.Create(classtable)); | ||||||
| @ -5416,7 +5420,11 @@ implementation | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $Log$ | ||||||
|   Revision 1.50  2001-09-17 21:29:12  peter |   Revision 1.51  2001-09-19 11:04:42  michael | ||||||
|  |   * Smartlinking with interfaces fixed | ||||||
|  |   * Better smartlinking for rtti and init tables | ||||||
|  | 
 | ||||||
|  |   Revision 1.50  2001/09/17 21:29:12  peter | ||||||
|     * merged netbsd, fpu-overflow from fixes branch |     * merged netbsd, fpu-overflow from fixes branch | ||||||
| 
 | 
 | ||||||
|   Revision 1.49  2001/09/10 10:26:27  jonas |   Revision 1.49  2001/09/10 10:26:27  jonas | ||||||
|  | |||||||
| @ -2433,6 +2433,8 @@ implementation | |||||||
|            def.rttitablesym:=rsym; |            def.rttitablesym:=rsym; | ||||||
|            { write rtti data } |            { write rtti data } | ||||||
|            def.write_child_rtti_data(fullrtti); |            def.write_child_rtti_data(fullrtti); | ||||||
|  |            if (cs_create_smart in aktmoduleswitches) then | ||||||
|  |             rttiList.concat(Tai_cut.Create); | ||||||
|            rttiList.concat(Tai_symbol.Create(rsym.get_label,0)); |            rttiList.concat(Tai_symbol.Create(rsym.get_label,0)); | ||||||
|            def.write_rtti_data(fullrtti); |            def.write_rtti_data(fullrtti); | ||||||
|            rttiList.concat(Tai_symbol_end.Create(rsym.get_label)); |            rttiList.concat(Tai_symbol_end.Create(rsym.get_label)); | ||||||
| @ -2469,6 +2471,8 @@ implementation | |||||||
|            def.inittablesym:=rsym; |            def.inittablesym:=rsym; | ||||||
|            { write inittable data } |            { write inittable data } | ||||||
|            def.write_child_rtti_data(initrtti); |            def.write_child_rtti_data(initrtti); | ||||||
|  |            if (cs_create_smart in aktmoduleswitches) then | ||||||
|  |             rttiList.concat(Tai_cut.Create); | ||||||
|            rttiList.concat(Tai_symbol.Create(rsym.get_label,0)); |            rttiList.concat(Tai_symbol.Create(rsym.get_label,0)); | ||||||
|            def.write_rtti_data(initrtti); |            def.write_rtti_data(initrtti); | ||||||
|            rttiList.concat(Tai_symbol_end.Create(rsym.get_label)); |            rttiList.concat(Tai_symbol_end.Create(rsym.get_label)); | ||||||
| @ -2480,7 +2484,11 @@ implementation | |||||||
| end. | end. | ||||||
| { | { | ||||||
|   $Log$ |   $Log$ | ||||||
|   Revision 1.21  2001-09-02 21:18:29  peter |   Revision 1.22  2001-09-19 11:04:42  michael | ||||||
|  |   * Smartlinking with interfaces fixed | ||||||
|  |   * Better smartlinking for rtti and init tables | ||||||
|  | 
 | ||||||
|  |   Revision 1.21  2001/09/02 21:18:29  peter | ||||||
|     * split constsym.value in valueord,valueordptr,valueptr. The valueordptr |     * split constsym.value in valueord,valueordptr,valueptr. The valueordptr | ||||||
|       is used for holding target platform pointer values. As those can be |       is used for holding target platform pointer values. As those can be | ||||||
|       bigger than the source platform. |       bigger than the source platform. | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 michael
						michael