Commit 661791cb authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcp100: Add _Runtime_object class implementation.

parent 4fda0463
......@@ -203,10 +203,12 @@
@ stub -arch=win64 ??0_Mutex@std@@QEAA@W4_Uninitialized@1@@Z
@ thiscall -arch=win32 ??0_Mutex@std@@QAE@XZ(ptr) mutex_ctor
@ cdecl -arch=win64 ??0_Mutex@std@@QEAA@XZ(ptr) mutex_ctor
@ stub -arch=win32 ??0_Runtime_object@details@Concurrency@@QAE@H@Z
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z
@ stub -arch=win32 ??0_Runtime_object@details@Concurrency@@QAE@XZ
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@H@Z(ptr long) _Runtime_object_ctor_id
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@H@Z(ptr long) _Runtime_object_ctor_id
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z(ptr long) _Runtime_object_ctor_id
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@XZ(ptr) _Runtime_object_ctor
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@XZ(ptr) _Runtime_object_ctor
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ(ptr) _Runtime_object_ctor
@ thiscall -arch=win32 ??0_Timevec@std@@QAE@ABV01@@Z(ptr ptr) _Timevec_copy_ctor
@ cdecl -arch=win64 ??0_Timevec@std@@QEAA@AEBV01@@Z(ptr ptr) _Timevec_copy_ctor
@ thiscall -arch=win32 ??0_Timevec@std@@QAE@PAX@Z(ptr ptr) _Timevec_ctor_timeptr
......
......@@ -38,6 +38,11 @@ typedef struct __Container_proxy {
_Iterator_base12 *head;
} _Container_proxy;
typedef struct {
void *vtable;
int id;
} _Runtime_object;
#undef __thiscall
#ifdef __i386__
#define __thiscall __stdcall
......@@ -51,6 +56,8 @@ static void (__thiscall *p__Container_base12__Orphan_all)(_Container_base12*);
static void (__thiscall *p__Container_base12_dtor)(_Container_base12*);
static _Iterator_base12** (__thiscall *p__Container_base12__Getpfirst)(_Container_base12*);
static void (__thiscall *p__Container_base12__Swap_all)(_Container_base12*, _Container_base12*);
static _Runtime_object* (__thiscall *p__Runtime_object_ctor)(_Runtime_object*);
static _Runtime_object* (__thiscall *p__Runtime_object_ctor_id)(_Runtime_object*, int);
/* Emulate a __thiscall */
#ifdef __i386__
......@@ -111,6 +118,8 @@ static BOOL init(void)
SET(p__Container_base12_dtor, "??1_Container_base12@std@@QEAA@XZ");
SET(p__Container_base12__Getpfirst, "?_Getpfirst@_Container_base12@std@@QEBAPEAPEAU_Iterator_base12@2@XZ");
SET(p__Container_base12__Swap_all, "?_Swap_all@_Container_base12@std@@QEAAXAEAU12@@Z");
SET(p__Runtime_object_ctor, "??0_Runtime_object@details@Concurrency@@QEAA@XZ");
SET(p__Runtime_object_ctor_id, "??0_Runtime_object@details@Concurrency@@QEAA@H@Z");
}else {
#ifdef __arm__
SET(p__Container_base12_copy_ctor, "??0_Container_base12@std@@QAA@ABU01@@Z");
......@@ -119,6 +128,8 @@ static BOOL init(void)
SET(p__Container_base12_dtor, "??1_Container_base12@std@@QAA@XZ");
SET(p__Container_base12__Getpfirst, "?_Getpfirst@_Container_base12@std@@QBAPAPAU_Iterator_base12@2@XZ");
SET(p__Container_base12__Swap_all, "?_Swap_all@_Container_base12@std@@QAAXAAU12@@Z");
SET(p__Runtime_object_ctor, "??0_Runtime_object@details@Concurrency@@QAA@XZ");
SET(p__Runtime_object_ctor_id, "??0_Runtime_object@details@Concurrency@@QAA@H@Z");
#else
SET(p__Container_base12_copy_ctor, "??0_Container_base12@std@@QAE@ABU01@@Z");
SET(p__Container_base12_ctor, "??0_Container_base12@std@@QAE@XZ");
......@@ -126,6 +137,8 @@ static BOOL init(void)
SET(p__Container_base12_dtor, "??1_Container_base12@std@@QAE@XZ");
SET(p__Container_base12__Getpfirst, "?_Getpfirst@_Container_base12@std@@QBEPAPAU_Iterator_base12@2@XZ");
SET(p__Container_base12__Swap_all, "?_Swap_all@_Container_base12@std@@QAEXAAU12@@Z");
SET(p__Runtime_object_ctor, "??0_Runtime_object@details@Concurrency@@QAE@XZ");
SET(p__Runtime_object_ctor_id, "??0_Runtime_object@details@Concurrency@@QAE@H@Z");
#endif /* __arm__ */
}
......@@ -230,14 +243,35 @@ static void test_vbtable_size_exports(void)
}
}
static void test__Runtime_object(void)
{
_Runtime_object ro;
memset(&ro, 0, sizeof(ro));
call_func1(p__Runtime_object_ctor, &ro);
ok(ro.id == 0, "ro.id = %d\n", ro.id);
call_func1(p__Runtime_object_ctor, &ro);
ok(ro.id == 2, "ro.id = %d\n", ro.id);
call_func1(p__Runtime_object_ctor, &ro);
ok(ro.id == 4, "ro.id = %d\n", ro.id);
call_func2(p__Runtime_object_ctor_id, &ro, 0);
ok(ro.id == 0, "ro.id = %d\n", ro.id);
call_func2(p__Runtime_object_ctor_id, &ro, 1);
ok(ro.id == 1, "ro.id = %d\n", ro.id);
call_func2(p__Runtime_object_ctor_id, &ro, 10);
ok(ro.id == 10, "ro.id = %d\n", ro.id);
call_func1(p__Runtime_object_ctor, &ro);
ok(ro.id == 6, "ro.id = %d\n", ro.id);
}
START_TEST(misc)
{
if(!init())
return;
test__Container_base12();
test_vbtable_size_exports();
test__Runtime_object();
FreeLibrary(msvcp);
}
......@@ -316,12 +316,12 @@
@ cdecl -arch=arm ??0_Pad@std@@QAA@XZ(ptr) _Pad_ctor
@ thiscall -arch=i386 ??0_Pad@std@@QAE@XZ(ptr) _Pad_ctor
@ cdecl -arch=win64 ??0_Pad@std@@QEAA@XZ(ptr) _Pad_ctor
@ stub -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@H@Z
@ stub -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@H@Z
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z
@ stub -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@XZ
@ stub -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@XZ
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@H@Z(ptr long) _Runtime_object_ctor_id
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@H@Z(ptr long) _Runtime_object_ctor_id
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z(ptr long) _Runtime_object_ctor_id
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@XZ(ptr) _Runtime_object_ctor
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@XZ(ptr) _Runtime_object_ctor
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ(ptr) _Runtime_object_ctor
@ cdecl -arch=arm ??0_Timevec@std@@QAA@ABV01@@Z(ptr ptr) _Timevec_copy_ctor
@ thiscall -arch=i386 ??0_Timevec@std@@QAE@ABV01@@Z(ptr ptr) _Timevec_copy_ctor
@ cdecl -arch=win64 ??0_Timevec@std@@QEAA@AEBV01@@Z(ptr ptr) _Timevec_copy_ctor
......
......@@ -316,12 +316,12 @@
@ cdecl -arch=arm ??0_Pad@std@@QAA@XZ(ptr) _Pad_ctor
@ thiscall -arch=i386 ??0_Pad@std@@QAE@XZ(ptr) _Pad_ctor
@ cdecl -arch=win64 ??0_Pad@std@@QEAA@XZ(ptr) _Pad_ctor
@ stub -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@H@Z
@ stub -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@H@Z
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z
@ stub -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@XZ
@ stub -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@XZ
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@H@Z(ptr long) _Runtime_object_ctor_id
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@H@Z(ptr long) _Runtime_object_ctor_id
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z(ptr long) _Runtime_object_ctor_id
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@XZ(ptr) _Runtime_object_ctor
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@XZ(ptr) _Runtime_object_ctor
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ(ptr) _Runtime_object_ctor
@ cdecl -arch=arm ??0_Timevec@std@@QAA@ABV01@@Z(ptr ptr) _Timevec_copy_ctor
@ thiscall -arch=i386 ??0_Timevec@std@@QAE@ABV01@@Z(ptr ptr) _Timevec_copy_ctor
@ cdecl -arch=win64 ??0_Timevec@std@@QEAA@AEBV01@@Z(ptr ptr) _Timevec_copy_ctor
......
......@@ -316,12 +316,12 @@
@ cdecl -arch=arm ??0_Pad@std@@QAA@XZ(ptr) msvcp120.??0_Pad@std@@QAA@XZ
@ thiscall -arch=i386 ??0_Pad@std@@QAE@XZ(ptr) msvcp120.??0_Pad@std@@QAE@XZ
@ cdecl -arch=win64 ??0_Pad@std@@QEAA@XZ(ptr) msvcp120.??0_Pad@std@@QEAA@XZ
@ stub -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@H@Z
@ stub -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@H@Z
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z
@ stub -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@XZ
@ stub -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@XZ
@ stub -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@H@Z(ptr long) msvcp120.??0_Runtime_object@details@Concurrency@@QAA@H@Z
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@H@Z(ptr long) msvcp120.??0_Runtime_object@details@Concurrency@@QAE@H@Z
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@H@Z(ptr long) msvcp120.??0_Runtime_object@details@Concurrency@@QEAA@H@Z
@ cdecl -arch=arm ??0_Runtime_object@details@Concurrency@@QAA@XZ(ptr) msvcp120.??0_Runtime_object@details@Concurrency@@QAA@XZ
@ thiscall -arch=i386 ??0_Runtime_object@details@Concurrency@@QAE@XZ(ptr) msvcp120.??0_Runtime_object@details@Concurrency@@QAE@XZ
@ cdecl -arch=win64 ??0_Runtime_object@details@Concurrency@@QEAA@XZ(ptr) msvcp120.??0_Runtime_object@details@Concurrency@@QEAA@XZ
@ cdecl -arch=arm ??0_Timevec@std@@QAA@ABV01@@Z(ptr ptr) msvcp120.??0_Timevec@std@@QAA@ABV01@@Z
@ thiscall -arch=i386 ??0_Timevec@std@@QAE@ABV01@@Z(ptr ptr) msvcp120.??0_Timevec@std@@QAE@ABV01@@Z
@ cdecl -arch=win64 ??0_Timevec@std@@QEAA@AEBV01@@Z(ptr ptr) msvcp120.??0_Timevec@std@@QEAA@AEBV01@@Z
......
......@@ -1559,6 +1559,48 @@ void __thiscall _Concurrent_queue_base_v4_dummy(_Concurrent_queue_base_v4 *this)
}
DEFINE_RTTI_DATA0(_Concurrent_queue_base_v4, 0, ".?AV_Concurrent_queue_base_v4@details@Concurrency@@")
static int _Runtime_object_id;
typedef struct
{
const vtable_ptr *vtable;
int id;
} _Runtime_object;
extern const vtable_ptr MSVCP__Runtime_object_vtable;
/* ??0_Runtime_object@details@Concurrency@@QAE@H@Z */
/* ??0_Runtime_object@details@Concurrency@@QEAA@H@Z */
DEFINE_THISCALL_WRAPPER(_Runtime_object_ctor_id, 8)
_Runtime_object* __thiscall _Runtime_object_ctor_id(_Runtime_object *this, int id)
{
TRACE("(%p %d)\n", this, id);
this->vtable = &MSVCP__Runtime_object_vtable;
this->id = id;
return this;
}
/* ??0_Runtime_object@details@Concurrency@@QAE@XZ */
/* ??0_Runtime_object@details@Concurrency@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(_Runtime_object_ctor, 4)
_Runtime_object* __thiscall _Runtime_object_ctor(_Runtime_object *this)
{
TRACE("(%p)\n", this);
this->vtable = &MSVCP__Runtime_object_vtable;
this->id = InterlockedExchangeAdd(&_Runtime_object_id, 2);
return this;
}
DEFINE_THISCALL_WRAPPER(_Runtime_object__GetId, 4)
int __thiscall _Runtime_object__GetId(_Runtime_object *this)
{
TRACE("(%p)\n", this);
return this->id;
}
DEFINE_RTTI_DATA0(_Runtime_object, 0, ".?AV_Runtime_object@details@Concurrency@@")
#endif
#ifndef __GNUC__
......@@ -1597,6 +1639,8 @@ void __asm_dummy_vtables(void) {
VTABLE_ADD_FUNC(_Concurrent_queue_base_v4_vector_dtor)
VTABLE_ADD_FUNC(_Concurrent_queue_base_v4_dummy)
VTABLE_ADD_FUNC(_Concurrent_queue_base_v4_dummy));
__ASM_VTABLE(_Runtime_object,
VTABLE_ADD_FUNC(_Runtime_object__GetId));
#endif
#if _MSVCP_VER >= 110
__ASM_VTABLE(_Pad,
......@@ -1756,6 +1800,7 @@ void init_misc(void *base)
#endif
#if _MSVCP_VER >= 100
init__Concurrent_queue_base_v4_rtti(base);
init__Runtime_object_rtti(base);
#endif
#if _MSVCP_VER >= 110
init__Pad_rtti(base);
......
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