Browse Source

Extended RTTI: optimise fetching VMT index

Jonas Maebe 1 year ago
parent
commit
0104edce45
1 changed files with 2 additions and 11 deletions
  1. 2 11
      compiler/ncgrtti.pas

+ 2 - 11
compiler/ncgrtti.pas

@@ -244,7 +244,6 @@ implementation
         rtticount,
         rtticount,
         totalcount,
         totalcount,
         i,j,k : longint;
         i,j,k : longint;
-        vmt_index : integer;
         sym : tprocsym;
         sym : tprocsym;
         def : tprocdef;
         def : tprocdef;
         para : tparavarsym;
         para : tparavarsym;
@@ -318,19 +317,11 @@ implementation
                         { write visibility section for extended RTTI }
                         { write visibility section for extended RTTI }
                         maybe_add_comment(tcb,#9'visibility');
                         maybe_add_comment(tcb,#9'visibility');
                         tcb.emit_ord_const(visibility_to_rtti_flags(def.visibility),u8inttype);
                         tcb.emit_ord_const(visibility_to_rtti_flags(def.visibility),u8inttype);
-                        { for classes write a VMT index }
+                        { for objects and classes write a VMT index }
                         if st.defowner.typ=objectdef then
                         if st.defowner.typ=objectdef then
                           begin
                           begin
-                            vmt_index:=-1;
-                            if po_virtualmethod in def.procoptions then
-                              for k:=0 to tobjectdef(st.defowner).vmtentries.count-1 do
-                                if pvmtentry(tobjectdef(st.defowner).vmtentries[k])^.procdef=def then
-                                  begin
-                                    vmt_index:=k;
-                                    break;
-                                  end;
                             maybe_add_comment(tcb,#9'VMT index');
                             maybe_add_comment(tcb,#9'VMT index');
-                            tcb.emit_ord_const(vmt_index,s16inttype);
+                            tcb.emit_ord_const(def.extnumber,u16inttype);
                           end;
                           end;
                       end;
                       end;