diff options
author | Mark Mitchell <mark@codesourcery.com> | 2002-10-25 19:39:47 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2002-10-25 19:39:47 +0000 |
commit | bb5e8a7ffc01267f79f7d3a70b98a29fc6eb604c (patch) | |
tree | bc8ca7b32029d71b1854594ff6c94c1ba702f188 /gcc/cp/class.c | |
parent | f3763a442e854320fd233fd63b7871f301f723be (diff) | |
download | gcc-bb5e8a7ffc01267f79f7d3a70b98a29fc6eb604c.zip gcc-bb5e8a7ffc01267f79f7d3a70b98a29fc6eb604c.tar.gz gcc-bb5e8a7ffc01267f79f7d3a70b98a29fc6eb604c.tar.bz2 |
class.c (build_vtbl_initializer): Don't use build_vtable_entry.
* class.c (build_vtbl_initializer): Don't use build_vtable_entry.
(build_vtable_entry): Remove.
* cp-tree.h (BINFO_VIRTUALS): Expand documentation.
(lang_decl): Add thunks.
(DECL_THUNKS): New macro.
* decl.c (duplicate_decls): Copy it.
* method.c (make_thunk): Simplify, and add thunks to DECL_THUNKS.
* semantics.c (emit_associated_thunks): Simplify.
* g++.dg/abi/vthunk2.C: New test.
From-SVN: r58536
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index f4b9beb..a11ad7b 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -103,7 +103,6 @@ varray_type local_classes; static tree get_vfield_name PARAMS ((tree)); static void finish_struct_anon PARAMS ((tree)); -static tree build_vtable_entry PARAMS ((tree, tree, tree)); static tree get_vtable_name PARAMS ((tree)); static tree get_basefndecls PARAMS ((tree, tree)); static int build_primary_vtable PARAMS ((tree, tree)); @@ -7673,7 +7672,6 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p) tree delta; tree vcall_index; tree fn; - tree pfn; tree init = NULL_TREE; fn = BV_FN (v); @@ -7724,15 +7722,13 @@ build_vtbl_initializer (binfo, orig_binfo, t, rtti_binfo, non_fn_entries_p) So, we replace these functions with __pure_virtual. */ if (DECL_PURE_VIRTUAL_P (fn)) fn = abort_fndecl; - + else if (!integer_zerop (delta) || vcall_index) + fn = make_thunk (fn, delta, vcall_index); /* Take the address of the function, considering it to be of an appropriate generic type. */ - pfn = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn); + init = build1 (ADDR_EXPR, vfunc_ptr_type_node, fn); /* The address of a function can't change. */ - TREE_CONSTANT (pfn) = 1; - - /* Enter it in the vtable. */ - init = build_vtable_entry (delta, vcall_index, pfn); + TREE_CONSTANT (init) = 1; } /* And add it to the chain of initializers. */ @@ -8164,33 +8160,3 @@ build_rtti_vtbl_entries (binfo, vid) *vid->last_init = build_tree_list (NULL_TREE, init); vid->last_init = &TREE_CHAIN (*vid->last_init); } - -/* Build an entry in the virtual function table. DELTA is the offset - for the `this' pointer. VCALL_INDEX is the vtable index containing - the vcall offset; NULL_TREE if none. ENTRY is the virtual function - table entry itself. It's TREE_TYPE must be VFUNC_PTR_TYPE_NODE, - but it may not actually be a virtual function table pointer. (For - example, it might be the address of the RTTI object, under the new - ABI.) */ - -static tree -build_vtable_entry (delta, vcall_index, entry) - tree delta; - tree vcall_index; - tree entry; -{ - tree fn = TREE_OPERAND (entry, 0); - - if ((!integer_zerop (delta) || vcall_index != NULL_TREE) - && fn != abort_fndecl) - { - entry = make_thunk (entry, delta, vcall_index); - entry = build1 (ADDR_EXPR, vtable_entry_type, entry); - TREE_READONLY (entry) = 1; - TREE_CONSTANT (entry) = 1; - } -#ifdef GATHER_STATISTICS - n_vtable_entries += 1; -#endif - return entry; -} |