add CIRCUITPY-CHANGE annotations

This commit is contained in:
Dan Halbert 2023-11-08 09:08:10 -05:00 committed by GitHub
parent eb1b27431a
commit 191a5a31c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -363,6 +363,7 @@ bool gc_is_locked(void) {
return MP_STATE_THREAD(gc_lock_depth) != 0; return MP_STATE_THREAD(gc_lock_depth) != 0;
} }
// CIRCUITPY-CHANGE
bool gc_ptr_on_heap(void *ptr) { bool gc_ptr_on_heap(void *ptr) {
for (mp_state_mem_area_t *area = &MP_STATE_MEM(area); area != NULL; area = NEXT_AREA(area)) { for (mp_state_mem_area_t *area = &MP_STATE_MEM(area); area != NULL; area = NEXT_AREA(area)) {
if (ptr >= (void *)area->gc_pool_start // must be above start of pool if (ptr >= (void *)area->gc_pool_start // must be above start of pool

View File

@ -85,6 +85,7 @@ void *gc_realloc(void *ptr, size_t n_bytes, bool allow_move);
// very sparingly because it can leak memory. // very sparingly because it can leak memory.
bool gc_never_free(void *ptr); bool gc_never_free(void *ptr);
// CIRCUITPY-CHANGE
// True if the pointer is on the MP heap. Doesn't require that it is the start // True if the pointer is on the MP heap. Doesn't require that it is the start
// of a block. // of a block.
bool gc_ptr_on_heap(void *ptr); bool gc_ptr_on_heap(void *ptr);