[PATCH 11/13 v2] msvcp90: Add implementation of _Concurrent_vector_Internal_compact.

Piotr Caban piotr.caban at gmail.com
Wed Aug 1 05:09:36 CDT 2018


Hi Hua,

On 07/31/18 17:18, Hua Meng wrote:
> @@ -1997,12 +2004,40 @@ MSVCP_size_t __thiscall _Concurrent_vector_base_v4__Internal_clear(
>   /* ?_Internal_compact at _Concurrent_vector_base_v4@details at Concurrency@@IEAAPEAX_KPEAXP6AX10 at ZP6AX1PEBX0@Z at Z */
>   DEFINE_THISCALL_WRAPPER(_Concurrent_vector_base_v4__Internal_compact, 20)
>   void * __thiscall _Concurrent_vector_base_v4__Internal_compact(
> -        _Concurrent_vector_base_v4 *this, MSVCP_size_t len, void *v,
> +        _Concurrent_vector_base_v4 *this, MSVCP_size_t element_size, void *v,
>           void (__cdecl *clear)(void*, MSVCP_size_t),
>           void (__cdecl *copy)(void*, const void*, MSVCP_size_t))
>   {
> -    FIXME("(%p %ld %p %p %p) stub\n", this, len, v, clear, copy);
> -    return NULL;
> +    compact_block *b;
> +    MSVCP_size_t size, seg_no, copy_element, clear_element;
> +    int i;
> +
> +    TRACE("(%p %ld %p %p %p)\n", this, element_size, v, clear, copy);
> +
> +    size = this->early_size;
> +    seg_no = _vector_base_v4__Segment_index_of(size - 1);
It will not work if size==0.
> +    if(this->first_block == seg_no + 1) return v;
The vector still needs to be compacted when there is unused space 
allocated. You should compare this->first_block with index of last 
allocated segment. The function is also returning NULL in this case.

Thanks,
Piotr



More information about the wine-devel mailing list