From ab66ae47f226e5e465c33f0c189bc26f1a51f9c9 Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Mon, 8 May 2000 09:57:29 +0000 Subject: [PATCH] * eval.c: Removed ASRTSYNTAX macro. Removed function 'bodycheck'. * stacks.c: Removed unused calculations, minimized variable scopes. --- libguile/ChangeLog | 14 ++++++++++++++ libguile/eval.c | 23 +++++------------------ libguile/stacks.c | 13 +++---------- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 87412aa62..acb852baf 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,17 @@ +2000-05-08 Dirk Herrmann + + * eval.c (ASRTSYNTAX, scm_m_body, scm_m_letrec1): Removed + ASRTSYNTAX. Using SCM_ASSYNT instead. + + (scm_m_body): Don't create a redundant cons cell. + + (scm_m_do): Removed redundant test 'bodycheck'. + + (bodycheck): Removed. + + * stacks.c (stack_depth, read_frame, read_frames): Removed + redundant calculation of size, minimized some variable scopes. + 2000-05-05 Dirk Herrmann * pairs.c (scm_cons, scm_cons2): Use SCM{_SET}?_CELL_OBJECT as diff --git a/libguile/eval.c b/libguile/eval.c index bf9d6cf5b..b311da464 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -459,17 +459,6 @@ SCM scm_sym_enter_frame, scm_sym_apply_frame, scm_sym_exit_frame; SCM scm_sym_trace; #endif -#define ASRTSYNTAX(cond_, msg_) if(!(cond_))scm_wta(xorig, (msg_), what); - - - -static void bodycheck (SCM xorig, SCM *bodyloc, const char *what); - -static void -bodycheck (SCM xorig, SCM *bodyloc, const char *what) -{ - ASRTSYNTAX (scm_ilength (*bodyloc) >= 1, scm_s_expression); -} /* Check that the body denoted by XORIG is valid and rewrite it into its internal form. The internal form of a body is just the body @@ -487,7 +476,7 @@ bodycheck (SCM xorig, SCM *bodyloc, const char *what) static SCM scm_m_body (SCM op, SCM xorig, const char *what) { - ASRTSYNTAX (scm_ilength (xorig) >= 1, scm_s_expression); + SCM_ASSYNT (scm_ilength (xorig) >= 1, xorig, scm_s_expression, what); /* Don't add another ISYM if one is present already. */ if (SCM_ISYMP (SCM_CAR (xorig))) @@ -502,7 +491,7 @@ scm_m_body (SCM op, SCM xorig, const char *what) return xorig; } - return scm_cons2 (op, SCM_CAR (xorig), SCM_CDR(xorig)); + return scm_cons (op, xorig); } SCM_SYNTAX(s_quote,"quote", scm_makmmacro, scm_m_quote); @@ -789,7 +778,6 @@ scm_m_do (SCM xorig, SCM env) SCM_ASSYNT (scm_ilength (SCM_CAR (x)) >= 1, xorig, scm_s_test, "do"); x = scm_cons2 (SCM_CAR (x), SCM_CDR (x), steps); x = scm_cons2 (vars, inits, x); - bodycheck (xorig, SCM_CARLOC (SCM_CDR (SCM_CDR (x))), "do"); return scm_cons (SCM_IM_DO, x); } @@ -942,14 +930,13 @@ scm_m_letrec1 (SCM op, SCM imm, SCM xorig, SCM env) SCM vars = SCM_EOL, inits = SCM_EOL, *initloc = &inits; proc = SCM_CAR (x); - ASRTSYNTAX (scm_ilength (proc) >= 1, scm_s_bindings); + SCM_ASSYNT (scm_ilength (proc) >= 1, xorig, scm_s_bindings, what); do { /* vars scm_list reversed here, inits reversed at evaluation */ arg1 = SCM_CAR (proc); - ASRTSYNTAX (2 == scm_ilength (arg1), scm_s_bindings); - ASRTSYNTAX (SCM_SYMBOLP (SCM_CAR (arg1)), - scm_s_variable); + SCM_ASSYNT (2 == scm_ilength (arg1), xorig, scm_s_bindings, what); + SCM_ASSYNT (SCM_SYMBOLP (SCM_CAR (arg1)), xorig, scm_s_variable, what); vars = scm_cons (SCM_CAR (arg1), vars); *initloc = scm_cons (SCM_CAR (SCM_CDR (arg1)), SCM_EOL); initloc = SCM_CDRLOC (*initloc); diff --git a/libguile/stacks.c b/libguile/stacks.c index 961153423..2114fdaff 100644 --- a/libguile/stacks.c +++ b/libguile/stacks.c @@ -156,17 +156,15 @@ static int stack_depth (scm_debug_frame *dframe,long offset,SCM *id,int *maxp) { - int n, size; + int n; int max_depth = SCM_BACKTRACE_MAXDEPTH; - scm_debug_info *info; for (n = 0; dframe && !SCM_VOIDFRAMEP (*dframe) && n < max_depth; dframe = RELOC_FRAME (dframe->prev, offset)) { if (SCM_EVALFRAMEP (*dframe)) { - size = dframe->status & SCM_MAX_FRAME_SIZE; - info = RELOC_INFO (dframe->info, offset); + scm_debug_info * info = RELOC_INFO (dframe->info, offset); n += (info - dframe->vect) / 2 + 1; /* Data in the apply part of an eval info frame comes from previous stack frame if the scm_debug_info vector is overflowed. */ @@ -191,12 +189,9 @@ static void read_frame (scm_debug_frame *dframe,long offset,scm_info_frame *iframe) { scm_bits_t flags = SCM_UNPACK (SCM_INUM0); /* UGh. */ - int size; - scm_debug_info *info; if (SCM_EVALFRAMEP (*dframe)) { - size = dframe->status & SCM_MAX_FRAME_SIZE; - info = RELOC_INFO (dframe->info, offset); + scm_debug_info * info = RELOC_INFO (dframe->info, offset); if ((info - dframe->vect) & 1) { /* Debug.vect ends with apply info. */ @@ -260,7 +255,6 @@ do { \ static int read_frames (scm_debug_frame *dframe,long offset,int n,scm_info_frame *iframes) { - int size; scm_info_frame *iframe = iframes; scm_debug_info *info; static SCM applybody = SCM_UNDEFINED; @@ -283,7 +277,6 @@ read_frames (scm_debug_frame *dframe,long offset,int n,scm_info_frame *iframes) *(iframe - 1) = *iframe; --iframe; } - size = dframe->status & SCM_MAX_FRAME_SIZE; info = RELOC_INFO (dframe->info, offset); if ((info - dframe->vect) & 1) --info;