-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Diogo Netto
authored and
Diogo Netto
committed
Aug 12, 2022
1 parent
0dbb1b1
commit 5d5dadc
Showing
3 changed files
with
65 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This file is a part of Julia. License is MIT: https://julialang.org/license | ||
|
||
#include "gc-markqueue.h" | ||
#include "gc.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
static size_t pow2[10] = {1, 2, 4, 8. 16, 32, 64, 128, 256, 512, 1024}; | ||
|
||
static ws_queue_t gc_recycled_pages; | ||
|
||
jl_taggedvalue_t *gc_pool_alloc(jl_ptls_t ptls, size_t sz) | ||
{ | ||
int i = 0; | ||
for (; pow2[i] < sz; i++) | ||
; | ||
|
||
jl_thread_heap_t *pheap = &ptls->heap; | ||
jl_gc_pagedir_entry_t *entry = &pheap->pa_dir_entries[i]; | ||
|
||
jl_taggedvalue_t *obj; | ||
|
||
if (entry->head->pfl != NULL) { | ||
obj = entry->head->pfl; | ||
entry->head->pfl = obj->next; | ||
} | ||
|
||
return obj; | ||
} | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This file is a part of Julia. License is MIT: https://julialang.org/license | ||
|
||
#ifndef JL_GC_POOL_ALLOC_H | ||
#define JL_GC_POOL_ALLOC_H | ||
|
||
#include "gc.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters