Lines Matching refs:size

84 static SLJIT_INLINE void* alloc_chunk(sljit_uw size)  in alloc_chunk()  argument
86 return VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); in alloc_chunk()
89 static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size) in free_chunk() argument
91 SLJIT_UNUSED_ARG(size); in free_chunk()
171 static SLJIT_INLINE void* alloc_chunk(sljit_uw size) in alloc_chunk() argument
191 retval = mmap(NULL, size, prot, flags, fd, 0); in alloc_chunk()
197 if (mprotect(retval, size, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) { in alloc_chunk()
198 munmap(retval, size); in alloc_chunk()
203 SLJIT_UPDATE_WX_FLAGS(retval, (uint8_t *)retval + size, 0); in alloc_chunk()
208 static SLJIT_INLINE void free_chunk(void *chunk, sljit_uw size) in free_chunk() argument
210 munmap(chunk, size); in free_chunk()
222 sljit_uw size; member
230 sljit_uw size; member
238 #define ALIGN_SIZE(size) (((size) + sizeof(struct block_header) + 7u) & ~(sljit_uw)7) argument
244 static SLJIT_INLINE void sljit_insert_free_block(struct free_block *free_block, sljit_uw size) in sljit_insert_free_block() argument
246 free_block->header.size = 0; in sljit_insert_free_block()
247 free_block->size = size; in sljit_insert_free_block()
269 SLJIT_API_FUNC_ATTRIBUTE void* sljit_malloc_exec(sljit_uw size) in sljit_malloc_exec() argument
277 if (size < (64 - sizeof(struct block_header))) in sljit_malloc_exec()
278 size = (64 - sizeof(struct block_header)); in sljit_malloc_exec()
279 size = ALIGN_SIZE(size); in sljit_malloc_exec()
283 if (free_block->size >= size) { in sljit_malloc_exec()
284 chunk_size = free_block->size; in sljit_malloc_exec()
286 if (chunk_size > size + 64) { in sljit_malloc_exec()
288 chunk_size -= size; in sljit_malloc_exec()
289 free_block->size = chunk_size; in sljit_malloc_exec()
292 AS_BLOCK_HEADER(header, size)->prev_size = size; in sljit_malloc_exec()
297 size = chunk_size; in sljit_malloc_exec()
299 allocated_size += size; in sljit_malloc_exec()
300 header->size = size; in sljit_malloc_exec()
307 chunk_size = (size + sizeof(struct block_header) + CHUNK_SIZE - 1) & CHUNK_MASK; in sljit_malloc_exec()
318 if (chunk_size > size + 64) { in sljit_malloc_exec()
320 allocated_size += size; in sljit_malloc_exec()
321 header->size = size; in sljit_malloc_exec()
322 chunk_size -= size; in sljit_malloc_exec()
324 free_block = AS_FREE_BLOCK(header, size); in sljit_malloc_exec()
325 free_block->header.prev_size = size; in sljit_malloc_exec()
332 header->size = chunk_size; in sljit_malloc_exec()
335 next_header->size = 1; in sljit_malloc_exec()
348 allocated_size -= header->size; in sljit_free_exec()
356 if (SLJIT_UNLIKELY(!free_block->header.size)) { in sljit_free_exec()
357 free_block->size += header->size; in sljit_free_exec()
358 header = AS_BLOCK_HEADER(free_block, free_block->size); in sljit_free_exec()
359 header->prev_size = free_block->size; in sljit_free_exec()
363 sljit_insert_free_block(free_block, header->size); in sljit_free_exec()
366 header = AS_BLOCK_HEADER(free_block, free_block->size); in sljit_free_exec()
367 if (SLJIT_UNLIKELY(!header->size)) { in sljit_free_exec()
368 free_block->size += ((struct free_block*)header)->size; in sljit_free_exec()
370 header = AS_BLOCK_HEADER(free_block, free_block->size); in sljit_free_exec()
371 header->prev_size = free_block->size; in sljit_free_exec()
375 if (SLJIT_UNLIKELY(!free_block->header.prev_size && header->size == 1)) { in sljit_free_exec()
377 if (total_size - free_block->size > (allocated_size * 3 / 2)) { in sljit_free_exec()
378 total_size -= free_block->size; in sljit_free_exec()
380 free_chunk(free_block, free_block->size + sizeof(struct block_header)); in sljit_free_exec()
400 AS_BLOCK_HEADER(free_block, free_block->size)->size == 1) { in sljit_free_unused_memory_exec()
401 total_size -= free_block->size; in sljit_free_unused_memory_exec()
403 free_chunk(free_block, free_block->size + sizeof(struct block_header)); in sljit_free_unused_memory_exec()