This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ PATCH to enable thunk optimization


This patch changes the C++ ABI to use virtual thunks where possible rather
than create additional non-virtual thunks.  There hasn't been much feedback
on the ABI list, but what there has been was positive.

It also fixes an uninitialized variable warning that looked suspicious to me.

Tested i686-pc-linux-gnu, applied to trunk and branch; since this is an ABI
change, it has to go in now.

2001-06-14  Jason Merrill  <jason_merrill@redhat.com>

	* class.c (update_vtable_entry_for_fn): Uncomment optimization to use
	virtual thunk instead of non-virtual.
	(get_matching_virtual): Uncomment.

*** class.c.~1~	Wed Jun 13 21:01:18 2001
--- class.c	Thu Jun 14 13:08:08 2001
*************** find_final_overrider (t, binfo, fn)
*** 2707,2713 ****
    return build_tree_list (ffod.overriding_fn, ffod.overriding_base);
  }
  
- #if 0
  /* Returns the function from the BINFO_VIRTUALS entry in T which matches
     the signature of FUNCTION_DECL FN, or NULL_TREE if none.  In other words,
     the function that the slot in T's primary vtable points to.  */
--- 2719,2724 ----
*************** get_matching_virtual (t, fn)
*** 2724,2730 ****
        return BV_FN (f);
    return NULL_TREE;
  }
- #endif
  
  /* Update an entry in the vtable for BINFO, which is in the hierarchy
     dominated by T.  FN has been overriden in BINFO; VIRTUALS points to the
--- 2735,2740 ----
*************** update_vtable_entry_for_fn (t, binfo, fn
*** 2799,2808 ****
        delta = size_diffop (BINFO_OFFSET (TREE_VALUE (overrider)),
  			   BINFO_OFFSET (binfo));
  
- #if 0
-       /* Disable this optimization pending an ABI change, or until
- 	 we can force emission of the non-virtual thunk even if we don't
- 	 use it.  */
        if (! integer_zerop (delta))
  	{
  	  /* We'll need a thunk.  But if we have a (perhaps formerly)
--- 2809,2814 ----
*************** update_vtable_entry_for_fn (t, binfo, fn
*** 2825,2831 ****
  		}
  	    }
  	}
- #endif
      }
  
    modify_vtable_entry (t, 
--- 2831,2836 ----
*************** dfs_accumulate_vtbl_inits (binfo, orig_b
*** 7691,7697 ****
  	         still be primary to something within a lost primary
  	         virtual base of RTTI_BINFO.  */
  	      tree b;
! 	      tree last, orig_last;
  
  	      /* First, look through the bases we are primary to for a
  	     	 virtual base.  */
--- 7696,7703 ----
  	         still be primary to something within a lost primary
  	         virtual base of RTTI_BINFO.  */
  	      tree b;
! 	      tree last = NULL_TREE;
! 	      tree orig_last;
  
  	      /* First, look through the bases we are primary to for a
  	     	 virtual base.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]