From a2a6c0e319b5c146c484cb1fe8ffc9b14b9a9876 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 6 May 2011 00:17:35 +0200 Subject: avoid tls gets when handling interrupts in the vm * libguile/__scm.h (SCM_ASYNC_TICK_WITH_CODE): Redefine to take a scm_i_thread* as well. OK to do because it's within a BUILDING_LIBGUILE block. * libguile/vm-engine.c (vm_engine): Cache the scm_i_thread* instead of the dynstate, so we can use the thread for ticks. * libguile/vm-engine.h (VM_HANDLE_INTERRUPTS): Tick with the scm_i_thread* local var, to avoid excessive tls calls. * libguile/vm-i-system.c: Fix dynstate users to use current_thread->dynamic_state. --- libguile/vm-i-system.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libguile/vm-i-system.c') diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index ea00fc920..0ff411f9a 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -1635,7 +1635,7 @@ VM_DEFINE_INSTRUCTION (89, wind_fluids, "wind-fluids", 1, -1, 0) wf = scm_i_make_with_fluids (n, sp + 1, sp + 1 + n); NULLSTACK (2 * n); - scm_i_swap_with_fluids (wf, dynstate); + scm_i_swap_with_fluids (wf, current_thread->dynamic_state); scm_i_set_dynwinds (scm_cons (wf, scm_i_dynwinds ())); NEXT; } @@ -1645,7 +1645,7 @@ VM_DEFINE_INSTRUCTION (90, unwind_fluids, "unwind-fluids", 0, 0, 0) SCM wf; wf = scm_car (scm_i_dynwinds ()); scm_i_set_dynwinds (scm_cdr (scm_i_dynwinds ())); - scm_i_swap_with_fluids (wf, dynstate); + scm_i_swap_with_fluids (wf, current_thread->dynamic_state); NEXT; } @@ -1655,7 +1655,7 @@ VM_DEFINE_INSTRUCTION (91, fluid_ref, "fluid-ref", 0, 1, 1) SCM fluids; CHECK_UNDERFLOW (); - fluids = SCM_I_DYNAMIC_STATE_FLUIDS (dynstate); + fluids = SCM_I_DYNAMIC_STATE_FLUIDS (current_thread->dynamic_state); if (SCM_UNLIKELY (!SCM_FLUID_P (*sp)) || ((num = SCM_I_FLUID_NUM (*sp)) >= SCM_SIMPLE_VECTOR_LENGTH (fluids))) { @@ -1683,7 +1683,7 @@ VM_DEFINE_INSTRUCTION (92, fluid_set, "fluid-set", 0, 2, 0) SCM val, fluid, fluids; POP2 (val, fluid); - fluids = SCM_I_DYNAMIC_STATE_FLUIDS (dynstate); + fluids = SCM_I_DYNAMIC_STATE_FLUIDS (current_thread->dynamic_state); if (SCM_UNLIKELY (!SCM_FLUID_P (fluid)) || ((num = SCM_I_FLUID_NUM (fluid)) >= SCM_SIMPLE_VECTOR_LENGTH (fluids))) { -- cgit v1.2.3