diff options
author | Mark Mitchell <mark@codesourcery.com> | 2000-01-16 16:59:44 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2000-01-16 16:59:44 +0000 |
commit | 70ae32012466e09d67dd4eed3f74ea74f9c2629e (patch) | |
tree | 474362df55656c988b876cb23e1ad22cf0bc2401 /gcc/cp/init.c | |
parent | 2f4facc91eb1b0917f951bb0ff2571ed24d66e08 (diff) | |
download | gcc-70ae32012466e09d67dd4eed3f74ea74f9c2629e.zip gcc-70ae32012466e09d67dd4eed3f74ea74f9c2629e.tar.gz gcc-70ae32012466e09d67dd4eed3f74ea74f9c2629e.tar.bz2 |
cp-tree.h (num_extra_vtbl_entries): New function.
* cp-tree.h (num_extra_vtbl_entries): New function.
(size_extra_vtbl_entries): Likewise.
(dfs_vtable_path_unmark): Likewise.
(dfs_vtable_path_unmarked_real_bases_queue_p): Likewise.
(dfs_vtable_path_marked_real_bases_queue_p): Likewise.
* class.c (num_extra_vtbl_entries): New function.
(size_extra_vtbl_entries): Likewise.
(dfs_build_vbase_offset_vtbl_entries): New function.
(build_vbase_offset_vtbl_entries): Likewise.
(build_vtbl_initializer): Use it.
(finish_struct_1): Adjust vtable sizes (using
num_extra_vtbl_entries).
* expr.c (cplus_expand_expr): Assert that the DECL_RTL for a
THUNK_DECL is non-NULL before expanding it.
* init.c (expand_virtual_init): Adjust the vtable pointer by
size_extra_vtbl_entries before storing it.
* search.c (get_shared_vase_if_not_primary): Adjust prototype.
Handle TREE_LIST parameters here, not in the dfs_* functions.
(dfs_unmarked_real_bases_queue_p): Adjust.
(dfs_marked_real_bases_queue_p): Likewise.
(dfs_vtable_path_unmarked_real_bases_queue_p): New function.
(dfs_vtable_path_marked_real_bases_queue_p): New function.
(dfs_vtable_path_unmark): Likewise.
From-SVN: r31439
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index ed2a3d7..12815e4 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -648,21 +648,26 @@ expand_virtual_init (binfo, decl) tree vtbl, vtbl_ptr; tree vtype, vtype_binfo; - /* This code is crusty. Should be simple, like: - vtbl = BINFO_VTABLE (binfo); - */ + /* Compute the location of the vtable. */ vtype = DECL_CONTEXT (TYPE_VFIELD (type)); vtype_binfo = get_binfo (vtype, TREE_TYPE (TREE_TYPE (decl)), 0); vtbl = BINFO_VTABLE (binfo_value (DECL_FIELD_CONTEXT (TYPE_VFIELD (type)), binfo)); assemble_external (vtbl); TREE_USED (vtbl) = 1; vtbl = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (vtbl)), vtbl); + /* Under the new ABI, we need to point into the middle of the + vtable. */ + if (flag_new_abi) + vtbl = build (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, + size_extra_vtbl_entries (binfo)); + + /* Compute the location of the vtpr. */ decl = convert_pointer_to_real (vtype_binfo, decl); vtbl_ptr = build_vfield_ref (build_indirect_ref (decl, NULL_PTR), vtype); if (vtbl_ptr == error_mark_node) return; - /* Have to convert VTBL since array sizes may be different. */ + /* Assign the vtable to the vptr. */ vtbl = convert_force (TREE_TYPE (vtbl_ptr), vtbl, 0); finish_expr_stmt (build_modify_expr (vtbl_ptr, NOP_EXPR, vtbl)); } |