#include <vm/WKdm_new.h>

vm/WKdm_new.h Kernel.framework

direct-mapped partial matching compressor with simple 22/10 split Compresses buffers using a dictionary based match and partial match (high bits only or full match) scheme. Paul Wilson -- wilson@cs.utexas.edu Scott F. Kaplan -- sfkaplan@cs.utexas.edu September 1997
includes: mach/vm_param.h
4 functions · 1 macro · 1 typedef

macroWKdm_SCRATCH_BUF_SIZE_INTERNAL

#define WKdm_SCRATCH_BUF_SIZE_INTERNAL PAGE_SIZE

typedefWK_word

typedef unsigned int WK_word

functionWKdm_decompress_4k

void WKdm_decompress_4k(
	const WK_word* src_buf,
	WK_word* dest_buf,
	WK_word* scratch,
	unsigned int bytes
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/WKdm_new.h, osfmk/arm64/WKdmCompress_4k.s, osfmk/arm64/WKdmDecompress_4k.s
Decompresses a buffer produced by WKdm_compress_4k back into a 4 KB page. src_buf is the compressed bit stream (header, packed tags, miss words, dictionary indices, low bits), dest_buf receives the decompressed page, and scratch is a caller-supplied scratch area; the bytes argument is unused by the WKdm decoder proper (it is consulted by the mostly-zero-value fast path). Used by the VM compressor to decompress WKdm-compressed pages on 4 KB-page arm64 systems.

functionWKdm_compress_4k

int WKdm_compress_4k(
	const WK_word* src_buf,
	WK_word* dest_buf,
	WK_word* scratch,
	unsigned int limit
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/WKdm_new.h, osfmk/arm64/WKdmCompress_4k.s, osfmk/arm64/WKdmDecompress_4k.s, osfmk/vm/vm_compressor.c
Compresses one 4 KB page with the WKdm direct-mapped partial-matching compressor, the default in-kernel codec used by the VM compressor on 4 KB-page arm64 systems. Each source word is matched against a 16-entry dynamic dictionary and tagged as zero, exact match, partial (high 22 bits) match, or miss; the output is a header, packed 2-bit tags, miss words, packed 4-bit dictionary indices, and packed 10-bit low bits. src_buf is the 4 KB page, dest_buf the output buffer, scratch a page-sized caller-supplied scratch area, and limit the byte budget. Returns the number of compressed bytes, or -1 if the page cannot be compressed within limit (dest_buf contents are then undefined).

functionWKdm_decompress_16k

void WKdm_decompress_16k(
	WK_word* src_buf,
	WK_word* dest_buf,
	WK_word* scratch,
	unsigned int bytes
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/WKdm_new.h, osfmk/arm64/WKdmDecompress_16k.s
Variant of WKdm_decompress_4k for 16 KB pages: decompresses a buffer produced by WKdm_compress_16k back into a 16 KB page in dest_buf, using the caller-supplied scratch area. The bytes argument is unused by the WKdm decoder proper.

functionWKdm_compress_16k

int WKdm_compress_16k(
	WK_word* src_buf,
	WK_word* dest_buf,
	WK_word* scratch,
	unsigned int limit
)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/vm/WKdm_new.h, osfmk/arm64/WKdmCompress_16k.s, osfmk/vm/vm_compressor.c
Variant of WKdm_compress_4k for 16 KB pages: compresses one 16 KB page with the WKdm dictionary-based partial-matching algorithm, used by the VM compressor on 16 KB-page arm64 systems. Returns the number of compressed bytes, or -1 if the page cannot be compressed within the limit byte budget (dest_buf contents are then undefined).