From 9addb2cc4a862b4f8723ec08f72f42ffe8334aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Wed, 30 Apr 2025 15:24:44 +0200 Subject: [PATCH] bytevm: access interpreter locals in fifo order This is a preliminary step before replacing a structure consed on a heap with the lisp stack. --- src/c/compiler.d | 3 +-- src/c/interpreter.d | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/c/compiler.d b/src/c/compiler.d index 95b0e53d3..370c22d99 100644 --- a/src/c/compiler.d +++ b/src/c/compiler.d @@ -751,8 +751,7 @@ c_lcl_idx(cl_env_ptr env, cl_object entry) } } end_loop_for_on_unsafe(l); if (i<0) ecl_miscompilation_error(); - return i; - /* return n-i; */ + return n-i; } /* This function is called after we compile lambda in the parent's diff --git a/src/c/interpreter.d b/src/c/interpreter.d index 52b1fbef0..cf00c1b2b 100644 --- a/src/c/interpreter.d +++ b/src/c/interpreter.d @@ -151,12 +151,9 @@ drop_lcl(cl_object *stack, cl_fixnum n) } static cl_object -ecl_lcl_env_get_record(cl_object env, int s) +ecl_lcl_env_get_record(cl_object env, cl_fixnum n) { - do { - if (s-- == 0) return ECL_CONS_CAR(env); - env = ECL_CONS_CDR(env); - } while(1); + return ECL_CONS_CAR(ecl_last(env, n+1)); } static cl_object