mirror of https://github.com/exaloop/codon.git
Add seq_alloc_atomic_uncollectable
parent
2736bda827
commit
a03e4b0644
|
@ -173,6 +173,14 @@ SEQ_FUNC void *seq_alloc_uncollectable(size_t n) {
|
|||
#endif
|
||||
}
|
||||
|
||||
SEQ_FUNC void *seq_alloc_atomic_uncollectable(size_t n) {
|
||||
#if USE_STANDARD_MALLOC
|
||||
return malloc(n);
|
||||
#else
|
||||
return GC_MALLOC_ATOMIC_UNCOLLECTABLE(n);
|
||||
#endif
|
||||
}
|
||||
|
||||
SEQ_FUNC void *seq_calloc(size_t m, size_t n) {
|
||||
#if USE_STANDARD_MALLOC
|
||||
return calloc(m, n);
|
||||
|
|
|
@ -16,6 +16,11 @@ def seq_alloc_atomic(a: int) -> cobj:
|
|||
def seq_alloc_uncollectable(a: int) -> cobj:
|
||||
pass
|
||||
|
||||
@pure
|
||||
@C
|
||||
def seq_alloc_atomic_uncollectable(a: int) -> cobj:
|
||||
pass
|
||||
|
||||
@nocapture
|
||||
@derives
|
||||
@C
|
||||
|
@ -71,6 +76,11 @@ def alloc_atomic(sz: int):
|
|||
def alloc_uncollectable(sz: int):
|
||||
return seq_alloc_uncollectable(sz)
|
||||
|
||||
# Allocates a block of memory via GC that is scanned,
|
||||
# but not collected itself. Should be free'd explicitly.
|
||||
def alloc_atomic_uncollectable(sz: int):
|
||||
return seq_alloc_atomic_uncollectable(sz)
|
||||
|
||||
def realloc(p: cobj, newsz: int, oldsz: int):
|
||||
return seq_realloc(p, newsz, oldsz)
|
||||
|
||||
|
|
|
@ -1709,6 +1709,7 @@ class _PyWrap:
|
|||
|
||||
def _err(k, T: type = NoneType) -> T:
|
||||
raise TypeError(F + "() missing required positional argument: '" + k + "'")
|
||||
|
||||
def _get_arg(F, p, k, i: Static[int]):
|
||||
if _S.fn_arg_has_type(F, i):
|
||||
return _S.fn_arg_get_type(F, i).__from_py__(p[i]) if p[i] != cobj() else (
|
||||
|
|
Loading…
Reference in New Issue