From 856897545e8e93adc279d82e757a5ec9e55596ae Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Mon, 18 Mar 2024 16:41:36 +0000 Subject: [PATCH] Remove deprecated rt_tlab_alloc --- src/rt/model.c | 23 +++++++++-------------- src/rt/rt.h | 2 -- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/rt/model.c b/src/rt/model.c index 4f27a35c..6edd43ec 100644 --- a/src/rt/model.c +++ b/src/rt/model.c @@ -1929,10 +1929,12 @@ static void *call_resolution(rt_nexus_t *nexus, res_memo_t *r, int nonnull) TRACE("resolved composite signal needs %d bytes", scope->size); - uint8_t *inputs = rt_tlab_alloc(nonnull * scope->size); + rt_model_t *m = get_model(); + model_thread_t *thread = model_thread(m); + + uint8_t *inputs = tlab_alloc(&thread->tlab, nonnull * scope->size); copy_sub_signal_sources(scope, inputs, scope->size); - rt_model_t *m = get_model(); jit_scalar_t result; if (jit_try_call(m->jit, r->closure.handle, &result, r->closure.context, inputs, r->ileft, nonnull)) @@ -2369,6 +2371,9 @@ void model_reset(rt_model_t *m) TRACE("calculate initial signal values"); + model_thread_t *thread = model_thread(m); + tlab_acquire(m->mspace, &thread->tlab); + // The signals in the model are updated as follows in an order such // that if a given signal R depends upon the current value of another // signal S, then the current value of S is updated prior to the @@ -2413,6 +2418,8 @@ void model_reset(rt_model_t *m) fmt_nexus(n, initial)); } + tlab_reset(thread->tlab); // No allocations can be live past here + global_event(m, RT_END_OF_INITIALISATION); } @@ -3580,18 +3587,6 @@ int model_exit_status(rt_model_t *m) return get_vhdl_assert_exit_status(); } -// TODO: this interface should be removed eventually -void *rt_tlab_alloc(size_t size) -{ - rt_model_t *m = get_model(); - model_thread_t *thread = model_thread(m); - - if (tlab_valid(thread->tlab)) - return tlab_alloc(&thread->tlab, size); - else - return mspace_alloc(get_model()->mspace, size); -} - static bool nexus_active(rt_model_t *m, rt_nexus_t *nexus) { if (nexus->n_sources > 0) { diff --git a/src/rt/rt.h b/src/rt/rt.h index c0ca0341..c0b1e353 100644 --- a/src/rt/rt.h +++ b/src/rt/rt.h @@ -91,8 +91,6 @@ typedef enum { typedef uint16_t delta_cycle_t; #define DELTA_CYCLE_MAX UINT16_MAX -void *rt_tlab_alloc(size_t size); - void _std_standard_init(void); void _std_env_init(void); void _std_reflection_init(void); -- 2.39.2