Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
zstd_cwksp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under both the BSD-style license (found in the
6 * LICENSE file in the root directory of this source tree) and the GPLv2 (found
7 * in the COPYING file in the root directory of this source tree).
8 * You may select, at your option, one of the above-listed licenses.
9 */
10
11#ifndef ZSTD_CWKSP_H
12#define ZSTD_CWKSP_H
13
14/*-*************************************
15* Dependencies
16***************************************/
17#include "../common/allocations.h" /* ZSTD_customMalloc, ZSTD_customFree */
20
21#if defined (__cplusplus)
22extern "C" {
23#endif
24
25/*-*************************************
26* Constants
27***************************************/
28
29/* Since the workspace is effectively its own little malloc implementation /
30 * arena, when we run under ASAN, we should similarly insert redzones between
31 * each internal element of the workspace, so ASAN will catch overruns that
32 * reach outside an object but that stay inside the workspace.
33 *
34 * This defines the size of that redzone.
35 */
36#ifndef ZSTD_CWKSP_ASAN_REDZONE_SIZE
37#define ZSTD_CWKSP_ASAN_REDZONE_SIZE 128
38#endif
39
40
41/* Set our tables and aligneds to align by 64 bytes */
42#define ZSTD_CWKSP_ALIGNMENT_BYTES 64
43
44/*-*************************************
45* Structures
46***************************************/
53
63
158typedef struct {
159 void* workspace;
160 void* workspaceEnd;
161
162 void* objectEnd;
163 void* tableEnd;
164 void* tableValidEnd;
165 void* allocStart;
167
168 BYTE allocFailed;
169 int workspaceOversizedDuration;
172} ZSTD_cwksp;
173
174/*-*************************************
175* Functions
176***************************************/
177
180
182 (void)ws;
183 assert(ws->workspace <= ws->objectEnd);
184 assert(ws->objectEnd <= ws->tableEnd);
185 assert(ws->objectEnd <= ws->tableValidEnd);
186 assert(ws->tableEnd <= ws->allocStart);
187 assert(ws->tableValidEnd <= ws->allocStart);
188 assert(ws->allocStart <= ws->workspaceEnd);
190 assert(ws->workspace <= ws->initOnceStart);
191#if ZSTD_MEMORY_SANITIZER
192 {
193 intptr_t const offset = __msan_test_shadow(ws->initOnceStart,
195#if defined(ZSTD_MSAN_PRINT)
196 if(offset!=-1) {
197 __msan_print_shadow((U8*)ws->initOnceStart + offset - 8, 32);
198 }
199#endif
200 assert(offset==-1);
201 };
202#endif
203}
204
208MEM_STATIC size_t ZSTD_cwksp_align(size_t size, size_t const align) {
209 size_t const mask = align - 1;
210 assert((align & mask) == 0);
211 return (size + mask) & ~mask;
212}
213
227 if (size == 0)
228 return 0;
229#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
231#else
232 return size;
233#endif
234}
235
243
249 /* For alignment, the wksp will always allocate an additional 2*ZSTD_CWKSP_ALIGNMENT_BYTES
250 * bytes to align the beginning of tables section and end of buffers;
251 */
252 size_t const slackSpace = ZSTD_CWKSP_ALIGNMENT_BYTES * 2;
253 return slackSpace;
254}
255
256
261MEM_STATIC size_t ZSTD_cwksp_bytes_to_align_ptr(void* ptr, const size_t alignBytes) {
262 size_t const alignBytesMask = alignBytes - 1;
263 size_t const bytes = (alignBytes - ((size_t)ptr & (alignBytesMask))) & alignBytesMask;
264 assert((alignBytes & alignBytesMask) == 0);
265 assert(bytes < alignBytes);
266 return bytes;
267}
268
274 return (void*)((size_t)ws->workspaceEnd & ~(ZSTD_CWKSP_ALIGNMENT_BYTES-1));
275}
276
284MEM_STATIC void*
286{
287 void* const alloc = (BYTE*)ws->allocStart - bytes;
288 void* const bottom = ws->tableEnd;
289 DEBUGLOG(5, "cwksp: reserving %p %zd bytes, %zd bytes remaining",
292 assert(alloc >= bottom);
293 if (alloc < bottom) {
294 DEBUGLOG(4, "cwksp: alloc failed!");
295 ws->allocFailed = 1;
296 return NULL;
297 }
298 /* the area is reserved from the end of wksp.
299 * If it overlaps with tableValidEnd, it voids guarantees on values' range */
300 if (alloc < ws->tableValidEnd) {
301 ws->tableValidEnd = alloc;
302 }
303 ws->allocStart = alloc;
304 return alloc;
305}
306
312MEM_STATIC size_t
314{
315 assert(phase >= ws->phase);
316 if (phase > ws->phase) {
317 /* Going from allocating objects to allocating initOnce / tables */
320 ws->tableValidEnd = ws->objectEnd;
322
323 { /* Align the start of the tables to 64 bytes. Use [0, 63] bytes */
324 void *const alloc = ws->objectEnd;
325 size_t const bytesToAlign = ZSTD_cwksp_bytes_to_align_ptr(alloc, ZSTD_CWKSP_ALIGNMENT_BYTES);
326 void *const objectEnd = (BYTE *) alloc + bytesToAlign;
327 DEBUGLOG(5, "reserving table alignment addtl space: %zu", bytesToAlign);
328 RETURN_ERROR_IF(objectEnd > ws->workspaceEnd, memory_allocation,
329 "table phase - alignment initial allocation failed!");
330 ws->objectEnd = objectEnd;
331 ws->tableEnd = objectEnd; /* table area starts being empty */
332 if (ws->tableValidEnd < ws->tableEnd) {
333 ws->tableValidEnd = ws->tableEnd;
334 }
335 }
336 }
337 ws->phase = phase;
339 }
340 return 0;
341}
342
346MEM_STATIC int ZSTD_cwksp_owns_buffer(const ZSTD_cwksp* ws, const void* ptr)
347{
348 return (ptr != NULL) && (ws->workspace <= ptr) && (ptr < ws->workspaceEnd);
349}
350
354MEM_STATIC void*
356{
357 void* alloc;
358 if (ZSTD_isError(ZSTD_cwksp_internal_advance_phase(ws, phase)) || bytes == 0) {
359 return NULL;
360 }
361
362#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
363 /* over-reserve space */
365#endif
366
368
369#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
370 /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on
371 * either size. */
372 if (alloc) {
373 alloc = (BYTE *)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE;
375 /* We need to keep the redzone poisoned while unpoisoning the bytes that
376 * are actually allocated. */
377 __asan_unpoison_memory_region(alloc, bytes - 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE);
378 }
379 }
380#endif
381
382 return alloc;
383}
384
392
403{
404 size_t const alignedBytes = ZSTD_cwksp_align(bytes, ZSTD_CWKSP_ALIGNMENT_BYTES);
406 assert(((size_t)ptr & (ZSTD_CWKSP_ALIGNMENT_BYTES-1))== 0);
407 if(ptr && ptr < ws->initOnceStart) {
408 /* We assume the memory following the current allocation is either:
409 * 1. Not usable as initOnce memory (end of workspace)
410 * 2. Another initOnce buffer that has been allocated before (and so was previously memset)
411 * 3. An ASAN redzone, in which case we don't want to write on it
412 * For these reasons it should be fine to not explicitly zero every byte up to ws->initOnceStart.
413 * Note that we assume here that MSAN and ASAN cannot run in the same time. */
414 ZSTD_memset(ptr, 0, MIN((size_t)((U8*)ws->initOnceStart - (U8*)ptr), alignedBytes));
415 ws->initOnceStart = ptr;
416 }
417#if ZSTD_MEMORY_SANITIZER
418 assert(__msan_test_shadow(ptr, bytes) == -1);
419#endif
420 return ptr;
421}
422
433
440{
442 void* alloc;
443 void* end;
444 void* top;
445
446 /* We can only start allocating tables after we are done reserving space for objects at the
447 * start of the workspace */
448 if(ws->phase < phase) {
450 return NULL;
451 }
452 }
453 alloc = ws->tableEnd;
454 end = (BYTE *)alloc + bytes;
455 top = ws->allocStart;
456
457 DEBUGLOG(5, "cwksp: reserving %p table %zd bytes, %zd bytes remaining",
459 assert((bytes & (sizeof(U32)-1)) == 0);
461 assert(end <= top);
462 if (end > top) {
463 DEBUGLOG(4, "cwksp: table alloc failed!");
464 ws->allocFailed = 1;
465 return NULL;
466 }
467 ws->tableEnd = end;
468
469#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
471 __asan_unpoison_memory_region(alloc, bytes);
472 }
473#endif
474
476 assert(((size_t)alloc & (ZSTD_CWKSP_ALIGNMENT_BYTES-1))== 0);
477 return alloc;
478}
479
485{
486 size_t const roundedBytes = ZSTD_cwksp_align(bytes, sizeof(void*));
487 void* alloc = ws->objectEnd;
488 void* end = (BYTE*)alloc + roundedBytes;
489
490#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
491 /* over-reserve space */
492 end = (BYTE *)end + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE;
493#endif
494
495 DEBUGLOG(4,
496 "cwksp: reserving %p object %zd bytes (rounded to %zd), %zd bytes remaining",
497 alloc, bytes, roundedBytes, ZSTD_cwksp_available_space(ws) - roundedBytes);
498 assert((size_t)alloc % ZSTD_ALIGNOF(void*) == 0);
499 assert(bytes % ZSTD_ALIGNOF(void*) == 0);
501 /* we must be in the first phase, no advance is possible */
502 if (ws->phase != ZSTD_cwksp_alloc_objects || end > ws->workspaceEnd) {
503 DEBUGLOG(3, "cwksp: object alloc failed!");
504 ws->allocFailed = 1;
505 return NULL;
506 }
507 ws->objectEnd = end;
508 ws->tableEnd = end;
509 ws->tableValidEnd = end;
510
511#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
512 /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on
513 * either size. */
514 alloc = (BYTE*)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE;
516 __asan_unpoison_memory_region(alloc, bytes);
517 }
518#endif
519
520 return alloc;
521}
522
524{
525 DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty");
526
527#if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE)
528 /* To validate that the table re-use logic is sound, and that we don't
529 * access table space that we haven't cleaned, we re-"poison" the table
530 * space every time we mark it dirty.
531 * Since tableValidEnd space and initOnce space may overlap we don't poison
532 * the initOnce portion as it break its promise. This means that this poisoning
533 * check isn't always applied fully. */
534 {
535 size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd;
536 assert(__msan_test_shadow(ws->objectEnd, size) == -1);
537 if((BYTE*)ws->tableValidEnd < (BYTE*)ws->initOnceStart) {
538 __msan_poison(ws->objectEnd, size);
539 } else {
540 assert(ws->initOnceStart >= ws->objectEnd);
541 __msan_poison(ws->objectEnd, (BYTE*)ws->initOnceStart - (BYTE*)ws->objectEnd);
542 }
543 }
544#endif
545
546 assert(ws->tableValidEnd >= ws->objectEnd);
547 assert(ws->tableValidEnd <= ws->allocStart);
548 ws->tableValidEnd = ws->objectEnd;
550}
551
553 DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_clean");
554 assert(ws->tableValidEnd >= ws->objectEnd);
555 assert(ws->tableValidEnd <= ws->allocStart);
556 if (ws->tableValidEnd < ws->tableEnd) {
557 ws->tableValidEnd = ws->tableEnd;
558 }
560}
561
566 DEBUGLOG(4, "cwksp: ZSTD_cwksp_clean_tables");
567 assert(ws->tableValidEnd >= ws->objectEnd);
568 assert(ws->tableValidEnd <= ws->allocStart);
569 if (ws->tableValidEnd < ws->tableEnd) {
570 ZSTD_memset(ws->tableValidEnd, 0, (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->tableValidEnd));
571 }
573}
574
580 DEBUGLOG(4, "cwksp: clearing tables!");
581
582#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
583 /* We don't do this when the workspace is statically allocated, because
584 * when that is the case, we have no capability to hook into the end of the
585 * workspace's lifecycle to unpoison the memory.
586 */
588 size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd;
589 __asan_poison_memory_region(ws->objectEnd, size);
590 }
591#endif
592
593 ws->tableEnd = ws->objectEnd;
595}
596
602 DEBUGLOG(4, "cwksp: clearing!");
603
604#if ZSTD_MEMORY_SANITIZER && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE)
605 /* To validate that the context re-use logic is sound, and that we don't
606 * access stuff that this compression hasn't initialized, we re-"poison"
607 * the workspace except for the areas in which we expect memory re-use
608 * without initialization (objects, valid tables area and init once
609 * memory). */
610 {
611 if((BYTE*)ws->tableValidEnd < (BYTE*)ws->initOnceStart) {
612 size_t size = (BYTE*)ws->initOnceStart - (BYTE*)ws->tableValidEnd;
613 __msan_poison(ws->tableValidEnd, size);
614 }
615 }
616#endif
617
618#if ZSTD_ADDRESS_SANITIZER && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE)
619 /* We don't do this when the workspace is statically allocated, because
620 * when that is the case, we have no capability to hook into the end of the
621 * workspace's lifecycle to unpoison the memory.
622 */
624 size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->objectEnd;
625 __asan_poison_memory_region(ws->objectEnd, size);
626 }
627#endif
628
629 ws->tableEnd = ws->objectEnd;
631 ws->allocFailed = 0;
634 }
636}
637
644 DEBUGLOG(4, "cwksp: init'ing workspace with %zd bytes", size);
645 assert(((size_t)start & (sizeof(void*)-1)) == 0); /* ensure correct alignment */
646 ws->workspace = start;
647 ws->workspaceEnd = (BYTE*)start + size;
648 ws->objectEnd = ws->workspace;
649 ws->tableValidEnd = ws->objectEnd;
652 ws->isStatic = isStatic;
656}
657
658MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem customMem) {
659 void* workspace = ZSTD_customMalloc(size, customMem);
660 DEBUGLOG(4, "cwksp: creating new workspace with %zd bytes", size);
661 RETURN_ERROR_IF(workspace == NULL, memory_allocation, "NULL pointer!");
663 return 0;
664}
665
666MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) {
667 void *ptr = ws->workspace;
668 DEBUGLOG(4, "cwksp: freeing workspace");
669 ZSTD_memset(ws, 0, sizeof(ZSTD_cwksp));
670 ZSTD_customFree(ptr, customMem);
671}
672
681
683 return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace);
684}
685
687 return (size_t)((BYTE*)ws->tableEnd - (BYTE*)ws->workspace)
688 + (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->allocStart);
689}
690
692 return ws->allocFailed;
693}
694
695/*-*************************************
696* Functions Checking Free Space
697***************************************/
698
699/* ZSTD_alignmentSpaceWithinBounds() :
700 * Returns if the estimated space needed for a wksp is within an acceptable limit of the
701 * actual amount of space used.
702 */
703MEM_STATIC int ZSTD_cwksp_estimated_space_within_bounds(const ZSTD_cwksp *const ws, size_t const estimatedSpace) {
704 /* We have an alignment space between objects and tables between tables and buffers, so we can have up to twice
705 * the alignment bytes difference between estimation and actual usage */
706 return (estimatedSpace - ZSTD_cwksp_slack_space_required()) <= ZSTD_cwksp_used(ws) &&
707 ZSTD_cwksp_used(ws) <= estimatedSpace;
708}
709
710
712 return (size_t)((BYTE*)ws->allocStart - (BYTE*)ws->tableEnd);
713}
714
715MEM_STATIC int ZSTD_cwksp_check_available(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
716 return ZSTD_cwksp_available_space(ws) >= additionalNeededSpace;
717}
718
719MEM_STATIC int ZSTD_cwksp_check_too_large(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
721 ws, additionalNeededSpace * ZSTD_WORKSPACETOOLARGE_FACTOR);
722}
723
724MEM_STATIC int ZSTD_cwksp_check_wasteful(ZSTD_cwksp* ws, size_t additionalNeededSpace) {
725 return ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)
727}
728
730 ZSTD_cwksp* ws, size_t additionalNeededSpace) {
731 if (ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)) {
733 } else {
735 }
736}
737
738#if defined (__cplusplus)
739}
740#endif
741
742#endif /* ZSTD_CWKSP_H */
int start()
#define MIN(a, b)
Definition deflate.c:1626
unsigned char BYTE
Definition lz4.c:314
#define DEBUGLOG(l,...)
Definition lz4.c:289
unsigned int U32
Definition lz4.c:316
#define assert(condition)
Definition lz4.c:273
char * dst
Definition lz4.h:833
const char * src
Definition lz4.h:866
#define RETURN_ERROR_IF(c, e)
Definition lz4frame.c:320
Definition zstd_cwksp.h:145
BYTE allocFailed
Definition zstd_cwksp.h:154
void * workspaceEnd
Definition zstd_cwksp.h:147
void * tableValidEnd
Definition zstd_cwksp.h:151
void * tableEnd
Definition zstd_cwksp.h:150
ZSTD_cwksp_alloc_phase_e phase
Definition zstd_cwksp.h:156
int workspaceOversizedDuration
Definition zstd_cwksp.h:155
void * objectEnd
Definition zstd_cwksp.h:149
void * workspace
Definition zstd_cwksp.h:146
void * initOnceStart
Definition zstd_cwksp.h:166
void * allocStart
Definition zstd_cwksp.h:152
ZSTD_cwksp_static_alloc_e isStatic
Definition zstd_cwksp.h:157
Definition compress42.c:551
#define ZSTD_ALIGNOF(T)
Definition compiler.h:267
size_t size
Definition platform.h:559
#define NULL
Definition getopt1.c:37
uint8_t U8
Definition mem.h:33
#define MEM_STATIC
Definition mem.h:27
#define ZSTD_memset(d, s, n)
Definition zstd_deps.h:34
void * ZSTD_customMalloc(size_t size, ZSTD_customMem customMem)
Definition zstd_common.c:56
void ZSTD_customFree(void *ptr, ZSTD_customMem customMem)
Definition zstd_common.c:75
#define ZSTD_WORKSPACETOOLARGE_MAXDURATION
Definition zstd_internal.h:274
#define ZSTD_isError
Definition zstd_internal.h:49
#define ZSTD_WORKSPACETOOLARGE_FACTOR
Definition zstd_internal.h:267
MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp *ws, size_t size, ZSTD_customMem customMem)
Definition zstd_cwksp.h:586
MEM_STATIC size_t ZSTD_cwksp_align(size_t size, size_t const align)
Definition zstd_cwksp.h:179
MEM_STATIC void ZSTD_cwksp_mark_tables_clean(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:484
MEM_STATIC int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp *ws)
Definition zstd_cwksp.h:619
ZSTD_cwksp_static_alloc_e
Definition zstd_cwksp.h:56
@ ZSTD_cwksp_dynamic_alloc
Definition zstd_cwksp.h:57
@ ZSTD_cwksp_static_alloc
Definition zstd_cwksp.h:58
MEM_STATIC void * ZSTD_cwksp_reserve_internal_buffer_space(ZSTD_cwksp *ws, size_t const bytes)
Definition zstd_cwksp.h:252
MEM_STATIC void ZSTD_cwksp_move(ZSTD_cwksp *dst, ZSTD_cwksp *src)
Definition zstd_cwksp.h:605
MEM_STATIC size_t ZSTD_cwksp_internal_advance_phase(ZSTD_cwksp *ws, ZSTD_cwksp_alloc_phase_e phase)
Definition zstd_cwksp.h:280
MEM_STATIC size_t ZSTD_cwksp_used(const ZSTD_cwksp *ws)
Definition zstd_cwksp.h:614
#define ZSTD_CWKSP_ALIGNMENT_BYTES
Definition zstd_cwksp.h:40
MEM_STATIC void ZSTD_cwksp_clean_tables(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:497
MEM_STATIC int ZSTD_cwksp_check_too_large(ZSTD_cwksp *ws, size_t additionalNeededSpace)
Definition zstd_cwksp.h:653
MEM_STATIC size_t ZSTD_cwksp_bytes_to_align_ptr(void *ptr, const size_t alignBytes)
Definition zstd_cwksp.h:236
MEM_STATIC void ZSTD_cwksp_clear_tables(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:511
MEM_STATIC void ZSTD_cwksp_assert_internal_consistency(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:166
MEM_STATIC int ZSTD_cwksp_owns_buffer(const ZSTD_cwksp *ws, const void *ptr)
Definition zstd_cwksp.h:322
MEM_STATIC int ZSTD_cwksp_check_wasteful(ZSTD_cwksp *ws, size_t additionalNeededSpace)
Definition zstd_cwksp.h:658
MEM_STATIC int ZSTD_cwksp_estimated_space_within_bounds(const ZSTD_cwksp *const ws, size_t const estimatedSpace, int resizedWorkspace)
Definition zstd_cwksp.h:631
MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp *ws)
Definition zstd_cwksp.h:610
MEM_STATIC void ZSTD_cwksp_bump_oversized_duration(ZSTD_cwksp *ws, size_t additionalNeededSpace)
Definition zstd_cwksp.h:663
MEM_STATIC size_t ZSTD_cwksp_slack_space_required(void)
Definition zstd_cwksp.h:219
MEM_STATIC void ZSTD_cwksp_mark_tables_dirty(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:463
ZSTD_cwksp_alloc_phase_e
Definition zstd_cwksp.h:45
@ ZSTD_cwksp_alloc_objects
Definition zstd_cwksp.h:46
@ ZSTD_cwksp_alloc_buffers
Definition zstd_cwksp.h:47
@ ZSTD_cwksp_alloc_aligned
Definition zstd_cwksp.h:48
MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp *ws, ZSTD_customMem customMem)
Definition zstd_cwksp.h:594
MEM_STATIC void * ZSTD_cwksp_reserve_internal(ZSTD_cwksp *ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase)
Definition zstd_cwksp.h:331
MEM_STATIC BYTE * ZSTD_cwksp_reserve_buffer(ZSTD_cwksp *ws, size_t bytes)
Definition zstd_cwksp.h:362
MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:533
MEM_STATIC void * ZSTD_cwksp_reserve_object(ZSTD_cwksp *ws, size_t bytes)
Definition zstd_cwksp.h:424
MEM_STATIC void ZSTD_cwksp_init(ZSTD_cwksp *ws, void *start, size_t size, ZSTD_cwksp_static_alloc_e isStatic)
Definition zstd_cwksp.h:572
MEM_STATIC size_t ZSTD_cwksp_aligned_alloc_size(size_t size)
Definition zstd_cwksp.h:211
MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size)
Definition zstd_cwksp.h:197
MEM_STATIC int ZSTD_cwksp_check_available(ZSTD_cwksp *ws, size_t additionalNeededSpace)
Definition zstd_cwksp.h:649
MEM_STATIC void * ZSTD_cwksp_reserve_table(ZSTD_cwksp *ws, size_t bytes)
Definition zstd_cwksp.h:383
#define ZSTD_CWKSP_ASAN_REDZONE_SIZE
Definition zstd_cwksp.h:35
MEM_STATIC void * ZSTD_cwksp_reserve_aligned(ZSTD_cwksp *ws, size_t bytes)
Definition zstd_cwksp.h:370
MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:645
MEM_STATIC void * ZSTD_cwksp_reserve_aligned_init_once(ZSTD_cwksp *ws, size_t bytes)
Definition zstd_cwksp.h:402
@ ZSTD_cwksp_alloc_aligned_init_once
Definition zstd_cwksp.h:49
MEM_STATIC void * ZSTD_cwksp_initialAllocStart(ZSTD_cwksp *ws)
Definition zstd_cwksp.h:273
ZSTD_cwksp_static_alloc_e
Definition zstd_cwksp.h:59
ZSTD_cwksp_alloc_phase_e
Definition zstd_cwksp.h:47