Commit 5d5f5230 authored by Alexandre Julliard's avatar Alexandre Julliard

Output the virtual tables for the exception classes using assembly so

that they can have the correct layout, and get rid of the corresponding hacks in RTTI_GetObjectLocator. Build more of the code on non-i386 platforms too. Protect __RTDynamicCast and friends with exception handlers. Fix handling of the vtable pointer so that we don't need to declare all object pointers as type_info.
parent ec39d655
...@@ -379,7 +379,7 @@ DEFINE_REGS_ENTRYPOINT( __CxxFrameHandler, MSVCRT__CxxFrameHandler, 16, 0 ); ...@@ -379,7 +379,7 @@ DEFINE_REGS_ENTRYPOINT( __CxxFrameHandler, MSVCRT__CxxFrameHandler, 16, 0 );
/********************************************************************* /*********************************************************************
* _CxxThrowException (MSVCRT.@) * _CxxThrowException (MSVCRT.@)
*/ */
void _CxxThrowException( void *object, const cxx_exception_type *type ) void _CxxThrowException( exception *object, const cxx_exception_type *type )
{ {
DWORD args[3]; DWORD args[3];
......
...@@ -29,11 +29,19 @@ typedef void (*vtable_ptr)(); ...@@ -29,11 +29,19 @@ typedef void (*vtable_ptr)();
/* type_info object, see cpp.c for inplementation */ /* type_info object, see cpp.c for inplementation */
typedef struct __type_info typedef struct __type_info
{ {
vtable_ptr *vtable; const vtable_ptr *vtable;
char *name; /* Unmangled name, allocated lazily */ char *name; /* Unmangled name, allocated lazily */
char mangled[32]; /* Variable length, but we declare it large enough for static RTTI */ char mangled[32]; /* Variable length, but we declare it large enough for static RTTI */
} type_info; } type_info;
/* exception object */
typedef struct __exception
{
const vtable_ptr *vtable;
char *name; /* Name of this exception, always a new copy for each object */
int do_free; /* Whether to free 'name' in our dtor */
} exception;
/* the exception frame used by CxxFrameHandler */ /* the exception frame used by CxxFrameHandler */
typedef struct __cxx_exception_frame typedef struct __cxx_exception_frame
{ {
...@@ -96,7 +104,7 @@ typedef struct ...@@ -96,7 +104,7 @@ typedef struct
typedef struct __cxx_type_info typedef struct __cxx_type_info
{ {
UINT flags; /* flags (see CLASS_* flags below) */ UINT flags; /* flags (see CLASS_* flags below) */
type_info *type_info; /* C++ type info */ const type_info *type_info; /* C++ type info */
this_ptr_offsets offsets; /* offsets for computing the this pointer */ this_ptr_offsets offsets; /* offsets for computing the this pointer */
size_t size; /* object size */ size_t size; /* object size */
cxx_copy_ctor copy_ctor; /* copy constructor */ cxx_copy_ctor copy_ctor; /* copy constructor */
...@@ -125,7 +133,13 @@ typedef struct __cxx_exception_type ...@@ -125,7 +133,13 @@ typedef struct __cxx_exception_type
const cxx_type_info_table *type_info_table; /* list of types for this exception object */ const cxx_type_info_table *type_info_table; /* list of types for this exception object */
} cxx_exception_type; } cxx_exception_type;
void _CxxThrowException(void*,const cxx_exception_type*); void _CxxThrowException(exception*,const cxx_exception_type*);
/* get the vtable pointer for a C++ object */
static inline const vtable_ptr *get_vtable( void *obj )
{
return *(const vtable_ptr **)obj;
}
static inline const char *dbgstr_type_info( const type_info *info ) static inline const char *dbgstr_type_info( const type_info *info )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment