1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 14:50:19 +02:00

* eval.c: Removed ASRTSYNTAX macro. Removed function 'bodycheck'.

* stacks.c:  Removed unused calculations, minimized variable scopes.
This commit is contained in:
Dirk Herrmann 2000-05-08 09:57:29 +00:00
parent e2d1d99d7b
commit ab66ae47f2
3 changed files with 22 additions and 28 deletions

View file

@ -1,3 +1,17 @@
2000-05-08 Dirk Herrmann <D.Herrmann@tu-bs.de>
* 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 <D.Herrmann@tu-bs.de> 2000-05-05 Dirk Herrmann <D.Herrmann@tu-bs.de>
* pairs.c (scm_cons, scm_cons2): Use SCM{_SET}?_CELL_OBJECT as * pairs.c (scm_cons, scm_cons2): Use SCM{_SET}?_CELL_OBJECT as

View file

@ -459,17 +459,6 @@ SCM scm_sym_enter_frame, scm_sym_apply_frame, scm_sym_exit_frame;
SCM scm_sym_trace; SCM scm_sym_trace;
#endif #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 /* 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 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 static SCM
scm_m_body (SCM op, SCM xorig, const char *what) 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. */ /* Don't add another ISYM if one is present already. */
if (SCM_ISYMP (SCM_CAR (xorig))) if (SCM_ISYMP (SCM_CAR (xorig)))
@ -502,7 +491,7 @@ scm_m_body (SCM op, SCM xorig, const char *what)
return xorig; 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); 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"); 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 (SCM_CAR (x), SCM_CDR (x), steps);
x = scm_cons2 (vars, inits, x); x = scm_cons2 (vars, inits, x);
bodycheck (xorig, SCM_CARLOC (SCM_CDR (SCM_CDR (x))), "do");
return scm_cons (SCM_IM_DO, x); 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; SCM vars = SCM_EOL, inits = SCM_EOL, *initloc = &inits;
proc = SCM_CAR (x); proc = SCM_CAR (x);
ASRTSYNTAX (scm_ilength (proc) >= 1, scm_s_bindings); SCM_ASSYNT (scm_ilength (proc) >= 1, xorig, scm_s_bindings, what);
do do
{ {
/* vars scm_list reversed here, inits reversed at evaluation */ /* vars scm_list reversed here, inits reversed at evaluation */
arg1 = SCM_CAR (proc); arg1 = SCM_CAR (proc);
ASRTSYNTAX (2 == scm_ilength (arg1), scm_s_bindings); SCM_ASSYNT (2 == scm_ilength (arg1), xorig, scm_s_bindings, what);
ASRTSYNTAX (SCM_SYMBOLP (SCM_CAR (arg1)), SCM_ASSYNT (SCM_SYMBOLP (SCM_CAR (arg1)), xorig, scm_s_variable, what);
scm_s_variable);
vars = scm_cons (SCM_CAR (arg1), vars); vars = scm_cons (SCM_CAR (arg1), vars);
*initloc = scm_cons (SCM_CAR (SCM_CDR (arg1)), SCM_EOL); *initloc = scm_cons (SCM_CAR (SCM_CDR (arg1)), SCM_EOL);
initloc = SCM_CDRLOC (*initloc); initloc = SCM_CDRLOC (*initloc);

View file

@ -156,17 +156,15 @@
static int static int
stack_depth (scm_debug_frame *dframe,long offset,SCM *id,int *maxp) stack_depth (scm_debug_frame *dframe,long offset,SCM *id,int *maxp)
{ {
int n, size; int n;
int max_depth = SCM_BACKTRACE_MAXDEPTH; int max_depth = SCM_BACKTRACE_MAXDEPTH;
scm_debug_info *info;
for (n = 0; for (n = 0;
dframe && !SCM_VOIDFRAMEP (*dframe) && n < max_depth; dframe && !SCM_VOIDFRAMEP (*dframe) && n < max_depth;
dframe = RELOC_FRAME (dframe->prev, offset)) dframe = RELOC_FRAME (dframe->prev, offset))
{ {
if (SCM_EVALFRAMEP (*dframe)) if (SCM_EVALFRAMEP (*dframe))
{ {
size = dframe->status & SCM_MAX_FRAME_SIZE; scm_debug_info * info = RELOC_INFO (dframe->info, offset);
info = RELOC_INFO (dframe->info, offset);
n += (info - dframe->vect) / 2 + 1; n += (info - dframe->vect) / 2 + 1;
/* Data in the apply part of an eval info frame comes from previous /* Data in the apply part of an eval info frame comes from previous
stack frame if the scm_debug_info vector is overflowed. */ 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) read_frame (scm_debug_frame *dframe,long offset,scm_info_frame *iframe)
{ {
scm_bits_t flags = SCM_UNPACK (SCM_INUM0); /* UGh. */ scm_bits_t flags = SCM_UNPACK (SCM_INUM0); /* UGh. */
int size;
scm_debug_info *info;
if (SCM_EVALFRAMEP (*dframe)) if (SCM_EVALFRAMEP (*dframe))
{ {
size = dframe->status & SCM_MAX_FRAME_SIZE; scm_debug_info * info = RELOC_INFO (dframe->info, offset);
info = RELOC_INFO (dframe->info, offset);
if ((info - dframe->vect) & 1) if ((info - dframe->vect) & 1)
{ {
/* Debug.vect ends with apply info. */ /* Debug.vect ends with apply info. */
@ -260,7 +255,6 @@ do { \
static int static int
read_frames (scm_debug_frame *dframe,long offset,int n,scm_info_frame *iframes) read_frames (scm_debug_frame *dframe,long offset,int n,scm_info_frame *iframes)
{ {
int size;
scm_info_frame *iframe = iframes; scm_info_frame *iframe = iframes;
scm_debug_info *info; scm_debug_info *info;
static SCM applybody = SCM_UNDEFINED; 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 - 1) = *iframe;
--iframe; --iframe;
} }
size = dframe->status & SCM_MAX_FRAME_SIZE;
info = RELOC_INFO (dframe->info, offset); info = RELOC_INFO (dframe->info, offset);
if ((info - dframe->vect) & 1) if ((info - dframe->vect) & 1)
--info; --info;