From 883ee2bc0572ff48a69a812c1632e5e72679d3fb Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 6 Apr 2021 13:01:24 +0200 Subject: [PATCH] rtti_cleanup To: wine-devel --- dlls/msvcp140_1/msvcp140_1.c | 22 +++++++++++++--------- dlls/msvcp90/cxx.h | 22 ++++++++++++++++++---- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/dlls/msvcp140_1/msvcp140_1.c b/dlls/msvcp140_1/msvcp140_1.c index 344fee3dc53..968fd66cef0 100644 --- a/dlls/msvcp140_1/msvcp140_1.c +++ b/dlls/msvcp140_1/msvcp140_1.c @@ -103,8 +103,6 @@ extern const vtable_ptr MSVCP_unaligned_resource_vtable; extern const vtable_ptr MSVCP_null_resource_vtable; __ASM_BLOCK_BEGIN(vtables) - __ASM_VTABLE(base_memory_resource, - VTABLE_ADD_FUNC(nop_dtor)); __ASM_VTABLE(aligned_resource, VTABLE_ADD_FUNC(nop_dtor) VTABLE_ADD_FUNC(aligned_do_allocate) @@ -122,10 +120,15 @@ __ASM_BLOCK_BEGIN(vtables) VTABLE_ADD_FUNC(do_is_equal)); __ASM_BLOCK_END -DEFINE_RTTI_DATA0(base_memory_resource, 0, ".?AVmemory_resource@pmr@std@@") -DEFINE_RTTI_DATA1(aligned_resource, 0, &base_memory_resource_rtti_base_descriptor, ".?AV_Aligned_new_delete_resource@pmr@std@@") -DEFINE_RTTI_DATA1(unaligned_resource, 0, &base_memory_resource_rtti_base_descriptor, ".?AV_Unligned_new_delete_resource@pmr@std@@") -DEFINE_RTTI_DATA1(null_resource, 0, &base_memory_resource_rtti_base_descriptor, ".?AV_null_resource@pmr@std@@") +DEFINE_RTTI_BASE(base_memory_resource, 0, ".?AVmemory_resource@pmr@std@@") +DEFINE_RTTI_BASE(_Identity_equal_resource, 0, ".?AV_Identity_equal_resource@pmr@std@@") +DEFINE_RTTI_DATA2(aligned_resource, 0, &_Identity_equal_resource_rtti_base_descriptor, + &base_memory_resource_rtti_base_descriptor, ".?AV_Aligned_new_delete_resource_impl@pmr@std@@") +DEFINE_RTTI_DATA2(unaligned_resource, 0, &_Identity_equal_resource_rtti_base_descriptor, + &base_memory_resource_rtti_base_descriptor, ".?AV_Unaligned_new_delete_resource_impl@pmr@std@@") +DEFINE_RTTI_DATA2(null_resource, 0, &_Identity_equal_resource_rtti_base_descriptor, + &base_memory_resource_rtti_base_descriptor, + ".?AV_Null_resource@?1??null_memory_resource@@YAPAVmemory_resource@pmr@std@@XZ") DEFINE_THISCALL_WRAPPER(nop_dtor, 4) void __thiscall nop_dtor(void *this) @@ -242,10 +245,11 @@ static void init_cxx_funcs(void) static void init_memory_resource(void *base) { #ifdef __x86_64__ - init_null_resource_rtti(base); - init_unaligned_resource_rtti(base); - init_aligned_resource_rtti(base); init_base_memory_resource_rtti(base); + init__Identity_equal_resource_rtti(base); + init_aligned_resource_rtti(base); + init_unaligned_resource_rtti(base); + init_null_resource_rtti(base); #endif } diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index 7af11de7fe6..931bf753660 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -46,7 +46,7 @@ #ifndef __x86_64__ -#define DEFINE_RTTI_DATA(name, off, base_classes_no, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \ +#define DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \ static type_info name ## _type_info = { \ &MSVCP_type_info_vtable, \ NULL, \ @@ -58,7 +58,10 @@ static const rtti_base_descriptor name ## _rtti_base_descriptor = { \ base_classes_no, \ { 0, -1, 0}, \ 64 \ -}; \ +}; + +#define DEFINE_RTTI_DATA(name, off, base_classes_no, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \ + DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \ \ static const rtti_base_array name ## _rtti_base_array = { \ { \ @@ -122,7 +125,7 @@ static const cxx_exception_type type ## _cxx_type = { \ #else -#define DEFINE_RTTI_DATA(name, off, base_classes_no, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \ +#define __DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \ static type_info name ## _type_info = { \ &MSVCP_type_info_vtable, \ NULL, \ @@ -134,7 +137,18 @@ static rtti_base_descriptor name ## _rtti_base_descriptor = { \ base_classes_no, \ { 0, -1, 0}, \ 64 \ -}; \ +}; + +#define DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \ + __DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \ + \ + static void init_ ## name ## _rtti(char *base) \ + { \ + name ## _rtti_base_descriptor.type_descriptor = (char*)&name ## _type_info - base; \ + } + +#define DEFINE_RTTI_DATA(name, off, base_classes_no, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \ + __DEFINE_RTTI_BASE(name, base_classes_no, mangled_name) \ \ static rtti_base_array name ## _rtti_base_array = { \ { \ -- 2.26.3